いらないモノ、ひつようなモノ

書籍、音楽、そして若干のテクノロジー

csoundでのMIDIの実験

きっとmidiremot等MIDIイベントをネットワーク越しに渡すとか、いろいろやりだすときりがないかもしれないのでちまちまといきます。

test1: MIDI楽器用opcdeをscoreから利用すると、、

MIDI駆動される楽器とScore駆動される楽器で使えるopcodesが違いということなんで、実際に何が起こるか確認してみる。


;; testmidi1.csd

 -d -B16384 -b4096 -m231 ; -+rtmidi=virtual -M0 


sr=44100
kr=44100
nchnls = 2
instr  1
  iMIDInote   notnum
  iMIDIfreq   cpsmidi   ; pitchBend does not affect the value
  iMIDIfreqb  cpsmidib  ; pitchBend affects the value
  iMIDIpitch  pchmidi   ; pitchBend does not affect the value
  iMIDIpitchb pchmidib  ; pitchBend affects the value
  iMIDIoct    octmidi   ; pitchBend does not affect the value
  iMIDIoct    octmidib  ; pitchBend affects the value
  iMIDIvel    veloc
  iMIDIamp    ampmidi 2000
  iMIDIbend   pchbend
  kMIDIaft    aftouch 

   print iMIDIfreq
   print iMIDIfreqb
   print iMIDIpitch
   print iMIDIpitchb
   print iMIDIoct
   print iMIDInote
   print iMIDIamp
   print iMIDIvel
   print iMIDIbend
   ;print kMIDIaft
endin


f0 3600
i1 1  10
i1 10 10
i1 20 20


このCSDを実行すると、compile「直後に」以下の出力を得る

[a9a9@localhost]$ csound miditest1.csd
(中略)

SECTION 1:
B  0.000 ..  1.000 T  1.000 TT  1.000 M:      0        0  
new alloc for instr 1:
instr 1:  iMIDIfreq = 8.176
instr 1:  iMIDIfreqb = 8.176
instr 1:  iMIDIpitch = 3.000
instr 1:  iMIDIpitchb = 3.000
instr 1:  iMIDIoct = 3.000
instr 1:  iMIDInote = 0.000
instr 1:  iMIDIamp = 0.000
instr 1:  iMIDIvel = 0.000
instr 1:  iMIDIbend = -1.000
B  1.000 .. 10.000 T 10.000 TT 10.000 M:      0        0  
new alloc for instr 1:
instr 1:  iMIDIfreq = 8.176
instr 1:  iMIDIfreqb = 8.176
instr 1:  iMIDIpitch = 3.000
instr 1:  iMIDIpitchb = 3.000
instr 1:  iMIDIoct = 3.000
instr 1:  iMIDInote = 0.000
instr 1:  iMIDIamp = 0.000
instr 1:  iMIDIvel = 0.000
instr 1:  iMIDIbend = -1.000
B 10.000 .. 20.000 T 20.000 TT 20.000 M:      0        0  
instr 1:  iMIDIfreq = 8.176
instr 1:  iMIDIfreqb = 8.176
instr 1:  iMIDIpitch = 3.000
instr 1:  iMIDIpitchb = 3.000
instr 1:  iMIDIoct = 3.000
instr 1:  iMIDInote = 0.000
instr 1:  iMIDIamp = 0.000
instr 1:  iMIDIvel = 0.000
instr 1:  iMIDIbend = -1.000
  • クラッシュしなかった*1
  • しかしp2で指定したタイミングでの実施ではなかった
  • 楽器名を4に変更し、スコアを変更して実験しても結果は同じだった。
  • オプションの「; -+rtmidi=virtual -M0 」のコメントを取って生かすと普通にキーボード入力の確認ができた。

*1:だからって何の意味もないが