moscil
Sends a stream of the MIDI notes.
Syntax
Initialization
iport -- MIDI output port, optional set to 0.
Performance
kchn -- MIDI channel number (1-16)
knum -- note number (0-127)
kvel -- velocity (0-127)
kdur -- note duration in seconds
kpause -- pause duration after each noteoff and before new note in seconds
moscil and midion are the most powerful MIDI OUT opcodes. moscil (MIDI oscil) plays a stream of notes of kdur 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 moscil is forcedly truncated, also when the instrument ends without a release, for instance through turnoff2 with krelease 0, or the performance stops. A noteoff always goes to the port of its noteon.
When a note is tied onto a held note, or at a reinit pass, the note still sounding is turned off and the stream of notes starts again.
Csound 7.0.0 and earlier played the first note for one control cycle with no pause after it, and left a note sounding at a tie, a reinit, or when its instrument ended without a release.
Any number of moscil opcodes can appear in the same Csound instrument, allowing a counterpoint-style polyphony within a single instrument.
Examples
Here is an example of the moscil opcode. It uses the file moscil.csd.
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.
See also
Credits
Author: Gabriel Maldonado
Italy
May 1997
New in Csound version 3.47
Thanks goes to Rasmus Ekman for pointing out the correct MIDI channel and controller number ranges.