Midi support, even just at command line

There are a lot of command line and graphical linux based midi tools that i use on the raspberry pi. I was thinking that a sailfish phone would be a good alternative platform for these.

I tried running sone simple alsa tools like aconnect via the command line but they are not working

[defaultuser@Xperia10II ~]$ aconnect -l
ALSA lib seq_hw.c:466:(snd_seq_hw_open) open /
dev/snd/seq failed: No such file or directory
can’t open sequencer

Do you think it is possible to install alsa on Sailfish or is there some fundemental problem?

Do you think it is possible to install alsa on Sailfish

ALSA libraries and tools are already available as you have found, but

is there some fundemental problem?

at least on XPeria10iii there is no support for ALSA sequencer in the kernel:

zcat  /proc/config.gz  | grep SND_SEQU
# CONFIG_SND_SEQUENCER is not set

@nephros, do you know what these are?

CONFIG_USB_F_MIDI=y
CONFIG_USB_CONFIGFS_F_MIDI=y

Maybe one could use SDL?

I had been looking at this: GitHub - poetaster/harbour-midij: Remote MIDI controller for DJs (port for Sailfish OS). but didn’t get to the details.

I can only ask the kconfig system:

 Symbol: USB_F_MIDI [=n]                                                                                                   │
  │ Type  : tristate                                                                                                          │
  │ Defined at drivers/usb/gadget/Kconfig:207                                                                                 │
  │   Depends on: USB_SUPPORT [=y] && USB_GADGET [=n]                                                                         │
  │ Selected by [n]:                                                                                                          │
  │   - USB_CONFIGFS_F_MIDI [=n] && USB_SUPPORT [=y] && USB_GADGET [=n] && USB_CONFIGFS [=n] && SND [=m]                      │
  │   - USB_MIDI_GADGET [=n] && USB_SUPPORT [=y] && USB_GADGET [=n] && SND [=m]  

It seems it would allow for a device to act as a USB_MIDI_GADGET


  │ Symbol: USB_MIDI_GADGET [=n]                                                                                              │
  │ Type  : tristate                                                                                                          │
  │ Defined at drivers/usb/gadget/legacy/Kconfig:316                                                                          │
  │   Prompt: MIDI Gadget                                                                                                     │
  │   Depends on: USB_SUPPORT [=y] && USB_GADGET [=n] && SND [=m]                                                             │
  │   Location:                                                                                                               │
  │     -> Device Drivers                                                                                                     │
  │       -> USB support (USB_SUPPORT [=y])                                                                                   │
  │ (1)     -> USB Gadget Support (USB_GADGET [=n])                                                                           │
  │           -> USB Gadget precomposed configurations                                                                        │
  │ Selects: USB_LIBCOMPOSITE [=n] && SND_RAWMIDI [=m] && USB_F_MIDI [=n]                                                     │
  │                                                                                                                           │
  │           

Nope. Don’t know what I was thinking.

Thanks! I just checked and it’s Midi Host support for stuff like USB midi keyboards. I’ll test that as soon as I get a USB B → C cable :slight_smile:

1 Like

gstreamer1.0-plugins-bad packages @ openrepos (lpr and lpr_next repo) provide libgstmidi.so that allows to Parse MIDI files (jolla official packages do not):
[defaultuser@Xperia10II ~]$ gst-inspect-1.0 midi
[defaultuser@Xperia10II ~]$ gst-inspect-1.0 midiparse

if you think it could be useful I could try to activate wildmidi support:
https://gstreamer.freedesktop.org/documentation/wildmidi/index.html

2 Likes

Does anyone know where in the github repos one would make a pr for enabling:

# CONFIG_SND_SEQUENCER 

GitHub - sailfishos/alsa-lib alsa-plugins? It’s not clear. But I can’t imagine it’s a burden. On the other hand, I CAN imagine it’s yet another issue VIS sailjail :slight_smile:

I installed this app

https://openrepos.net/content/aviarus/vipiano

And it seems to use fluidsynth to make the sounds

It’s a kernel config option, so I guess PRs should go to the Sony Open Devices kernel repo.

2 Likes

Thanks! I’ll see how that goes.

Yes fluidsynth can read midi files and be used to render them via sound fonts. But that’s not the same as talking to hardware :slight_smile: I’m waiting for a cable, then I can see what kind of midi io can be done via USB.

1 Like

Hi,
Did you get your cable or is it brought by feet? biggrin
Asking because I’m diving into music (well, “music” tbh) making and dreaming of using my SFOS phone as sequencer.
edit: more newer infos in this thread.

Well, I didn’t get midi input via usb working yet, though with @vige Sailmidi / raw midi approach I should get there. As it is, you can send midi files via Sailmidi so sfos could become a sequencer. Need to to give it some thought, but I have a number of euclidean sequencers (used both for driving a sampler and midi) which could be implemented as a function of Sailmidi to send out ….

EDIT, I couldn’t remember, but just tested. Sailmidi works (recognizes usb midi devices) on the xperia 10 iii but not on my volla 22 (or GS5/rephone).

I see. Actually, I’d similarly need to write to MIDI but also to read from MIDI of the the device.
Actually, my secret wish is to MIDI record tracks made on the incredibly crazy powerful Teenage Engineering OP-Z, then transform/polish them, and re-inject them into the device.

The only flaw it has, is not being able to zoom into the patterns (as the Deluge do) to temporally adjust each note separately (when stored on the same step).

Here is the lovely machine, which has USB MIDI and USB audio.

I’m familiar with the OP-Z, but don’t see how it isn’t more fun just to modify them ON the OP-Z? One of the workshops I’ve done is to build a laser midi arp/scale thingy and one of the participants used it drive his OP-Z as a drum sampler. That was pretty crazy.

Oh, so nice!
Actually, I’m not very good at playing notes right on the perfect good moment, especially when I want them off-beat, or slightly off-beat.
So, I’m searching for a way to correct that without having to play the sequence again (after 50 trials :sweat_smile:).
Of course, one can press the step and hit +/- in order to shift the note, but that’s not selectively working when two notes are stored on the same step.
Another use case would be to be able to record a long sequence (longer than the 10 measures allowed), split them and inject the parts as separated patterns.
Indeed, it is frustrating (when not blocking) to improvise a melody and stop before continuing it on the next pattern.

Ok, got you. I’ll give it some thought but probably don’t have enough time until spring :frowning:

Spring… 2026? Great! It’s already almost here!
But, don’t worry, as I don’t develop, it is just a spoilt child wish.
Or.. where are the tools and how could I begin to fiddle?

edit: I tried to plug the OP-Z on the phone.
Some tasty things appear with journalctl -f

Summary

Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usbpd usbpd0: Type-C Sink connected
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: PMI: smblib_get_apsd_result: APSD not done yet.
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: PMI: smblib_get_apsd_result: APSD not done yet.
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: binder: 1532:1532 → 0:0 transaction failed 29189/0, size 32-0 line 2149
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: PMI: smblib_get_apsd_result: APSD not done yet.
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: PMI: smblib_get_apsd_result: APSD not done yet.
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: PMI: smblib_get_apsd_result: APSD not done yet.
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: msm-dwc3 a800000.ssusb: DWC3 exited from low power mode
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: xhci-hcd xhci-hcd.0.auto: hcc params 0x0230fe65 hci version 0x110 quirks 0x00010010
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: xhci-hcd xhci-hcd.0.auto: irq 517, io mem 0x0a800000
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb1: Product: xHCI Host Controller
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb1: Manufacturer: Linux 4.4.194 xhci-hcd
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb1: SerialNumber: xhci-hcd.0.auto
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: hub 1-0:1.0: USB hub found
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: hub 1-0:1.0: 1 port detected
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb2: Product: xHCI Host Controller
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb2: Manufacturer: Linux 4.4.194 xhci-hcd
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: usb usb2: SerialNumber: xhci-hcd.0.auto
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: hub 2-0:1.0: USB hub found
Dec 29 19:07:12 XperiaXA2-DualSIM kernel: hub 2-0:1.0: 1 port detected
Dec 29 19:07:13 XperiaXA2-DualSIM kernel: usb 1-1: new high-speed USB device number 2 using xhci-hcd
Dec 29 19:07:13 XperiaXA2-DualSIM kernel: usb 1-1: New USB device found, idVendor=2367, idProduct=000c
Dec 29 19:07:13 XperiaXA2-DualSIM kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 29 19:07:13 XperiaXA2-DualSIM kernel: usb 1-1: Product: OP-Z
Dec 29 19:07:13 XperiaXA2-DualSIM kernel: usb 1-1: Manufacturer: teenage engineering ab
Dec 29 19:07:13 XperiaXA2-DualSIM kernel: usb 1-1: SerialNumber: X3CKJEVA
Dec 29 19:07:13 XperiaXA2-DualSIM mce[1339]: modules/audiorouting.c: audio_route_sink(): unknown audio sink device = ‘usbaudio’
Dec 29 19:07:13 XperiaXA2-DualSIM mce[1339]: modules/audiorouting.c: audio_route_sink(): unknown audio sink device = ‘usbaudio’

But then… :thinking: