<?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" /> <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="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" title="moscil"> <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" title="Description"> <a id="idp32269024"></a> <h2>Description</h2> <p> Sends a stream of the MIDI notes. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp32269672"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>moscil</strong></span> kchn, knum, kvel, kdur, kpause</pre> </div> <div class="refsect1" title="Performance"> <a id="idp32280032"></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" title="Examples"> <a id="idp32322640"></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="idp32323608"></a> <p class="title"> <strong>Example 494. 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> <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 -M0 -Q1<span class="comment">;;;RT audio I/O with MIDI in</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></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> 2 <span class="comment">; Example by Giorgio Zucco 2007</span> <span class="oblock">instr</span> 1 <span class="comment">;Triggered by MIDI notes on channel 1</span> inote <span class="opc">notnum</span> ivel <span class="opc">veloc</span> kpitch <span class="op">=</span> 40 kfreq <span class="op">=</span> 2 kdur <span class="op">=</span> .04 kpause <span class="op">=</span> .1 k1 <span class="opc">lfo</span> kpitch, kfreq,5 <span class="comment">;plays a stream of notes of kdur duration on MIDI channel 1</span> <span class="opc">moscil</span> 1, inote <span class="op">+</span> k1, ivel, kdur, kpause <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Dummy ftable</span> <span class="stamnt">f</span>0 60 <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="idp32326248"></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" title="Credits"> <a id="idp32329664"></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>