<?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>shaker</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" /> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /> <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="sfpreset.html" title="sfpreset" /> <link rel="next" href="shiftin.html" title="shiftin" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">shaker</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="sfpreset.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="shiftin.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="shaker"></a> <div class="titlepage"></div> <a id="IndexShaker" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">shaker</span> </h2> <p>shaker — Sounds like the shaking of a maraca or similar gourd instrument. </p> </div> <div class="refsect1"> <a id="idm281472890233752"></a> <h2>Description</h2> <p> Audio output is a tone related to the shaking of a maraca or similar gourd instrument. The method is a physically inspired model developed from Perry Cook, but re-coded for Csound. </p> </div> <div class="refsect1"> <a id="idm281472890190488"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>shaker</strong></span> kamp, kfreq, kbeans, kdamp, ktimes [, idecay]</pre> </div> <div class="refsect1"> <a id="idm281472890188344"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>idecay</em></span> -- If present indicates for how long at the end of the note the shaker is to be damped. The default value is zero. </p> </div> <div class="refsect1"> <a id="idm281472890186600"></a> <h2>Performance</h2> <p> A note is played on a maraca-like instrument, with the arguments as below. </p> <p> <span class="emphasis"><em>kamp</em></span> -- Amplitude of note. </p> <p> <span class="emphasis"><em>kfreq</em></span> -- Frequency of note played. </p> <p> <span class="emphasis"><em>kbeans</em></span> -- The number of beans in the gourd. A value of 8 seems suitable. </p> <p> <span class="emphasis"><em>kdamp</em></span> -- The damping value of the shaker. Values of 0.98 to 1 seems suitable, with 0.99 a reasonable default. </p> <p> <span class="emphasis"><em>ktimes</em></span> -- Number of times shaken. </p> <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note: Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p> The argument <span class="emphasis"><em>knum</em></span> was redundant, so it was removed in version 3.49. </p> </td> </tr> </table> </div> </div> <div class="refsect1"> <a id="idm281472890179336"></a> <h2>Examples</h2> <p> Here is an example of the shaker opcode. It uses the file <a class="ulink" href="examples/shaker.csd" target="_top"><em class="citetitle">shaker.csd</em></a>. </p> <div class="example"> <a id="idm281472890177480"></a> <p class="title"> <strong>Example 891. Example of the shaker 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> <div class="refsect1"> <a id="idm281472711903416"></a> <pre class="programlisting"> <span class="nt"><CsoundSynthesizer></span> <span class="nt"><CsOptions></span> <span class="c1">; Select audio/midi flags here according to platform</span> <span class="c1">; Audio out Audio in No messages</span> -odac -iadc -d <span class="c1">;;;RT audio I/O</span> <span class="c1">; For Non-realtime ouput leave only the line below:</span> <span class="c1">; -o shaker.wav -W ;;; for file output any platform</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></span> <span class="c1">; Initialize the global variables.</span> <span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> <span class="vg">kr</span> <span class="o">=</span> <span class="mi">4410</span> <span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">10</span> <span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">1</span> <span class="c1">; Instrument #1</span> <span class="kd">instr</span> <span class="nf">1</span> k<span class="n">freq</span> <span class="nb">line</span> <span class="nb">p4</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> <span class="mi">440</span> a<span class="n">1</span> <span class="nb">shaker</span> <span class="mi">10000</span><span class="p">,</span> k<span class="n">freq</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mf">0.999</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">0</span> <span class="nb">out</span> a<span class="n">1</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="nb">i</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">440</span> <span class="nb">i</span> <span class="mi">1</span> <span class="o">+</span> <span class="mi">1</span> <span class="mi">4000</span> <span class="nb">e</span> <span class="nt"></CsScore></span> <span class="nt"></CsoundSynthesizer></span> </pre> </div> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1"> <a id="idm281472890173192"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: John ffitch (after Perry Cook)</td> </tr> <tr> <td>University of Bath, Codemist Ltd.</td> </tr> <tr> <td>Bath, UK</td> </tr> </table> <p> </p> <p>New in Csound version 3.47</p> <p>Fixed the example thanks to a message from Istvan Varga.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="sfpreset.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="shiftin.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">sfpreset </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> shiftin</td> </tr> </table> </div> </body> </html>