<?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>moscil</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="moogvcf2.html" title="moogvcf2" /> <link rel="next" href="mp3in.html" title="mp3in" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">moscil</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="moogvcf2.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="mp3in.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="moscil"></a> <div class="titlepage"></div> <a id="IndexMoscil" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">moscil</span> </h2> <p>moscil — Sends a stream of the MIDI notes. </p> </div> <div class="refsect1"> <a id="idm281472912298104"></a> <h2>Description</h2> <p> Sends a stream of the MIDI notes. </p> </div> <div class="refsect1"> <a id="idm281472912226536"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>moscil</strong></span> kchn, knum, kvel, kdur, kpause</pre> </div> <div class="refsect1"> <a id="idm281472912224472"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>kchn</em></span> -- MIDI channel number (1-16) </p> <p> <span class="emphasis"><em>knum</em></span> -- note number (0-127) </p> <p> <span class="emphasis"><em>kvel</em></span> -- velocity (0-127) </p> <p> <span class="emphasis"><em>kdur</em></span> -- note duration in seconds </p> <p> <span class="emphasis"><em>kpause</em></span> -- pause duration after each noteoff and before new note in seconds </p> <p> <span class="emphasis"><em>moscil</em></span> and <a class="link" href="midion.html" title="midion"><em class="citetitle">midion</em></a> are the most powerful MIDI OUT opcodes. <span class="emphasis"><em>moscil</em></span> (MIDI oscil) plays a stream of notes of <span class="emphasis"><em>kdur</em></span> duration. Channel, pitch, velocity, duration and pause can be controlled at k-rate, allowing very complex algorithmically generated melodic lines. When current instrument is deactivated, the note played by current instance of <span class="emphasis"><em>moscil</em></span> is forcedly truncated. </p> <p> Any number of <span class="emphasis"><em>moscil</em></span> opcodes can appear in the same Csound instrument, allowing a counterpoint-style polyphony within a single instrument. </p> </div> <div class="refsect1"> <a id="idm281472912215080"></a> <h2>Examples</h2> <p> Here is an example of the moscil opcode. It uses the file <a class="ulink" href="examples/moscil.csd" target="_top"><em class="citetitle">moscil.csd</em></a>. </p> <div class="example"> <a id="idm281472912213304"></a> <p class="title"> <strong>Example 579. Example of the moscil 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> <p>This example generates a stream of notes for every note received on the MIDI input. It generates MIDI notes on csound's MIDI output, so be sure to connect something.</p> <div class="refsect1"> <a id="idm281472736283944"></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 -M0 -Q1<span class="c1">;;;RT audio I/O with MIDI in</span> <span class="nt"></CsOptions></span> <span class="nt"><CsInstruments></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">2</span> <span class="c1">; Example by Giorgio Zucco 2007</span> <span class="kd">instr</span> <span class="nf">1</span> <span class="c1">;Triggered by MIDI notes on channel 1</span> i<span class="n">note</span> <span class="nb">notnum</span> i<span class="n">vel</span> <span class="nb">veloc</span> k<span class="n">pitch</span> <span class="o">=</span> <span class="mi">40</span> k<span class="n">freq</span> <span class="o">=</span> <span class="mi">2</span> k<span class="n">dur</span> <span class="o">=</span> <span class="mf">.04</span> k<span class="n">pause</span> <span class="o">=</span> <span class="mf">.1</span> k<span class="n">1</span> <span class="nb">lfo</span> k<span class="n">pitch</span><span class="p">,</span> k<span class="n">freq</span><span class="p">,</span><span class="mi">5</span> <span class="c1">;plays a stream of notes of kdur duration on MIDI channel 1</span> <span class="nb">moscil</span> <span class="mi">1</span><span class="p">,</span> i<span class="n">note</span> <span class="o">+</span> k<span class="n">1</span><span class="p">,</span> i<span class="n">vel</span><span class="p">,</span> k<span class="n">dur</span><span class="p">,</span> k<span class="n">pause</span> <span class="kd">endin</span> <span class="nt"></CsInstruments></span> <span class="nt"><CsScore></span> <span class="c1">; Dummy ftable</span> <span class="nb">f</span><span class="mi">0</span> <span class="mi">60</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="idm281472912208632"></a> <h2>See Also</h2> <p> <a class="link" href="midion.html" title="midion"><em class="citetitle">midion</em></a>, <a class="link" href="midion2.html" title="midion2"><em class="citetitle">midion2</em></a>, <a class="link" href="noteon.html" title="noteon"><em class="citetitle">noteon</em></a>, <a class="link" href="noteoff.html" title="noteoff"><em class="citetitle">noteoff</em></a>, <a class="link" href="noteondur.html" title="noteondur"><em class="citetitle">noteondur</em></a>, <a class="link" href="noteondur2.html" title="noteondur2"><em class="citetitle">noteondur2</em></a> </p> </div> <div class="refsect1"> <a id="idm281472912201784"></a> <h2>Credits</h2> <p> </p> <table border="0" summary="Simple list" class="simplelist"> <tr> <td>Author: Gabriel Maldonado</td> </tr> <tr> <td>Italy</td> </tr> <tr> <td>May 1997</td> </tr> </table> <p> </p> <p>New in Csound version 3.47</p> <p>Thanks goes to Rasmus Ekman for pointing out the correct MIDI channel and controller number ranges.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="moogvcf2.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="mp3in.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">moogvcf2 </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> mp3in</td> </tr> </table> </div> </body> </html>