I can't get my MIDI controller recognized. Please Help.

Discussion of all things Raspberry Pi / Raspberry Pi 2 related

Moderators: MattKingUSA, khz

Post Reply
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

Hi,

I am grateful for this forum. Seems like there's tons of info here!

I have a new RPi disk image, on RPi3. It has Jack Installed on it. I use Pure Data to make music and I'm on v .49. I make my own midi controllers and I am trying to get midi in and out of Pure Data. Right now Pd does not see my midi controller at all, but Alsa does.

In terminal when I run: amidi -l

I get: IO hw:2,0,0 MIDI/MOCO for LUFA (that's my midi controller) 1

So Alsa does see my controller, the RPi is getting it.

When I run: pd -listdev

I see my midi controller listed as an audio input and output device (it's not audio device, just midi). At the bottom it says:

no midi input devices found
no midi output devices found

I spent several hours trying to figure out Jack. I tried installing Qjackctl but it won't compile (Arrgh so frustrating).

Ultimately I need to run this computer headless, so if I do use Jack I want to set up a shell script and have it configure automaticlly, but really I don't want to use Jack at all if possible.

Is there someplace with command line instructions to control/configure Jack? I haven't been able to find it.

Can I configure ALSA to send my midi data directly to Pure Data?

I am guessing this problem has showed up before. What is the best way to resolve this?

I really just want to make music. Thank you in advance for any help!

Nick
User avatar
flappix
Established Member
Posts: 50
Joined: Thu Jan 19, 2017 10:39 pm
Location: Germany
Been thanked: 16 times

Re: I can't get my MIDI controller recognized. Please Help.

Post by flappix »

You can try different midi drivers. You can specify them with -X option. You can chose between none, raw and seq. Default is none.
I can use my Korg nanokontrol only with the raw driver.

Code: Select all

jackd -d alsa -X raw
My device is than listed as system:capture_midi_1.

Another option would be using a2jmidid which creates Jack midi ports for all ALSA devices.
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

Re: I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

Hi,

Thank you flappix for your reply. Someone on the Pure Data forum introduced me to aconnect, so I was able to use that.

I had to launch Pd first then type in: aconnect 'Your Controller Name':0 'Pure Data':0 in the terminal.

That worked for Pd to receive midi data from my controller, but it didn't work for my controller to get messages from Pd (I have leds on my controller).

After some research I found aconnectgui, which is a gui to make midi connections.
After you install it you can launch it by typing aconnectgui in the terminal.

So I could connect everything that way, but that still won't work for me as I am going to use my Pi headless.

After more googling, I found I can just type the name of the midi client number in aconnect to make my connections. So for me that was:

aconnect 20:0 128:0

this connected my controller (20) to Pd (128)

To get Pd's midi out to my controller I had to do:

aconnect 128:1 20:0

Took a while but I figured it out.

Also, If my controller is plugged in when I turn on the Pi it is client number 20. If I plug it in later it's another number, so to keep it consistent I will always plug it in before i turn on the Pi.

I think I have this figured out for now. THank You.
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

Re: I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

Hey everyone.

So I have a solution, but it's not a great solution. I am able to connect my midi devices using aconnect, but it takes like 30 seconds after Pd has launched to achieve this, and, because of the nature of my setup, I have to quit Pd and restart it for every song, and wait 30 seconds again. And I feel like that's too long.

So I want to figure out JACK. If I could create a JACK midi client and when my Pi boots up I can have Pd set to receive midi from Jack. And I can have my midi controller, at boot up, connect to alsa midi, and alsa midi connect to Jack. And only have to create these connections when I boot up.

So my question is: In the terminal how do I create a midi client in Jack? I've been searching and I can't seem to find it. I typed "jackd" in the terminal and i see all these possible commands, but I don't see how to create a midi client or midi port.

Thanks, Nick
User avatar
flappix
Established Member
Posts: 50
Joined: Thu Jan 19, 2017 10:39 pm
Location: Germany
Been thanked: 16 times

Re: I can't get my MIDI controller recognized. Please Help.

Post by flappix »

Again, first try different midi drivers for jack. If you're lucky the jack midi ports will show up after started starting pd. If not, try ajmidid which creates a jack midi port for every ALSA midi port on your system.

So first connect your midi device, then launch jack

Code: Select all

jack -d alsa -X raw
Then launch pd and see which ports are available (most easy with Qjackctl, otherwise use jack_lsp)

When your ports are not there, try the seq driver. Kill pd and jackd, then again launch jack

Code: Select all

jack -d alsa -X seq
And start pd.

If your ports are still not there use a2jmidid.
Start jack

Code: Select all

jackd -d alsa
Then launch aj2midid

Code: Select all

a2jmidid
and pd.

After that you should see a jack port for each ALSA midi port you have.
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

Re: I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

@flappix thank you for that very detailed reply. I think I followed along. It took a while, but I was able to set everything up with qjack.

So now, I have my midi controller plugged in at startup, I launch qjackctl from the terminal and load my patchbay preset (manually) and hit "activate."

then when I launch pure data everything works! if I close a pure data patch, quit the program and open another patch, everything is still connected, so this is a pretty huge improvement for me.

Now my question (hopefully my last for awhile) Is there a way to load, and activate a qjackctl patchbay preset from command line? or Terminal? I would like this to happen right at bootup and i saw some options to "Execute script on Startup." Is that where the preset should be loaded?

I tried

qjackctl mypatchpreset.xml
qjackctl -a mypatchpreset.xml
qjackctl -s -a mypatchpreset.xml

And in the options of setup, I left "activate Patchbay persistence" checked and pointed towards my preset. That didn't seem to make a difference.

THanks for the help and i feel like I'm at least getting closer somehow.

nick
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

Re: I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

OK, a little more info.

I found this forum post: viewtopic.php?t=14125#p63074

which sort of details my problem/request of trying to load and activate a qjackctl patchbay preset from terminal. I want this to ultimately happen automatically with a shell script.

So in terminal I navigated to the folder of my preset and typed:

qjackctl --active-patchbay=mypresetname.xml

where my patchbay preset name is there instead of "mypresetname." This launches qjackctl, but doesn't seem to load the preset and doesn't activate anything. The only way I can load my preset is to open the patch bay, hit load and navigate to my preset. Then after it's loaded i have to press "activate."

Also, maybe this is part of the problem. When I open qjackctl I get this message:

libEGL warning: DRI2: failed to authenticate

** (qjackctl:4058): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnkown: The name org.a11y.Bus was not provided by any .service files


So maybe I am missing something, perhaps I need some other installation to run qjackctl properly. I don't know. Let me know if anyone has a clue about these things.

thank you. Nick
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

Re: I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

Ok another update.

In Qjackctl in the settings, under Misc I checked a few boxes relating to Enable D-bus.

Now when I run the following line in terminal:

qjackctl --active-patchbay=/home/pi/folder/mypresetname.xml

It does launch qjackctl with my patch loaded and activated. But when I launch Pd I still have to go into Qjack and de-activate the patchbay, then activate it again to work. I even have to do this if I launched Pd first. But at least it is loading my patch. I am also still getting the error message I listed in the previous post.

I am still trying some things out, and trying to find a way to make this all happen automatically in a headless Rpi.

Any suggestions or help is appreciated, I will keep posting if I make some progress.
nicnut
Established Member
Posts: 8
Joined: Fri Oct 19, 2018 2:20 am

Re: I can't get my MIDI controller recognized. Please Help.

Post by nicnut »

Ok, another update.

in Qjackctl, Settings, Options, I selected my patchbay preset file, and clicked "activate Patchbay persistence." In order for that to open I also had to click, in Settings, Misc, "Enable D-Bus interface" and "Enable JACK D-Bus"

And I added Qjackctl as a startup flag in Raspberry Pi startup folder, which is in:

/home/pi/.config/lxsession/?LXDE-pi

Now Qjackctl opens when I startup my computer with the right midi routings, and the patchbay is "activated." However the midi still doesn't work! I have to manually de-activate it, then activate it again for it to work. I tried every combination of starting Pd then Qjack, etc. Nothing worked. I also tried the different midi options in Qjackctl, like raw, none and seq. And in the parameters advnced i tried a lot of different input and output options. Some of those made the audio not work. But none of them fixed the problem.

I have a feeling the D-Bus error message I keep getting is not the problem, as I was able to eliminate it, but it only made it so that even when I activated the patchbay it still didn't work.

I went back to a2jmidid and tried to get that going. I am getting an ERROR with that too:

ERROR: a2j_jack_client_create: Cannont create jack client
ERROR: a2j_start: a2j_new() failed

So I don't know if that will work.

Basically where I am at is I have everything opening up fine, and routed fine, I just have to find a way to deactivate the midi patchbay, then activate it again. I ran: qjackctl --help, and it seems with the options I am given I might not be able to achieve this :(

I am so close to figuring this out, but it sort of seems impossible with the options I am given in qjackctl.

If anyone has ANY insight or ideas I would really really love to hear them, I think I am all out of ideas and options that I can think of.
Baggypants
Established Member
Posts: 188
Joined: Fri Jul 31, 2015 11:28 pm
Has thanked: 14 times
Been thanked: 8 times

Re: I can't get my MIDI controller recognized. Please Help.

Post by Baggypants »

Have you looked in to the Zynthian Project? It's a whole synthesizer platform based on the Raspberry Pi. It looks a bit daunting but it's possible to get it going with pretty minimal resources. http://zynthian.org/
Baggypants
Established Member
Posts: 188
Joined: Fri Jul 31, 2015 11:28 pm
Has thanked: 14 times
Been thanked: 8 times

Re: I can't get my MIDI controller recognized. Please Help.

Post by Baggypants »

Also a2jmidid needs jack running to work, that's why you're getting the ERROR: a2j_jack_client_create: Cannot create jack client.
Shadow_7
Established Member
Posts: 175
Joined: Tue Jun 08, 2010 3:35 pm

Re: I can't get my MIDI controller recognized. Please Help.

Post by Shadow_7 »

qjackctl is a GUI app and needs X, so not headless. There's jack_control to do the routing on the command line, at least for jack1. Although not sure how you know the "names" of things without a gui and qjackctl. I made a youtube video years ago on midi the hardware with a lot of the cli options. Ending with some of the easier gui options. It can be done, even headless. Although it's much easier with a gui, especially if you're going to add pulseaudio into the mix. I use a RPi 3B+ with the 7" touch screen as a pulse over jack sound server. The newer jack2 / jackdbus method is a bit different than my youtube video from long ago.

https://www.youtube.com/watch?v=68dNginMNKY
User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: I can't get my MIDI controller recognized. Please Help.

Post by khz »

The man pages is your friend.

Code: Select all

man jackd
For Jack1/Jack2: https://linux.die.net/man/1/jackd

Code: Select all

 ~ $ jack
jack_alias                  jack_midiseq
jack_bufsize                jack_midisine
jack_capture                jack_monitor_client
jack_capture_gui2           jack_multiple_metro
jack_connect                jack_net_master
jack_control                jack_net_slave
jack_cpu                    jack_netsource
jack_cpu_load               jack_rec
jackdbus                    jack_samplerate
jack_disconnect             jack_server_control
jack-dssi-host              jack_session_notify
jack_evmon                  jack_showtime
jack_freewheel              jack_simdtests
jack_iodelay                jack_simple_client
jack-keyboard               jack_simple_session_client
jack_latent_client          jack_test
jack_load                   jack_thru
jack_lsp                    jack_transport
jack_metro                  jack_unload
jack_midi_dump              jack_wait
jack_midi_latency_test      jack_zombie
When jack runs start a2j or a2jmidid.
. . . FZ - Does humor belongs in Music?
. . GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
  • I don't care about the freedom of speech because I have nothing to say.
Shadow_7
Established Member
Posts: 175
Joined: Tue Jun 08, 2010 3:35 pm

Re: I can't get my MIDI controller recognized. Please Help.

Post by Shadow_7 »

jack_connect, not jack_control for my previous. Although mostly aconnect in the video. The jack_control is more of the jackdbus method to stop / start / exit. And the various other bits normally done on a single command with jack1, like select which card, rate, bits, channels, and whatnot.
Post Reply