[CM] time sig and instrument assignment
taube at uiuc.edu
taube at uiuc.edu
Thu Feb 19 18:11:43 PST 2004
>is there are way to alter, measure by measure, the time signature of a
>midi file being output from (events)?
>
>is there any way to execute a program change on a given channel in the
>same midi file?
Hi, the easiest way is to define functions that make time sigs and program change events and then call them in a score. In this example I use a seq but you could output via a a process just as easily.
? (define (tsig time num1 num2)
(multiple-value-bind (m d)
(make-time-signature num1 num2)
(new midimsg :time time :msg m :data d)))
? (define (pchange time chan ins)
(new midimsg :time time
:msg (make-program-change chan ins)))
? (new seq :name 'test
:subobjects
(list
(tsig 0 4 4)
(pchange 0 0 0)
(new midi :time 0 :duration 4 :keynum 60)
(tsig 4 3 4)
(pchange 4 1 2)
(new midi :time 4 :duration 3 :channel 1)))
#<seq "test">
? (events #&test "test.mid")
"test.mid"
? (midi-file-print "test.mid")
File: test.mid
Format: 0
Tracks: 1
Division: 480
Track 0, length 51
0 #<Tempo Change 1000 ms>
0 #<Time Signature 4/4 (24 clocks, 8 32nds)>
0 #<Program-Change 0 "Acoustic-Grand-Piano">
0 #<Note-On 0 60 64>
1920 #<Note-Off 0 60 127>
0 #<Time Signature 3/4 (24 clocks, 8 32nds)>
0 #<Program-Change 1 "Electric-Grand-Piano">
0 #<Note-On 1 60 64>
1440 #<Note-Off 1 60 127>
"test.mid"
[16]>
More information about the Cmdist
mailing list