return to first page linux journal archive
keywordscontents

Listing 2. MIDI Output Opcodes--orc File

; MIDI OUT opcodes
; mussle.orc
 sr = 44100 ; also experiment with other sr and 
            ; kr rates
 kr = 44100
 ksmps = 1
 nchnls = 1

; This instrument shows how the moscil opcode<\n> 
; can be used for a sort of
; "indeterminancy" aspect in composition. knum<\n> 
; and kvel control the output
; of MIDI notes and their velocities over p3<\n> 
; (note-stream duration as specified
; in the score). kran output is used for kdur<\n> 
; (actual duration) and kpause
; (pause between notes).
;
; The moscil (MIDI oscillator) opcode permits<\n> 
; control of MIDI channel, note-number, 
; velocity, duration, and time between notes.

 instr 1
kchan = 0
knum linseg 40,p3/7,60,p3/7,46,p3/7,54,p3/7,24,p3/7,58,p3/7,48,p3/7,80
kvel linseg 20,p3/2,39,p3/2,33
kran pcauchy 23
kdur = int(kran)+.46
kpause = frac(kran)
 moscil kchan, knum, kvel, kdur, kpause
 endin

; The next two instruments control Program<\n> 
; Change messages sent to my external synth<\n> 
; and my MIDI-controlled mixer.

 instr 11
kchan = 0
kprog = 2.
kmin = 1.
kmax = 128.
 koutpc kchan, kprog, kmin, kmax
 endin

 instr 100
kchan = 8
kprog = 6.
kmin = 1.
kmax = 128.
 koutpc kchan, kprog, kmin, kmax
 endin