defmulti {name} ({slot value}*) {form}* [Macro]

Creates a thread of MIDI channel program specifications. name is the name for the multi. Following name comes zero or more slot value initializations suitable for threads. Following this list comes any number of channel sound specifications. Each specificiation defines the set of program-change and/or bank select messages that will establish a particular sound source on a specified channel in the synthesizers.

Since odern MIDI synthesizers typically provide multiple banks of sound sources, it my be necessary to send more than one program change to select a sound on a channel, or possibly even a combination "Bank Select" messages and program changes. (A Bank Select message is really just a control change value associated with Controller 0 or Controller 32.) defmulti supports five different formats for channel sound specifications:

1. Program Change value
2. Program Change valueProgram Change value
3. Controller 0 valueProgram Change value
4. Controller 32 valueProgram Change value
5. Controller 0 valueController 32 valueProgram Change value
Each in the body of defmulti consists of a number of channel sound specifications. Each specification is a list in the format:

(channel [{type}* {value}]*)

channel is the MIDI channel (0 based) for the selection. type is an optional message type specifier. Possible type specifiers are:
program-change, program, patch, instrument, voice
Specifies that the following value(s) are to be sent as program changes. This is the default.
bank-select0, bank0
Specifies that the next value(s) are to be sent as a controller 0 value.
bank-select32, bank32
Specifies that the next value(s) are to be sent as controller 32 value.

Message types are "sticky" and default to program changes.

Example:

;;;
;;; select program change 67 on channel 0, 23 on 1 and 22 on 2
;;;

(defmulti trio ()
  (0 67)
  (1 23)
  (2 22))

;;;
;;; select bank 8, program 11 on channel 10 and 
;;; changes 21 and 2 on channel 0

(defmulti duet ()
  (10 bank0 8 voice 11)
  (0  21  2)
  )

;;;
;;; sending to a midi file:
;;;

(defmulti trio () (0 67) (1 23) (2 22))

(algorithm foo midi-note (length 3 rhythm .1 amplitude .25)
  (setf note (between 30 90))
  (setf channel (random 3)))

Stella [Top-Level]: open hd:test.midi multi trio play nil

Stella [Top-Level]: mix foo 0

Stella [Top-Level]: (midifile-print "Hd:test.midi")

File: test.midi 
Format: 0
Tracks: 1
Division: 96

Track 0, length 52
 0 #<Tempo-Change 500000>
 0 #<Time-Signature: 4/4 24 8>
 0 #<Program-Change: 0 67>
 0 #<Program-Change: 1 23>
 0 #<Program-Change: 6 22>
 0 #<Note-On: 2 68 31>
19 #<Note-Off: 2 68 127>
 0 #<Note-On: 2 86 31>
19 #<Note-Off: 2 86 127>
 0 #<Note-On: 0 30 31>
19 #<Note-Off: 0 30 127>

Stella [Top-Level]: 

See Also:

open [Command]


Last Modified: 5-Mar-1998