Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 2701

csound-doc-5.19.01-10.mga5.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>tableshuffle</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="tableseg.html" title="tableseg" />
    <link rel="next" href="tablew.html" title="tablew" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">tableshuffle</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="tableseg.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="tablew.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="tableshuffle">
      <a id="tableshuffle"></a>
      <div class="titlepage"></div>
      <a id="IndexTableshuffle" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">tableshuffle</span>
        </h2>
        <p>tableshuffle — 
      shuffles the content of a function table so that each element of the source
      table is put into a different random position.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp47879112"></a>
        <h2>Description</h2>
        <p>
      This opcode can be used in order to shuffle the content of
      function tables into a random order but without loosing any of
      the elements. Imagine shuffling a deck of cards. Each element of
      the table is copied to a different random position. If that
      position was already chosen before then the next free position
      is chosen. The length of the table remains the same.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp47889536"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>tableshuffle</strong></span> ktablenum</pre>
        <pre class="synopsis"><span class="command"><strong>tableshufflei</strong></span> itablenum</pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp47891160"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>ktablenum</em></span> or <span class="emphasis"><em>itablenum</em></span>
      -- the number of the table to shuffle.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp47892240"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the tableshuffle opcode. It uses the file <a class="ulink" href="examples/farey7shuffled.csd" target="_top"><em class="citetitle">farey7shuffled.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp47933424"></a>
          <p class="title">
            <strong>Example 859. Example of the tableshuffle opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
-odac -+rtaudio=alsa --midioutfile=farey7.mid
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
<span class="ohdr">sr</span><span class="op">=</span>48000
<span class="ohdr">ksmps</span><span class="op">=</span>10
<span class="ohdr">nchnls</span><span class="op">=</span>1
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1

gidelta <span class="opc">init</span> 100
gimult <span class="opc">init</span> 101

<span class="comment">;-------- loop and trigger instrument 901 using a Farey Sequence polyrhythm</span>
	  <span class="oblock">instr</span> 1
kindx <span class="opc">init</span> 0
kindx2 <span class="opc">init</span> 0
ktrigger <span class="opc">init</span> 0
ktime_unit <span class="opc">init</span> p6
kstart <span class="opc">init</span> p4
kloop <span class="opc">init</span> p5
kinitndx <span class="opc">init</span> 0
kfn_times <span class="opc">init</span> gidelta
knote <span class="opc">init</span> 60
kbasenote <span class="opc">init</span> p8
ifundam <span class="opc">init</span> p7
ktrigger <span class="opc">seqtime</span> ktime_unit, kstart, kloop, kinitndx, kfn_times
<span class="octrl">if</span> (ktrigger <span class="op">&gt;</span> 0 ) then
     kpitch <span class="op">=</span> <span class="opc">cpspch</span>(ifundam)
     kmult <span class="opc">tab</span> kindx2, gimult
     kpitch <span class="op">=</span> kpitch <span class="op">*</span> kmult
     knote <span class="op">=</span> kbasenote <span class="op">+</span> kmult
     <span class="opc">event</span> "i", 901, 0, .4, .1, kpitch, kpitch <span class="op">*</span> .9, .4,  5,   .75, .8,  1.0, .15, .0,  .125, .125, .25, .5,  1.0, .0, .0,  .0,  .0,  .125, .25, .25, .25, knote
     kindx <span class="op">=</span> kindx <span class="op">+</span> 1
     kindx <span class="op">=</span> kindx <span class="op">%</span> kloop
     kindx2 <span class="op">=</span> kindx2 <span class="op">+</span> 1
     kindx2 <span class="op">=</span> kindx2 <span class="op">%</span> kloop
     <span class="octrl">if</span> (kindx2 <span class="op">==</span> 0) then
     	<span class="opc">tableshuffle</span> gimult
     <span class="octrl">endif</span>
	
<span class="octrl">endif</span>
	<span class="oblock">endin</span> <span class="comment">; 1</span>

<span class="comment">;------ basic 2 Operators FM algorithm ----------------</span>
	<span class="oblock">instr</span> 901
inotedur	<span class="op">=</span>		p3
imaxamp		<span class="op">=</span>		p4 <span class="comment">;ampdb(p4)</span>
icarrfreq	<span class="op">=</span>		p5
imodfreq	<span class="op">=</span>		p6
ilowndx		<span class="op">=</span>		p7
indxdiff	<span class="op">=</span>		p8<span class="op">-</span>p7
knote	        <span class="op">=</span>		p27
aampenv		<span class="opc">linseg</span>	p9, p14<span class="op">*</span>p3, p10, p15<span class="op">*</span>p3, p11, p16<span class="op">*</span>p3, p12, p17<span class="op">*</span>p3, p13 
adevenv		<span class="opc">linseg</span>	p18, p23<span class="op">*</span>p3, p19, p24<span class="op">*</span>p3, p20, p25<span class="op">*</span>p3, p21, p26<span class="op">*</span>p3, p22
amodosc		<span class="opc">oscili</span>	(ilowndx<span class="op">+</span>indxdiff<span class="op">*</span>adevenv)<span class="op">*</span>imodfreq, imodfreq, 10 
acarosc		<span class="opc">oscili</span>	imaxamp<span class="op">*</span>aampenv, icarrfreq<span class="op">+</span>amodosc, 10 
			<span class="opc">out</span>		acarosc 
<span class="comment">;------ we also write down a midi track here ----------</span>
<span class="opc">midion</span> 1, knote, 100
       	<span class="oblock">endin</span> <span class="comment">; 901</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>10 0 4096 10 1				
<span class="stamnt">f</span>100 0 -18 "<span class="stamnt">f</span>arey" 7 1
<span class="stamnt">f</span>101 0 -18 "<span class="stamnt">f</span>arey" 7 2

<span class="comment">; p4 kstart  := index offset into the Farey Sequence</span>
<span class="comment">; p5 kloop   := end index into Farey Seq.</span>
<span class="comment">; p6 timefac := time in seconds for one loop to complete</span>
<span class="comment">; p7 fundam  := fundamental of the FM instrument</span>
<span class="comment">; p8 basenote:= root pitch of the midi voice output</span>
<span class="comment">; note that pitch structures of the midi file output are not equivalent to the</span>
<span class="comment">; ones used for the FM real-time synthesis.</span>

<span class="comment">;	start		dur		kstart	kloop   timefac	fundam. basenote</span>
<span class="stamnt">i</span>1	0.0		44		0 	18	1	6.05	60
<span class="stamnt">i</span>1	4		40		0 	18	3	7.05	72
<span class="stamnt">i</span>1	10		38		0 	18	1.5	8	84
<span class="stamnt">i</span>1	15		50		0	18	1	5	48
<span class="stamnt">i</span>1	22		75		5	17	1.7	4	36	
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp47935704"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="GENfarey.html" title="GENfarey"><em class="citetitle">GEN farey</em></a>,
      <a class="link" href="tablefilter.html" title="tablefilter"><em class="citetitle">tablefilter</em></a>,
      <a class="link" href="tablecopy.html" title="tablecopy"><em class="citetitle">tablecopy</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp47937712"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Georg Boenn </td>
          </tr>
          <tr>
            <td>University of Glamorgan, UK</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 5.13</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="tableseg.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="tablew.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">tableseg </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> tablew</td>
        </tr>
      </table>
    </div>
  </body>
</html>