Shop OBEX P1 Docs P2 Docs Learn Events
MIDI Input with Propeller? — Parallax Forums

MIDI Input with Propeller?

65816581 Posts: 132
edited 2010-10-08 09:06 in Propeller 1
Hi,

I found the OBJ for Midi Input at the Parallax Obex but have no
clue how to use it to handle NoteOn, NoteOff, etc.

I'd like to use NoteOn, NoteOff, Pitchbend etc. to control
things like the Stereo Spatializer, Vocal tract etc.

Any help very appreciated!

Comments

  • mparkmpark Posts: 1,305
    edited 2010-09-29 09:23
    Search the forum for my "sick day synthesizer" thread. It's a very simple polyphonic and velocity-sensitive synth controlled by MIDI. It only handles NoteOns and NoteOffs but it should give you a start.
  • 65816581 Posts: 132
    edited 2010-10-08 00:33
    mpark wrote: »
    Search the forum for my "sick day synthesizer" thread. It's a very simple polyphonic and velocity-sensitive synth controlled by MIDI. It only handles NoteOns and NoteOffs but it should give you a start.

    Okay, thanks!
    It works. I can handle the MidiOn, MidiOff and Pitchbend events. But
    the Controller Change doesn't seem to work.

    The Code looks something like:
    CON
        _clkmode = xtal1 + pll16x
    
    OBJ
        [other OBJs]
        MIDI: "FullDuplexSerial"
    
    PUB main | b, runningStatus ch1note, ch2note, ch3note, ch0bend, ch0bendval, ccnum, ccval, ch0vel, ch1vel, ch2vel
        MIDI.start(5,4,%0000,31250)
        
        repeat
            ch1note := -1
            ch2note := -1
            ch3note := -1
    
            if(b := MIDI.rxcheck) <> -1
                if b & $80
                    runningStatus := b
                    b := MIDI.rx
    
                if(runningStatus) == $B0    ' CC handling (broken?)
                    ccnum := MIDI.rx
                    ccval := MIDI.rx
                    ' For some reason we must receive a 3rd dummy byte
                    MIDI.rx
                if(runningStatus) == $90    ' Note on event on Midi Channel 1
                    ch1note := b
                    ch1vel := MIDI.rx
                    if ch1vel == 0
                        ch1note := -1
                if(runningStatus) == $91    ' Note on event on Midi Channel 2
                    ch2note := b
                    ch2vel := MIDI.rx
                    if ch1vel == 0
                        ch2note := -1
                if(runningStatus) == $92    ' Note on event on Midi Channel 3
                    ch3note := b
                    ch3vel := MIDI.rx
                    if ch3vel == 0
                        ch3note := -1
                if(runningStatus) == $E0    ' Pitch bend event on Midi Channel 1
                    ch0bend := midi.rx
    
            if ch0note <> -1
                (do some note on event on ch0)
            else
                (do some note off event on ch0)
    
            (do this for every channel)
    
    

    So Midi NoteOn+NoteOff+PitchBend for channel 1, 2 and 3 works properly,
    but the propeller hangs if it receives a controller change message, if not
    receiving the dummy byte. Any suggestion?

    Im using this as a reference: http://museinfo.sapp.org/doc/formats/midi/

    Thanks
  • AribaAriba Posts: 2,690
    edited 2010-10-08 09:06
    You have received the first data byte (the controller number) already. So the code for CC should look like that:
    if(runningStatus) == $B0    ' CC handling (broken?)
                    ccnum := b
                    ccval := MIDI.rx
    

    Andy
Sign In or Register to comment.