Control a 1440ehx looper through MIDI messages

Hello there!

So this is my crazy idea: To control a 1440 ehx looper through MIDI messages running GUI-less super collider. And to program it in such way, that is must automatize its behavior.
I did set up GUI-less super collider on my pi following these instructions:
(supercollider/README_RASPBERRY_PI.md at develop · supercollider/supercollider · GitHub)
Everything’s fine so far.
But I encountered a funny issue sending messages from the Pi.
Whenever I send a MIDI message to my pedal, SC says that its delivered altought the pedal doesn’t receive anything. I’m not sure how to debug it, as there is no error in SC.

This is my SC code:

MIDIClient.init;

m = MIDIOut.new(1); //connect to pisound MIDI
//pedal must be in MD.OM mode

m.control(0, 3, 21); //play
m.control(0, 3, 22); //stop
m.control(0, 3, 24); //reverse
m.control(0, 27, 127/2); //set tempo to half speed

btw: The code runs properly on my laptop but not on my Raspi :thinking:
And I’m not using patchbox OS since it was easier for me to do it with Raspbian Lite.

Please let me know if I am making something incredibly stupid, because I’m stuck.

So the MIDI messages are supposed to go out the Pisound’s MIDI OUT port? If so, just for testing, you could loopback a MIDI cable back to the Pisound’s input and run this command:

amidi -p hw:1,0 -d

to see the incoming messages. It might be hw:2,0 that you have to use. See amidi -l output to find out the card and port numberings. :slight_smile:

Hey Giedrius, thank you for answering.
I solved it but in a very cheesy way.

My SC code was wrong, SC MIDI messages in Linux have another syntax:

m = MIDIOut(0); // use virtual source port “out0”
m.connect(1); // connect to MIDIClient.destinations[1]

Instead of

m = MIDIOut.new(1); //connect to pisound MIDI

See (MIDIOut | SuperCollider 3.11.2 Help) for a detailed explanation.
But anyway, Idk why I still can’t send messages through the MIDI OUT port of the Pisound. I had to implement an USB interface and it looks ugly. Any suggestion or trial?

BTW: Whenever I try the ouroboros you mentioned :

amidi -p hw:1,0 -d

I get this error:

ALSA lib rawmidi_hw.c:235:(snd_rawmidi_hw_open) open /dev/snd/midiC1D0 failed: No such file or directory
cannot open port “hw:1,0”: No such file or directory

I have almost no experience with linux shell, so that could be it.

What output do you get from these commands after you make your script send commands through Pisound:

amidi -l
aconnect -lio

Try:

amidi -p hw:2,0 -d

alejo@raspberrypi:~ $ amidi -l
Dir Device Name
IO hw:0,0 pisound MIDI PS-2FERRTS
IO hw:2,0,0 USB MIDI Interface MIDI 1

alejo@raspberrypi:~ $ aconnect -lio
client 0: ‘System’ [type=kernel]
0 'Timer ’
1 'Announce ’
client 14: ‘Midi Through’ [type=kernel]
0 ‘Midi Through Port-0’
client 16: ‘pisound’ [type=kernel,card=0]
0 ‘pisound MIDI PS-2FERRTS’
client 24: ‘USB MIDI Interface’ [type=kernel,card=2]
0 ‘USB MIDI Interface MIDI 1’

alejo@raspberrypi:~ $ amidi -p hw:2,0 -d
0 bytes read

Use amidi -p hw:0,0 -d then for seeing incoming MIDI messages on Pisound.

I used the pisound midiports with SC a while ago before i switched to usb controllers and i remember that there was more than one port available to choose from.

Your code is generally correct

MIDIClient.init;
m = MIDIOut(0);
MIDIClient.destinations; // check here which array index is the correct destination
m.connect(1); // the 1 here would mean the _second_ object in the array from above, maybe try others
m.noteOn(0,60,120);
m.noteOff(0,60,0);
m.control(0,61,51);

it could be that the actual hardware port is another port than MIDIClient.destinations[1], so maybe check with the output of MIDIClient.destinations.

EDIT:
So I tried this just now and the aforementioned code works. Now I don’t have an EHX 1440, i’ve just been monitoring the midi output through my Roland UM-3ex, but I always get an input signal when I send either note or control messages.

And also at least on my end Destination 1 seems correct, this is:

sc3> MIDIClient.destinations[1]
-> MIDIEndPoint("pisound", "pisound MIDI PS-3FQDVTF", 1572864)

Hope we can get to the bottom of this.

best,
dormir

1 Like