Send MIDI commands from other program

R
Rien Heuver posted Dec 4, 21:28:

Hey there,

In short: is there a way to write my own (python or otherwise) program that can send midi signals to samplerbox?

In long: I'm working on building a full sized electrical marimba, which is a rare instrument much like the malletKAT (just google it ;-)), but clearly I want it way cheaper. So the idea is to build the entire construction, use piezo-elements for velocity detection, wire all piezos (through multiplexers) to an ADC and hook that up to a raspberry pi. Then write a python program that turns the piezo-signals into sound.

The best solution to that last part now seems to be using samplerbox. It's quite featured, I can build the display in my casing and everything else just makes sense too. So how would I go about instructing samplerbox with the right commands from my program? Greatly looking forward to any help, since all is appreciated!

R
Rien Heuver posted Dec 4, 21:50:

Alright, so I continued researching in the meantime and found that rtmidi (which samplerbox uses) can do virtual midi, if you will. Somehow this doesn't seem like the right way to go, since I'm now creating a virtual midi device to send midi signals to a midi server which then plays the notes. I´d rather import samplerbox and play the notes, if that's possible. Any help is still welcome of course! In the meantime, this is my little test script that got the virtualization working:

import rtmidi_python as rtmidi
from time import sleep

midi_out = rtmidi.MidiOut()
midi_out.open_port(2)
midi_out.send_message([0x90, 48, 100])
sleep(0.1)
midi_out.send_message([0x80, 48, 100])
midi_out.close_port

R
Rien Heuver posted Dec 5, 20:19:

Today I have been experimenting some more: this time I put the samplerbox-image on a raspi, booted the raspi, connected my regular earphones to the raspi (no dac), ssh'd to the raspi and tried the script above. When listing the midi out ports available, I only get "Midi Through:0". I got RtMidi Input Client a few times (and then it would also play a note), but now it seems gone. Am I going about this the wrong way or is there some other reason why this virtual midi program would not work?

After rebooting it could work again for a few times, but then the rtmidi-out seems to crash or something, because it "disappears" again.

...

  (not published)
  I want to post as guest
 

Post