Schau, guck mal, das is'n Programm, das erkennt note-on / note off
und macht MIDI-Through (+running status)
Vielleicht kannst du dir was abspicken
Code:$regfile = "m32def.dat" $crystal = 8000000 $baud = 31250 ' MIDI $hwstack = 64 $swstack = 256 $framesize = 64 Const Led_hold_ms = 255 ' LED hold time (255 mS) Const Rx_bufsize = 32 Const Tx_bufsize = 32 Config Serialin = Buffered , Size = Rx_bufsize Config Serialout = Buffered , Size = Tx_bufsize '------------------------------------------------- Dim Rxskip As Byte Dim Rxcntr As Byte Dim Rxchar As Byte ' Zeichen von MIDI Dim Note As Byte ' Note 0-127 Dim Veloc As Byte ' velocity 0-127 Dim Event As Byte ' MIDI EVENT '------------------------------------------------- Dim Channel As Byte '------------------------------------------------- Dim Ledhold As Byte '------------------------------------------------- Dim Tmp As Byte Enable Interrupts channel = 1 '--------------------------------------------- ' '--------------------------------------------- Do Gosub Rxdata ' Check MIDI Input If Event = 1 Then ' Midi-Event NOTE / VELOC Event = 0 '------------------ ' event-abarbeiten ' note 0-127 ' veloc 0-127 (0=note off) '------------------ End If Loop End '---------------------------------------- ' '---------------------------------------- Rxdata: While Ischarwaiting() = 1 ' Is was da ? Rxchar = Inkey() ' ja, holen '------------------------------------------------------------------ Print Chr(rxchar); ' MIDI Through '------------------------------------------------------------------ If Rxchar >= 128 Then 'start midisequ. Tmp = Rxchar And &H0F ' channel-nr only If Tmp <> Channel Then 'für OMNI mode auskommentieren Rxskip = 1 Else Rxskip = 0 Tmp = Rxchar And &HF0 ' event Select Case Tmp Case &H80 : Rxcntr = 1 ' note off Case &H90 : Rxcntr = 1 ' note on Case Else : Rxskip = 1 'alles andere is uns egal End Select End If Else If Rxskip = 0 Then If Rxcntr = 1 Then Note = Rxchar Rxcntr = 0 Else Veloc = Rxchar If Veloc <> 0 Then Event = 1 ' signal MIDI EVENT End If Rxcntr = 0 End If End If End If Wend Return
Lesezeichen