<?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>hsboscil</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="hrtfstat.html" title="hrtfstat" /> <link rel="next" href="hvs1.html" title="hvs1" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">hsboscil</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="hrtfstat.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="hvs1.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="hsboscil"> <a id="hsboscil"></a> <div class="titlepage"></div> <a id="Indexhsboscil" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">hsboscil</span> </h2> <p>hsboscil — An oscillator which takes tonality and brightness as arguments. </p> </div> <div class="refsect1" title="Description"> <a id="idp26172520"></a> <h2>Description</h2> <p> An oscillator which takes tonality and brightness as arguments, relative to a base frequency. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp26173344"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>hsboscil</strong></span> kamp, ktone, kbrite, ibasfreq, iwfn, ioctfn \ [, ioctcnt] [, iphs]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp26167080"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ibasfreq</em></span> -- base frequency to which tonality and brighness are relative </p> <p> <span class="emphasis"><em>iwfn</em></span> -- function table of the waveform, usually a sine </p> <p> <span class="emphasis"><em>ioctfn</em></span> -- function table used for weighting the octaves, usually something like: </p> <div class="literallayout"> <p><span class="stamnt">f</span>1 0 1024 -19 1 0.5 270 0.5</p> </div> <p> </p> <p> <span class="emphasis"><em>ioctcnt</em></span> (optional) -- number of octaves used for brightness blending. Must be in the range 2 to 10. Default is 3. </p> <p> <span class="emphasis"><em>iphs</em></span> (optional, default=0) -- initial phase of the oscillator. If <span class="emphasis"><em>iphs</em></span> = -1, initialization is skipped. </p> </div> <div class="refsect1" title="Performance"> <a id="idp26225928"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kamp</em></span> -- amplitude of note </p> <p> <span class="emphasis"><em>ktone</em></span> -- cyclic tonality parameter relative to <span class="emphasis"><em>ibasfreq</em></span> in logarithmic octave, range 0 to 1, values > 1 can be used, and are internally reduced to <span class="emphasis"><em>frac</em></span>(<span class="emphasis"><em>ktone</em></span>). </p> <p> <span class="emphasis"><em>kbrite</em></span> -- brightness parameter relative to <span class="emphasis"><em>ibasfreq</em></span>, achieved by weighting <span class="emphasis"><em>ioctcnt</em></span> octaves. It is scaled in such a way, that a value of 0 corresponds to the orignal value of <span class="emphasis"><em>ibasfreq</em></span>, 1 corresponds to one octave above <span class="emphasis"><em>ibasfreq</em></span>, -2 corresponds to two octaves below <span class="emphasis"><em>ibasfreq</em></span>, etc. <span class="emphasis"><em>kbrite</em></span> may be fractional. </p> <p> <span class="emphasis"><em>hsboscil</em></span> takes tonality and brightness as arguments, relative to a base frequency (<span class="emphasis"><em>ibasfreq</em></span>). Tonality is a cyclic parameter in the logarithmic octave, brightness is realized by mixing multiple weighted octaves. It is useful when tone space is understood in a concept of polar coordinates. </p> <p> Making <span class="emphasis"><em>ktone</em></span> a line, and <span class="emphasis"><em>kbrite</em></span> a constant, produces Risset's glissando. </p> <p> Oscillator table <span class="emphasis"><em>iwfn</em></span> is always read interpolated. Performance time requires about <span class="emphasis"><em>ioctcnt</em></span> * <span class="emphasis"><em>oscili</em></span>. </p> </div> <div class="refsect1" title="Examples"> <a id="idp26232896"></a> <h2>Examples</h2> <p> Here is an example of the hsboscil opcode. It uses the file <a class="ulink" href="examples/hsboscil.csd" target="_top"><em class="citetitle">hsboscil.csd</em></a>. </p> <div class="example"> <a id="idp26233888"></a> <p class="title"> <strong>Example 345. Example of the hsboscil 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 hsboscil.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="comment">; synth waveform</span> giwave <span class="ohdr">ftgen</span> 1, 0, 1024, 10, 1, 1, 1, 1 <span class="comment">; blending window</span> giblend <span class="ohdr">ftgen</span> 2, 0, 1024, <span class="op">-</span>19, 1, 0.5, 270, 0.5 <span class="oblock">instr</span> 1 <span class="comment">; produces Risset's glissando.</span> kamp <span class="op">=</span> .4 kbrite <span class="op">=</span> 0.3 ibasfreq <span class="op">=</span> 200 ioctcnt <span class="op">=</span> 5 <span class="comment">; Change ktone linearly from 0 to 1, </span> <span class="comment">; over the period defined by p3.</span> ktone <span class="opc">line</span> 0, p3, 1 asig <span class="opc">hsboscil</span> kamp, ktone, kbrite, ibasfreq, giwave, giblend, ioctcnt <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 10 <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> <p> Here is an example of the hsboscil opcode in a MIDI instrument. It uses the file <a class="ulink" href="examples/hsboscil_midi.csd" target="_top"><em class="citetitle">hsboscil_midi.csd</em></a>. </p> <div class="example"> <a id="idp26236776"></a> <p class="title"> <strong>Example 346. Example of the hsboscil opcode in a MIDI instrument.</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> <span class="comment">; Audio out </span> -odac -M0 <span class="comment">;;;realtime audio out and realtime MIDI in</span> <span class="comment">;-iadc ;;;uncomment -iadc if realtime audio input is needed too</span> <span class="comment">; -o hsboscil_midi.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="comment">; synth waveform</span> giwave <span class="ohdr">ftgen</span> 1, 0, 1024, 10, 1, 1, 1, 1 <span class="comment">; blending window</span> giblend <span class="ohdr">ftgen</span> 2, 0, 1024, <span class="op">-</span>19, 1, 0.5, 270, 0.5 <span class="oblock">instr</span> 1 ibase <span class="op">=</span> <span class="opc">cpsoct</span>(6) ioctcnt <span class="op">=</span> 5 <span class="comment">; all octaves sound alike.</span> itona <span class="opc">octmidi</span> <span class="comment">; velocity is mapped to brightness</span> ibrite <span class="opc">ampmidi</span> 4 <span class="comment">; Map an exponential envelope for the amplitude.</span> kenv <span class="opc">expon</span> .8, 1, .01 asig <span class="opc">hsboscil</span> kenv, itona, ibrite, ibase, giwave, giblend, ioctcnt <span class="opc">outs</span> asig, asig <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="stamnt">i</span> 1 0 30 <span class="comment">; play for 30 seconds</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="Credits"> <a id="idp26239096"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Peter Neubäcker</td> </tr> <tr> <td>Munich, Germany</td> </tr> <tr> <td>August, 1999</td> </tr> </table> <p> </p> <p>New in Csound version 3.58</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="hrtfstat.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="hvs1.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">hrtfstat </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> hvs1</td> </tr> </table> </div> </body> </html>