Issues receiving MIDI notes

Hi hi,
hope you are all gesund!

I am facing an issue for finishing my embedded instrument with Odroid. I can play all examples with Tickle and Pd without issues. However, I have created a script which basically automatizes all operations needed to play the Tickle at startup:

jackd -d alsa -P hw:Device -r 44100 &
sleep 10 
zita-a2j -d hw:tickle -c 1 -r 44100 -j Tickle &
sleep 10
pd -open /home/odroid/Documents/Pd/externals/chair/examples/A01.karplus-strong-pd  &
sleep 10
jack_connect Tickle:capture_1 pure_data:input0 &
sleep 1
aconnect 24:0 128:0 &
sleep 1
aconnect 128:1 24:0 &
sleep 1
echo "ok"
wait

Basically hw:Device is the name of the external usb audiocard, 24:0 is the ID of both MIDI in and out ports for Tickle. Pure data is identified in the 128:0 and 128:1. With this configuration everything works if I run it manually.

The issue that I have is that, after running this script at startup, Pd receives audio and CC messages correctly from Tickle but Pd does not receive any MIDI note from Tickle (from notein). Sometimes only one MIDI note at the beginning and stops receiving any other.

What could be the reason to receive one thing but not the other? Does it remind it to any line of code ;)? Could it be possible that it disconnects from USB MIDI host somehow at startup? But then, how does it send CC messages?

Second questions, shouldn’t Tickle create two MIDI ports with different IDs? I only have 24:0 both for in and out.

Vielen Dank

My guess is that Pd is not launching with the proper MIDI backend. I would launch Pd like this (-alsamidi is the relevant flag):

pd -rt -jack -alsamidi -inchannels 1-outchannels 2 -open /home/odroid/Documents/Pd/externals/chair/examples/A01.karplus-strong-pd

If you have QjackCtl running on the Odroid, you could also leave autoconnection of Jack audio and ALSA MIDI to QjackCtl.

Is there any particular reason why you run Jack with 44100 and not with 48000 Hz? On some systems 48kHz perfoms better than 44.1.

Please be super careful to avoid unplugging the Tickle while zita-a2j is accessing it. zita-a2j unfortunately eats up all the memory until your system becomes unstable.

hi,
I tried with your startup flags and unfortunately it continues making the same, it receives CC but no MIDI notes.

The interesting point is that after the issue happens, if I kill all processes involved, unplug and plug again Tickle, and finally I run the same script everything works ok. Definitely there is some mess in how MIDI connections are managed. I will continue testing and try qjackctl with autoconnect and not aconnect.

BTW my acconnect -l in my laptop but similar in my odroid:

$ aconnect -l
client 0: 'System' [type=kernel]
     0 'Timer           '
     1 'Announce        '
 client 14: 'Midi Through' [type=kernel]
     0 'Midi Through Port-0'
 client 28: 'tickle' [type=kernel,card=3]
     0 'tickle MIDI 1   '
 client 128: 'TiMidity' [type=user,pid=1367]
     0 'TiMidity port 0 '
     1 'TiMidity port 1 '
     2 'TiMidity port 2 '
     3 'TiMidity port 3 '
 client 129: 'Pure Data' [type=user,pid=24165]
     0 'Pure Data Midi-In 1'
     1 'Pure Data Midi-Out 1'

I will keep you posted.

How do you run this script? As a startup script? Where and which user is executing it?
How do you get the numbers for the ALSA MIDI ports?

I hooked up some MIDI devices and can list the inputs

$ aconnect -i
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 36: 'Sensel Morph' [type=kernel,card=5]
    0 'Sensel Morph MIDI 1'
client 40: 'tickle' [type=kernel,card=6]
    0 'tickle MIDI 1   '
client 44: 'nanoKONTROL' [type=kernel,card=7]
    0 'nanoKONTROL MIDI 1'

Likewise the outputs:

$ aconnect -o
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 36: 'Sensel Morph' [type=kernel,card=5]
    0 'Sensel Morph MIDI 1'
client 40: 'tickle' [type=kernel,card=6]
    0 'tickle MIDI 1   '
client 44: 'nanoKONTROL' [type=kernel,card=7]
    0 'nanoKONTROL MIDI 1'

in man aconnect I learn that you can also use the names of the devices instead of the IDs (which might change) like this:

aconnect "tickle:0" "Pure Data:0"
aconnect "Pure Data:1" "tickle:0"

I think this is normal behavior for hardware. While software has ports 0,1,... hardware seems to only have ports 0.
This is how it looks in the QjackCtl Graph:


Terminal:

$ aconnect -l
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
        Connecting To: 128:0
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 36: 'tickle' [type=kernel,card=5]
    0 'tickle MIDI 1   '
        Connecting To: 129:0
        Connected From: 129:1
client 40: 'nanoKONTROL' [type=kernel,card=6]
    0 'nanoKONTROL MIDI 1'
        Connecting To: 129:0
        Connected From: 129:1
client 129: 'Pure Data' [type=user,pid=31562]
    0 'Pure Data Midi-In 1'
        Connected From: 36:0, 40:0
    1 'Pure Data Midi-Out 1'
        Connecting To: 36:0, 40:0

You can see that the Tickle is not behaving differently here than my Korg nano control, I also tried a couple of other MIDI hardware.

I can give Pd more in and outs, the ports will be numbered starting at 0. Port 1 is not necessarily a source if there are more than one sink. The generalization 0=sink, 1=source is not correct.

image

hi,
thanks Max.
At least we can discard these hypothesis.

I think my issue of not receiving MIDI notes (but receiving CCs) when using a startup bash script has to do more with the way Ubuntu Mate (what I run in Odroid) deals with hardware. Or even the version of jack for arch linux. I have tried with other MIDI devices and I get similar issues. But this doesnt happen in my laptop.

I will continue investigating the issue, and even I will try next week with a raspi4.

best wishes,
Enrique

1 Like