RTP-MIDI on zynthian

Hi Wyleu,

are you able to build a kerneldriver module? I found a page on github with the source of applemidi kernel module https://github.com/mrArkwright/cmidid-kerneldriver . But unfortunetly was I not able to build this on my RPI. It would be grateful if you can do this and public the module here. All other people invited to do so too. :wink:
Looking forward hearing from you
Roman

1 Like

I could probably do it given some time but it’s not something I’ve done in a while so I will have to politely decline. If anyone else feels the need then I will happily test it to the limits of my facilities (I very rarely fire up a windows machine and I don’t possess a mac).
As this is an area that I have championed, I am keen to see progress but there is a working solution available and I’m involved in making sure that that implementation is working in multi zynth setups.
Please try perceviering yourself. You have the need and that is frequently the most effective motivator in these areas. I will help with any advise I can offer and will obviously delight in any success you have.
Obviously if anyone else wants to have a go I can ony forbid it entirely! :crazy_face:

RTPmidi aka applemidi support would be awesome since it has a wider scope. i.e. it can transverse vlans for those of us that have enterprise networks at home. I also use it as well as LoopMidi (Also by Tobias)
with some of my experiments with midi in VR. Not to mention its a native protocol for all the people using iMacs.

I suppose I’ve always been a udp man at heart… ! :slight_smile:

The idea of vlans isn’t something I’d thought of, I suppose if I were to offer an excuse, I’d be thinking latency, ( I have a strange video background… ).
I suspect it wouldn’t be too difficult as there’s nothing really clever going on if it’s properly adopted, and we have already addressed how we implement the provision of other MIDI channels via networks.

Anyone any further thoughts…?

1 Like

I just compiled pimidi and it seems to do something, i.e. running rtpMIDI on Windows machine will trigger activity within pimidi on Zynthian. That is as far as I got but maybe this could be integrated with Zynthian.

Hi Riban, I’ve tried to compile the applemidi kernel driver by Felix, and I fail. The source is for an old kernel < 3.19. I tried the IPMIDI tools by nerds.de, but I dislike to have to much MIDI port by different software running on my windows pc. Please, could you be so kind and explain how to compile and using pimidi. I will try to go this way.
Thanks Roman

Download the source code from GitHub to the RPi and follow the instructions in the INSTALL file. You may need to apt install libavahi-client-dev to satisfy dependencies. INSTALL says:

1. cd raveloxmidi
2. sh ./autogen.sh
3. ./configure
4. make
5. sudo make install

Way-hey! I got Virtual MIDI Piano Keyboard (VMPK) running on my Windows laptop triggering synth engines in Zynthian via rtpMIDI and pimidi.

I had to:

  • Stop zynthian, a2jmidid and jack2 services
  • Configure pimidi with:
network.bind_address 0.0.0.0
alsa.output_device = hw:2,0,0
  • start pimidi (raveloxmidi)
  • start jack2, a2jmidid and zynthian services
1 Like

Hi Riban,
never the less I had compiled the raveloxmidi on a fresh RPi3+. There some problems with the dependendies. One you named above. One question where have I build a config file and how should I named it.
Roman

Create a plain text config file called whatever you like and located anywhere you like - I put it in the root home folder /root/raveloxmidi.cfg. Start pimidi with the command:

raveloxmidi -c raveloxmidi.cfg

using the path and name of your config where I have used raveloxmidi.cfg.

Thanks a lot I will do so tommorow on my zythian RPi. The last question can I do the stops and start in the zynthian start command?
ROman

Also, check the names of the virtual ports using:

amidi -l

Mine were:

IO  hw:2,0    Virtual Raw MIDI (16 subdevices)
IO  hw:2,1    Virtual Raw MIDI (16 subdevices)
IO  hw:2,2    Virtual Raw MIDI (16 subdevices)
IO  hw:2,3    Virtual Raw MIDI (16 subdevices)

hence I used hw:2,0,0 for the RTP MIDI connection.

I stopped the services using ssh connection (or direct console connection) with the command:

service zynthian stop

and started similarly. If we decide this is a useful and robust solution then we could add it as another interface method. Today was just a quick and dirty, “let’s see if it will work” session. It needs more attention to see how well pimidi integrates with Zynthian.

Good night :sleeping:

2 Likes

Good Morning Riban,

I compiled successful the pimidi (raveloxmidi) software and start the tool with following script:
service zynthian stop
service a2jmidid stop
service jack2 stop
raveloxmidi -c raveloxmidi.cfg &
service jack2 start
service a2jmidid start
service zynthian start

raveloxmidi.cfg:
network.bind_address 0.0.0.0
alsa.output_device = hw:0,0,0

After this script run I can see raveloxmidi on my PC and be able to connect. The amidi -l output is:
cannot determine device number: Inappropriate ioctl for device

What’s going wrong? May you help me again?
Greettings Roman

EDIT: Output of the debug

root@zynthian:~# ./rtp
service zynthian stopped
service a2j stopped
service jack2 stopped
raveloxmidi started
network.control.port = 5004
network.data.port = 5005
network.local.port = 5006
network.socket_timeout = 30
network.max_connections = 8
service.name = raveloxmidi
service.ipv4 = yes
service.ipv6 = no
run_as_daemon = no
daemon.pid_file = raveloxmidi.pid
logging.enabled = yes
logging.log_level = debug
security.check = yes
readonly = no
inbound_midi = /dev/sequencer
file_mode = 0640
discover.timeout = 5
sync.interval = 10
network.read.blocksize = 2048
alsa.input_buffer_size = 4096
config.file = raveloxmidi.cfg
network.bind_address = 0.0.0.0
alsa.output_device = hw:0,0,0
[1575280903] [tid=1995732976] INFO: raveloxmidi (0.7.8)
[1575280903] [tid=1995732976] DEBUG: raveloxmidi_alsa_init output: device=hw:0,0,0 ret=-25 Inappropriate ioctl for device
[1575280903] [tid=1995732976] DEBUG: net_socket_init: network.bind_address=[0.0.0.0], family=2
[1575280903] [tid=1995732976] DEBUG: net_socket_create: Creating socket for [0.0.0.0]:5004, family=2
[1575280903] [tid=1995732976] DEBUG: net_socket_create: Creating socket for [0.0.0.0]:5005, family=2
[1575280903] [tid=1995732976] DEBUG: net_socket_create: Creating socket for [0.0.0.0]:5006, family=2
[1575280903] [tid=1995732976] INFO: Adding service ‘raveloxmidi._apple-midi._udp’
[1575280903] [tid=1995732976] DEBUG: net_socket_loop_init: pipe0=10 pipe1=11
service jack2 started
[1575280904] [tid=1988940672] INFO: Service ‘raveloxmidi’ successfully established.
service a2j started
service zynthian started
root@zynthian:~# amidi -l
Dir Device Name
cannot determine device number: Inappropriate ioctl for device
root@zynthian:~#

@Riban: After do modprobe snd-virmidi the dev is regnosized.
Thanks a lot for your friendly help.
Roman

Cool! I didn’t put that step in because I thought snd-virmidi may already be loaded - I was obviously mistaken. That may ease the integration - I was worried that virtual midi may be already used by Zynthian but obviously not. We would need some kind of rule to check or set the alsa ports used by snd-virmidi which needs to be set in the pimidi config (maybe udev rules may help or similar). We can look at that if we decide to integrate this interface. We may even be able to influence pimid developer with a patch to support alsa friendly names like we now do with alsa sound cards for Jack.

Please test this as well as you can and report success and any issues so that we can consider how best to proceed with such an integration. Anyone else who can help with this testing, especially on different platforms, e.g. MacOS, iOS, etc. please feedback your results. If there is sufficient desire for this feature and pimidi proves to be appropriate, I am sure we could persuade the boss (@jofemodo) to accept a pull request to add this :slight_smile: .

One way to get the right config file would be to create a template config file, e.g. my.tmpl:

network.bind_address 0.0.0.0
alsa.output_device = {hwport},0

then use gnu tools:

port=`amidi -l|grep -m 1 "Virtual Raw MIDI"|awk '{print $2}'`;sed "s/{hwport}/$port/" my.tmpl > raveloxmidi.cfg

which would create raveloxmidi.cfg with the first virtual MIDI port configured. Simples!!! There may be a cleaner (less hacky) way to solve this but I though I would record this whilst it was in my head.

Great work, guys!

I’ve researched a little bit and found that we have a @zynthianer that knows quite a bit about RTP-MIDI …
Monsieur Benoit Bouchez (@BEB), please, could you contribute your 5 cents about all this? :wink:

Regards,

1 Like

… Goes of to sulk with drip . . . . :pleading_face:

It’s really good stuff!, I still think we want to conceptually divide the in and out ports. IF just for a neater patchage drawing if nothing else!

@wyleu - at what level are you talking about separating the i/o ports? They are already presented separately to ALSA and hence JACK2 (via a2jackd). Do you mean at a configuration level, e.g. being able to enable inputs separate to outputs? Do you mean at a network level (which I am not sure is particularly easy to do - you seem to get both directions by default with most rtp-midi clients I have seen)?

BTW - pimidi presents its i/o as raw MIDI ports with the option to link to ALSA virtual ports. We could offer to add native ALSA or JACK2 support to pimidi if the whim took us :slight_smile:

I found this:

It could be interesting too …