Okay, I wrote the following python script as mymid.py :
"
import mido
import time
def mcatch(msg):
print (msg)
inp = mido.open_input('Q25 MIDI 1', callback=mcatch)
while(True):
time.sleep(100)
"
and copied it to /usr/lib/python2.7
-----------
This now works:
julia> using PyCall
julia> @pyimport mymid
note_on channel=0 note=59 velocity=87 time=0
note_off channel=0 note=59 velocity=64 time=0
...
On Sat, Nov 28, 2015 at 10:35 PM, Forrest Curo <[email protected]>
wrote:
> I get the following:
> "
> julia> using PyCall
>
> julia> @pyimport mido
>
> julia> inp = mido.open_input("Q25 MIDI 1")
> PyObject <open input 'Q25 MIDI 1' (PortMidi/ALSA)>
>
> julia> for msg in inp
> print(msg)
> end
> PyObject <message note_on channel=0 note=59 velocity=91 time=0>
> -------------
> What follows this last prompt: The for loop is quoting a python program
> which prints out midi messages as received...
>
> Whatever Julia is doing with this... leads to printing out the previous
> midi message. That is, the last line here appears when I lift my finger off
> the key. (The note-off will appear when I play the next note.)
>
> Why isn't this working? -- and what function might work better to get
> inp's current value, not the next-to-last?
>