Launchpad Mini MK2 MIDI Out

Hi there :wave: ,

I’m having issues with getting MIDI Out for my Launchpad Mini MK2 to work. I’m using Linux, and the buttons don’t light up like I would expect them to.

I can get it to work using amidi from the alsa utils package:

# illuminates the button at x=0, y=0 in green
amidi -p hw:1,0,0 --send-hex='90003C'

I can not get it to work using supercollider:

MIDIClient.init;

~launchpadDest = MIDIClient.destinations.select({|d| d.name.contains("Launchpad Mini")})[0]
~launchpadOut = MIDIOut.newByName(~launchpadDest.device, ~launchpadDest.name)

~launchpadOut.noteOn(0x90, 0, 0x3c)

Any ideas what is wrong? I tried to use the official documentation to figure out which midi signals to send.

First argument is channel, which must be between 0 and 15.

0x90 is the full status byte for note on on channel 0 (SC MIDI channel 0, other devices channel 1). MIDIOut will generate the status byte for you – you should not write it by yourself. Only provide the channel number 0 here.

Note number 0 and velocity 0x3C should be ok.

hjh

I think it must be something else still. Trying 0 still shows no response (and I should mention no error on the side of SC). Neither does any other channel.

(
(0..15).do({|chan|
	~launchpadOut.noteOn(chan, 0x00, 0x00 /* or 0x3c for green */)
	//~launchpadOut.control(chan, 0, 0)
})
)

The second message tries to send a cc message to reset the launchpad (described on page 7 of the manual I linked). This doesn’t work either.

I don’t know what might be wrong, but perhaps you could try with one of the existing launchpad quarks:

There’s also a LaunchpadOut class in this repository:

1 Like

It may be the case that newByName isn’t reaching the device at all…?

MIDIOut a bit bizarre in Linux. newByName attaches a device UID to the MIDIOut object, so that messages should go directly to that device. If this goes wrong, then it can be difficult to diagnose because there’s no visible connection anywhere else in the system.

As an alternate test, you might 1/ not call newByName and 2/ use .connect (or make the connection manually using qjackctl or qpwgraph). See the MIDIOut help file for details.

In short, there are two possible causes for the failure:

1/ There is something wrong with the message. The quarks suggested in the prior message might help with this.

2/ Or, there is something wrong with the connection and no messages are getting through. In that case, no amount of mucking about with message formats will help. This cause has not been ruled out yet (which is why it’s important to try a different connection strategy).

hjh

1 Like

Thanks, that was super helpful! I managed to do it like this:

MIDIClient.init;
~o = MIDIOut.new(1).connect()
~o.noteOn(0x00, 0x00, 0x3c)
// to turn the led off: ~o.noteOn(0x00, 0x00, 0x00)

MIDIClient.destinations looks like this:

-> [ MIDIEndPoint("Midi Through", "Midi Through Port-0", 917504), MIDIEndPoint("Launchpad Mini", "Launchpad Mini MIDI 1", 1310720), MIDIEndPoint("SuperCollider", "in0", 8388608), MIDIEndPoint("SuperCollider", "in1", 8388609), MIDIEndPoint("SuperCollider", "in2", 8388610), MIDIEndPoint("SuperCollider", "in3", 8388611), MIDIEndPoint("SuperCollider", "in4", 8388612), MIDIEndPoint("SuperCollider", "in5", 8388613), MIDIEndPoint("SuperCollider", "in6", 8388614), MIDIEndPoint("SuperCollider", "in7", 8388615), MIDIEnd...etc...

I took the 1 after reading the docs on arguments here: MIDIOut | SuperCollider 3.12.2 Help But I think I’m not sure, because multiple endpoints end with a 1? Anyways, happy that it works. :slight_smile:

Glad to hear you got a better result this way – though I think this is probably not doing exactly what you think it is.

In Linux, there are two ways to connect – I wrote the section about this in the help file, AFAIK it’s complete. For Linux, the .new documentation is pretty much not useful by itself. More important is MIDIOut | SuperCollider 3.12.2 Help – if you haven’t read this carefully, then it’s pretty likely to have some misunderstanding.

.new(1) does not refer to destinations at all. It’s an “out” port which is found in sources.

Then the argument to .connect is the index into destinations – this is the really important argument, but it’s omitted in your example.

So it looks as though you’re connecting “SuperCollider-out1” to “Midi Through Port-0” – why the messages are reaching the device, I couldn’t tell you. (Also, why .newByName failed in your case, I’m not sure.)

hjh

1 Like

To clarify: Is newByName supposed to establish a connection? I can use newByName if I use it like this:

~launchpad = MIDIClient.destinations.detect({|d| d.name.contains("Launchpad Mini")})
~idx = MIDIClient.destinations.detectIndex({|d| d.name.contains("Launchpad Mini")})

~out = MIDIOut.newByName(~launchpad.device, ~launchpad.name)
~out.connect(~idx) // ← needs to be called explicitly

I have opened a bug report on Github, but maybe this isn’t a bug? `MIDIOut.newByName` does not reach device · Issue #6619 · supercollider/supercollider · GitHub