moscil

moscil — Sends a stream of the MIDI notes.

Description

Sends a stream of the MIDI notes.

Syntax

moscil kchn, knum, kvel, kdur, kpause

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.

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.

Example 634. Example of the moscil opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

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.

<CsoundSynthesizer> 
<CsOptions> 
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d         -M0  -Q1;;;RT audio I/O with MIDI in
</CsOptions>
<CsInstruments>

sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

; Example by Giorgio Zucco 2007


instr 1  ;Triggered by MIDI notes on channel 1

  inote notnum
  ivel 	veloc

  kpitch = 40
  kfreq  = 2

  kdur   =  .04
  kpause =  .1

  k1 	lfo 	kpitch, kfreq,5

  ;plays a stream of notes of kdur duration on MIDI channel 1
  moscil  1, inote + k1, ivel,   kdur, kpause

endin

</CsInstruments>
<CsScore>
; Dummy ftable
f0 60
</CsScore>
</CsoundSynthesizer>


See Also

midion, midion2, noteon, noteoff, noteondur, noteondur2

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.