Raspberry Pi | No connected (Midi) Devices

Hi Robin,
Hope you’re having a good year. I re-imaged the SD card with Raspberry Pi OS Full (32-bit) via Raspberry Pi Imager v1.6.2.

Vanilla Sonic Pi 3.2.2 can see the Teensy and the QuNexus as shown below in this composite image:

 
However in contrast to the advice from the inbuilt tutorial from neither device could I see a stream of MIDI cues in the cue window. 3.2.2 doesn’t seem to have the check-box that is in 3.3.1 to enable MIDI in - I am not sure if there is anything else I need to configure in the application or in my program.

Having at least got MIDI devices recognised I downloaded 3.3.1 .deb from sonic-pi.net. I did not “uninstall” 3.2.2 (I don’t know if this is even a thing in Linux) so I suppose you would say I just installed it over the top.

In 3.3.1 I am back to having no MIDI devices enumerated in Sonic Pi as per my original post so perhaps something is bjorkened with MIDI in on 3.3.1 on the Pi?

We can either work:
a) Lack of MIDI cues in 3.2.2 or
b) Lack of MIDI devices in 3.3.1

a is probably of more immediate use to me for prototyping but b is probably of more general benefit to the community if there is indeed a bug with Sonic Pi or some layer underneath it.

Try installing this version of 3.3.1 which I built on the latest version of the OS.

uninstall any existing version first using
sudo apt purge sonic-pi
You can install the new version by double clicking its icon, then putting in the pi password when asked to authenticate.

This version should list installed midi devices OK.
If you still cant see anything from your Teensy device I suggest you check the SP midi by playing a midi file through it.
YOu can download a midi file (I used a rag time piano part) and then do this in a terminal (I had no external devices connected)

aconnect -l
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
	Connecting To: 129:0
	Connected From: 128:0[real:0]
client 128: 'RtMidi Output Client' [type=user,pid=5715]
    0 'RtMidi Output   '
	Connecting To: 14:0[real:0]
client 129: 'RtMidi Input Client' [type=user,pid=5715]
    0 'RtMidi Input    '
	Connected From: 14:0

I then noted that midi through was cleint 14, and, in the folder whenere my downloaded midfile was I typed:
aplaymidi -p 14:0 St.LouisBluesRBN.mid
I could then see midi cues in the cues log, sent via the through port by aplaymidi. Running the program below in Sonic Pi before playing the midi file again I could hear the music.

use_synth :piano
with_fx :reverb do
  live_loop :mtest do
    use_real_time
    n,v = sync "/midi*/note_on"
    play n,sustain: 0.2 if v>0
  end
end

Let me know How you get on.
PS I could also play the midi file via 3.2.2 too

Thanks Robin,
Now that you showed me how to uninstall SP I did one more check of 3.3.1 from the sonic pi home page. I wanted to hotplug the MIDI peripherals while watching in the IO prefs box for any activity but it was dead as a doornail.

I installed your new version and both devices immediately show up and generate cues in the cue window as you can see in the composite image below. They do not event need to be selected from the menu.


 

Thanks for taking the time to look into this. Now I am going to experiment with getting MIDI notes to do things in Sonic Pi. While this is OT now I am going to try and do something like make the playback of each of the 3 samples in the demo below, taken from another thread, be contingent upon a note being ON/key held down. So if these were three “tracks” in a DAW you are unmuting each one when the key is pressed.

live_loop :drums do

  64.times do
    tick
    sample :drum_bass_hard if (spread 4,16).look
    sample :drum_snare_hard if (spread 2,16).rotate(4).look
    sample :drum_cymbal_hard if (spread 8,16).look
    sleep 0.25
  end
end

So in pseudo-code

live_loop :drums do
  64.times do
    tick
    [while MIDI note A on] sample :drum_bass_hard if (spread 4,16).look
    [while MIDI note E on] sample :drum_snare_hard if (spread 2,16).rotate(4).look
    [while MIDI note D on] sample :drum_cymbal_hard if (spread 8,16).look
    sleep 0.25
  end
end

Glad you got it going ok. I must get @samaaron to make the new version available on sonic-pi.net, although at present it doesn’t have transparency working properly.