Send shell command/program call via Sonic Pi

Hi,

temporarily (as long as I have not yet figured out how to send sysex commands with Sonic Pi) and for testing purposes I need to know how to send shell commands resp. a program call to a command line interface via Sonic Pi. I am pretty sure this must be possible, did a bit of googling but haven’t found yet something which works.

So I want to send the following command (on Linux) from a Sonic Pi buffer to be executed:

amidi -p hw:2 -S 'F0 00 20 6B 7F 42 02 00 10 77 01 F7'

Can I do that? If yes, any ideas?

Cheers
Martin

You could try the Ruby system command.

perhaps

cmd="amidi -p hw:2 -S 'F0 00 20 6B 7F 42 02 00 10 77 01 F7'"
system( cmd ) or raise "Something went wrong with amidi call"
#rest of program follows on

I haven’t got my linux setup available at present to test this, but on my Mac I tried

cmd="/Applications/iPhoto.app/Contents/MacOS/iPhoto "
system( cmd ) or raise "Something went wrong with iPhoto call"

which launched iPhoto correctly
The raise bit is optional. Otherwise if it doesn’t work you get no feedback

EDIT these are of course run in a Sonic Pi buffer

Hi @robin.newman,

that could work but unfortunately my plan is based on an error in reasoning. As soon as I start Sonic Pi the Midi device (Beatstep) is busy as far as amidi is concerned. Anyway, thanks for you support!

Just some information for people, who want/need to mess around with midi (or sysex) commands:

Geert Bevin released sendmidi and receivemidi on Github (OSX and Linux, possibly running also on Windows). You can open 2 or more shells, send commands and receive possible output from your controller including many options (just note: to send sysex commands as hex you have to provide the hex option; took me some time to find that out).