<?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>mpulse</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="mp3len.html" title="mp3len" /> <link rel="next" href="mrtmsg.html" title="mrtmsg" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">mpulse</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="mp3len.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="mrtmsg.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="mpulse"> <a id="mpulse"></a> <div class="titlepage"></div> <a id="IndexMpulse" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">mpulse</span> </h2> <p>mpulse — Generates a set of impulses. </p> </div> <div class="refsect1" title="Description"> <a id="idp32375368"></a> <h2>Description</h2> <p> Generates a set of impulses of amplitude <span class="emphasis"><em>kamp</em></span> separated by <span class="emphasis"><em>kintvl</em></span> seconds (or samples if <span class="emphasis"><em>kintvl</em></span> is negative). The first impulse is generated after a delay of <span class="emphasis"><em>ioffset</em></span> seconds. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp32416824"></a> <h2>Syntax</h2> <pre class="synopsis">ares <span class="command"><strong>mpulse</strong></span> kamp, kintvl [, ioffset]</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp32417968"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ioffset</em></span> (optional, default=0) -- the delay before the first impulse. If it is negative, the value is taken as the number of samples, otherwise it is in seconds. Default is zero. </p> </div> <div class="refsect1" title="Performance"> <a id="idp32419152"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kamp</em></span> -- amplitude of the impulses generated </p> <p> <span class="emphasis"><em>kintvl</em></span> -- Interval of time in seconds (or samples if <span class="emphasis"><em>kintvl</em></span> is negative) to the next pulse. </p> <p> After the initial delay, an impulse of <span class="emphasis"><em>kamp</em></span> amplitude is generated as a single sample. Immediately after generating the impulse, the time of the next one is determined from the value of <span class="emphasis"><em>kintvl</em></span> at that precise moment. This means that any changes in <span class="emphasis"><em>kintvl</em></span> between impulses are discarded. If <span class="emphasis"><em>kintvl</em></span> is zero, there is an infinite wait to the next impulse. If <span class="emphasis"><em>kintvl</em></span> is negative, the interval is counted in number of samples rather than seconds. </p> <p> </p> </div> <div class="refsect1" title="Examples"> <a id="idp32422832"></a> <h2>Examples</h2> <p> Here is an example of the mpulse opcode. It uses the file <a class="ulink" href="examples/mpulse.csd" target="_top"><em class="citetitle">mpulse.csd</em></a>. </p> <div class="example"> <a id="idp32423808"></a> <p class="title"> <strong>Example 497. Example of the mpulse 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> <span class="comment">; Audio out Audio in No messages</span> -odac -iadc -d <span class="comment">;;;RT audio I/O</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o mpulse.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="comment">; Initialize the global variables.</span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">kr</span> <span class="op">=</span> 4410 <span class="ohdr">ksmps</span> <span class="op">=</span> 10 <span class="ohdr">nchnls</span> <span class="op">=</span> 1 gkfreq <span class="opc">init</span> 0.1 <span class="oblock">instr</span> 1 kamp <span class="op">=</span> 10000 a1 <span class="opc">mpulse</span> kamp, gkfreq <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="oblock">instr</span> 2 <span class="comment">; Assign the value of p4 to gkfreq</span> gkfreq <span class="opc">init</span> p4 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Play Instrument #1 for one second.</span> <span class="stamnt">i</span> 1 0 11 <span class="stamnt">i</span> 2 2 1 0.05 <span class="stamnt">i</span> 2 4 1 0.01 <span class="stamnt">i</span> 2 6 1 0.005 <span class="comment">; only last notes are audible</span> <span class="stamnt">i</span> 2 8 1 0.003 <span class="stamnt">i</span> 2 10 1 0.002 <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="idp32426080"></a> <h2>See Also</h2> <p> Another example of how to use mpulse can be found here: <a class="link" href="mode.html" title="mode"><em class="citetitle">mode</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp32427232"></a> <h2>Credits</h2> <p>Written by John ffitch.</p> <p>New in version 4.08</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="mp3len.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="mrtmsg.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">mp3len </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> mrtmsg</td> </tr> </table> </div> </body> </html>