<?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>gbuzz</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="gausstrig.html" title="gausstrig" /> <link rel="next" href="gendy.html" title="gendy" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">gbuzz</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="gausstrig.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="gendy.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="gbuzz"> <a id="gbuzz"></a> <div class="titlepage"></div> <a id="IndexGbuzz" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">gbuzz</span> </h2> <p>gbuzz — Output is a set of harmonically related cosine partials. </p> </div> <div class="refsect1" title="Description"> <a id="idp25119448"></a> <h2>Description</h2> <p> Output is a set of harmonically related cosine partials. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp25120200"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>gbuzz</strong></span> xamp, xcps, knh, klh, kmul, ifn [, iphs]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp25130616"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ifn</em></span> -- table number of a stored function containing a cosine wave. A large table of at least 8192 points is recommended. </p> <p> <span class="emphasis"><em>iphs</em></span> (optional, default=0) -- initial phase of the fundamental frequency, expressed as a fraction of a cycle (0 to 1). A negative value will cause phase initialization to be skipped. The default value is zero </p> </div> <div class="refsect1" title="Performance"> <a id="idp25132520"></a> <h2>Performance</h2> <p> The buzz units generate an additive set of harmonically related cosine partials of fundamental frequency <span class="emphasis"><em>xcps</em></span>, and whose amplitudes are scaled so their summation peak equals <span class="emphasis"><em>xamp</em></span>. The selection and strength of partials is determined by the following control parameters: </p> <p> <span class="emphasis"><em>knh</em></span> -- total number of harmonics requested. If <span class="emphasis"><em>knh</em></span> is negative, the absolute value is used. If <span class="emphasis"><em>knh</em></span> is zero, a value of 1 is used. </p> <p> <span class="emphasis"><em>klh</em></span> -- lowest harmonic present. Can be positive, zero or negative. In <span class="emphasis"><em>gbuzz</em></span> the set of partials can begin at any partial number and proceeds upwards; if <span class="emphasis"><em>klh</em></span> is negative, all partials below zero will reflect as positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set. </p> <p> <span class="emphasis"><em>kmul</em></span> -- specifies the multiplier in the series of amplitude coefficients. This is a power series: if the <span class="emphasis"><em>klh</em></span>th partial has a strength coefficient of A, the (<span class="emphasis"><em>klh</em></span> + n)th partial will have a coefficient of A * (<span class="emphasis"><em>kmul</em></span> ** n), i.e. strength values trace an exponential curve. <span class="emphasis"><em>kmul</em></span> may be positive, zero or negative, and is not restricted to integers. </p> <p> <a class="link" href="buzz.html" title="buzz"><em class="citetitle">buzz</em></a> and <span class="emphasis"><em>gbuzz </em></span>are useful as complex sound sources in subtractive synthesis. <span class="emphasis"><em>buzz</em></span> is a special case of the more general <span class="emphasis"><em>gbuzz</em></span> in which <span class="emphasis"><em>klh</em></span> = <span class="emphasis"><em>kmul</em></span> = 1; it thus produces a set of <span class="emphasis"><em>knh</em></span> equal-strength harmonic partials, beginning with the fundamental. (This is a band-limited pulse train; if the partials extend to the Nyquist, i.e. <span class="emphasis"><em>knh</em></span> = int (sr / 2 / fundamental freq.), the result is a real pulse train of amplitude <span class="emphasis"><em>xamp</em></span>.) </p> <p> Although both <span class="emphasis"><em>knh</em></span> and <span class="emphasis"><em>klh</em></span> may be varied during performance, their internal values are necessarily integer and may cause <span class="quote">“<span class="quote">pops</span>”</span> due to discontinuities in the output. <span class="emphasis"><em>kmul,</em></span> however, can be varied during performance to good effect. <span class="emphasis"><em>gbuzz</em></span> can be amplitude- and/or frequency-modulated by either control or audio signals. </p> <p> N.B. This unit has its analog in <a class="link" href="GEN11.html" title="GEN11"><em class="citetitle">GEN11</em></a>, in which the same set of cosines can be stored in a function table for sampling by an oscillator. Although computationally more efficient, the stored pulse train has a fixed spectral content, not a time-varying one as above. </p> </div> <div class="refsect1" title="Examples"> <a id="idp25179160"></a> <h2>Examples</h2> <p> Here is an example of the gbuzz opcode. It uses the file <a class="ulink" href="examples/gbuzz.csd" target="_top"><em class="citetitle">gbuzz.csd</em></a>. </p> <div class="example"> <a id="idp25180136"></a> <p class="title"> <strong>Example 320. Example of the gbuzz 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"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> -odac <span class="comment">;;;realtime audio out</span> <span class="comment">;-iadc ;;;uncomment -iadc if realtime audio input is needed too</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o gbuzz.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">ksmps</span> <span class="op">=</span> 32 <span class="ohdr">nchnls</span> <span class="op">=</span> 2 <span class="ohdr">0dbfs</span> <span class="op">=</span>1 <span class="oblock">instr</span> 1 kcps <span class="op">=</span> 220 knh <span class="op">=</span> p4 <span class="comment">;total no. of harmonics</span> klh <span class="op">=</span> p5 <span class="comment">;lowest harmonic</span> kmul <span class="opc">line</span> 0, p3, 1 <span class="comment">;increase amplitude of</span> <span class="comment">;higer partials</span> asig <span class="opc">gbuzz</span> .6, kcps, knh, klh, kmul, 1 <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; a cosine wave</span> <span class="stamnt">f</span> 1 0 16384 11 1 <span class="stamnt">i</span> 1 0 3 3 1 <span class="comment">;3 harmonics, lowest harmonic=1</span> <span class="stamnt">i</span> 1 + 3 30 1 <span class="comment">;30 harmonics, lowest harmonic=1</span> <span class="stamnt">i</span> 1 + 3 3 2 <span class="comment">;3 harmonics, lowest harmonic=3</span> <span class="stamnt">i</span> 1 + 3 30 2 <span class="comment">;30 harmonics, lowest harmonic=3</span> <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1" title="See Also"> <a id="idp25182408"></a> <h2>See Also</h2> <p> <a class="link" href="buzz.html" title="buzz"><em class="citetitle">buzz</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp25183456"></a> <h2>Credits</h2> <p>September 2003. Thanks to Kanata Motohashi for correcting the mentions of the <span class="emphasis"><em>kmul</em></span> parameter.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="gausstrig.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="gendy.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">gausstrig </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> gendy</td> </tr> </table> </div> </body> </html>