[CM] midi-msgs
daniel mayer
herbstmondwind@web.de
Mon, 26 Jan 2004 21:54:03 +0100
Many Thanks to Rick Taube and Tobias Kunze,
with version 2.4.1 it is really much easier
to install and launch openmcl/emacs/cm-2.4.1 !
Concerning midi-msgs (OS9/cm-2.4.1) in
writing a process with control-changes:
;---------
(defprocess dim-test-1 (chan dur amp-1 amp-2 steps)
(process with amp-val
with step-time = (/ dur steps 1.0)
for i to steps do
(setf amp-val (round (interpl (now) (list 0 amp-1 dur amp-2))))
(if (= i 0)
(output (new midi
time (now)
channel chan
duration dur
amplitude amp-1))
(output (new midimsg
msg (make-control-change chan 7 amp-val)
time (now))))
(wait step-time)))
; This doesn't perform a diminuendo in 2.4.1 (it works in 2.3.4) :
(events (dim-test-1 0 2 90 0 20) "midi.port")
; With a non-diminishing sound on channel 0
(midi-write-message
(make-program-change 0 73)
(io "midi.port")
0 nil)
(events (dim-test-1 0 2 90 0 20) "midi.port")
; Writing a midi-file and looking at it with
(events (dim-test-1 0 2 90 0 20) "dim-test.midi")
(midi-file-print "dim-test.midi")
; gives (2.4.1)
Format: 0
Tracks: 1
Division: 480
Track 0, length 99
0 #<Tempo Change 1000 ms>
0 #<Note-On 0 60 90>
48 #<Control-Change 0 "Channel-Volume" 86>
48 #<Control-Change 0 "Channel-Volume" 81>
48 #<Control-Change 0 "Channel-Volume" 76>
48 #<Control-Change 0 "Channel-Volume" 72>
48 #<Control-Change 0 "Channel-Volume" 68>
48 #<Control-Change 0 "Channel-Volume" 63>
48 #<Control-Change 0 "Channel-Volume" 58>
48 #<Control-Change 0 "Channel-Volume" 54>
48 #<Control-Change 0 "Channel-Volume" 50>
48 #<Control-Change 0 "Channel-Volume" 45>
48 #<Control-Change 0 "Channel-Volume" 41>
48 #<Control-Change 0 "Channel-Volume" 36>
48 #<Control-Change 0 "Channel-Volume" 32>
48 #<Control-Change 0 "Channel-Volume" 27>
48 #<Control-Change 0 "Channel-Volume" 22>
48 #<Control-Change 0 "Channel-Volume" 18>
48 #<Control-Change 0 "Channel-Volume" 13>
48 #<Control-Change 0 "Channel-Volume" 9>
48 #<Control-Change 0 "Channel-Volume" 4>
48 #<Note-Off 0 60 127>
0 #<Control-Change 0 "Channel-Volume" 0>
; and (2.3.4) :
Format: 0
Tracks: 1
Division: 480
Track 0, length 92
0 #<Note-On 0 60 90>
48 #<Control-Change 0 "Channel Volume" 86>
48 #<Control-Change 0 "Channel Volume" 81>
48 #<Control-Change 0 "Channel Volume" 76>
48 #<Control-Change 0 "Channel Volume" 72>
48 #<Control-Change 0 "Channel Volume" 68>
48 #<Control-Change 0 "Channel Volume" 63>
48 #<Control-Change 0 "Channel Volume" 58>
48 #<Control-Change 0 "Channel Volume" 54>
48 #<Control-Change 0 "Channel Volume" 50>
48 #<Control-Change 0 "Channel Volume" 45>
48 #<Control-Change 0 "Channel Volume" 41>
48 #<Control-Change 0 "Channel Volume" 36>
48 #<Control-Change 0 "Channel Volume" 32>
48 #<Control-Change 0 "Channel Volume" 27>
48 #<Control-Change 0 "Channel Volume" 22>
48 #<Control-Change 0 "Channel Volume" 18>
48 #<Control-Change 0 "Channel Volume" 13>
48 #<Control-Change 0 "Channel Volume" 9>
48 #<Control-Change 0 "Channel Volume" 4>
48 #<Note-Off 0 60 127>
0 #<Control-Change 0 "Channel Volume" 0>
0 #<End of Track #(0)>
; ... but correct direct output
;---------------------------------
; Using 'midi-write-message' directly I got this to run (2.4.1):
(defprocess dim-test-2 (chan dur amp-1 amp-2 steps)
(process with amp-val
with step-time = (/ dur steps)
for i to steps do
(setf amp-val (round (interpl (now) (list 0 amp-1 dur amp-2))))
(if (= i 0)
(output (new midi
time (now)
channel chan
duration dur
amplitude amp-1))
(midi-write-message
(make-control-change chan 7 amp-val)
*out*
(now)
nil))
(wait step-time)))
(events (dim-test-2 0 2 90 0 20) "midi.port")
But for writing it to a midi file the method 'midi-write-message'
expects a different time format.
Besides I couldn't reimport stored midi-msgs with 'import-events' (2.3.4 and 2.4.1).
So how to handle these things?
Thanks for any hint!
Best Regards
Daniel Mayer
______________________________________________________________________________
Erdbeben im Iran: Zehntausende Kinder brauchen Hilfe. UNICEF hilft den
Kindern - helfen Sie mit! https://www.unicef.de/spe/spe_03.php