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

Discussion of all things Raspberry Pi / Raspberry Pi 2 related

Moderators: khz, MattKingUSA

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

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

Postby nicnut » Fri Oct 19, 2018 3:00 am

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: 27
Joined: Thu Jan 19, 2017 10:39 pm
Location: Germany

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

Postby flappix » Fri Oct 19, 2018 6:14 pm

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.

Postby nicnut » Sat Oct 20, 2018 4:58 am

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.

Postby nicnut » Mon Oct 22, 2018 2:15 pm

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: 27
Joined: Thu Jan 19, 2017 10:39 pm
Location: Germany

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

Postby flappix » Tue Oct 23, 2018 10:36 am

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.

Postby nicnut » Tue Oct 23, 2018 11:30 pm

@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.

Postby nicnut » Wed Oct 24, 2018 5:36 pm

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.

Postby nicnut » Wed Oct 24, 2018 7:01 pm

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.

Postby nicnut » Wed Oct 24, 2018 10:34 pm

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.


Return to “Raspberry Pi”

Who is online

Users browsing this forum: No registered users and 1 guest