Is there a MIDI export?


Hi all,
Is there a simple MIDI export analogous to the wave record?



Hi there,
No there isn’t a midi record. available to produce a standard midi file.
You might get somewhere by playing the midi output to a program like Logic Pro as if coming from an external midi instrument, which would put the midi there where you might be able to save it as a midi file, but there would be problems on such things as tempo settings etc.
If you’re playing the midi output with an external instrument you can always feed the audio it produces back into Sonic Pi as live_audio and record that as audio in Sonic Pi, but I don’t think you can record the midi directly, without some kind of external program.


I was doing some research on this, the ‘waon’ tool works ok… I’ll try to compile Sonic Pi with an extra button for midi export using ‘waon’ (internally it will be: Sonic Pi -> wave -> midi - the last step using waon). I’ll post here whatever I get. If you are reading this in terror, worry not, I realise the ugliness of this method… it’s just an experiment :wink:


Also, I’ll look into the Sonic Pi code to export wave -> midi from the separate ‘tracks’ i.e., instruments, than the midi export through ‘waon’ would be way better. I haven’t looked into the Sonic Pi code, so I don’t know if it can be done this way…


That looks like quite a cool tool. It will be interesting to see what you come up with.


I downloaded and built waon on my Mac. It works quite well, converting .wav fils to midi. Thank you for highlighting it.


I’m curious if you have an example of how to send MIDI from Sonic Pi to Logic!


Not quite sure what your question means.
Sending midi commands to Logic, you just use them in Sonic Pi eg
midi :c4,:sustain 1 will send midi code to Logic to play the note :c4 for 1 second (assuming tempo is 60bpm.

If you mean can you take a file written to play notes in Sonic Pi and automatically produce a midi file, the answer is not directly. The orginal thread was asking this…if you could export sonic pi code as a midi file.
The waon code lets you take a specific limited case of a wav recording of a monophonic instrument and produce a midi file from that. I gave it a try and it was reasonably successful.

Alternatively you can write code in sonic pi that sends output as midi rather than playing synths, but you can’t directly produce a midi file from this. You can send the midi to logic as a stream.


Oops—very belated reply to your response! I’m looking for examples of sending MIDI values from Sonic Pi to other software like Logic and Max/MSP in order to control AU plug-ins.


have a look at this too. Similar question. Connecting to VST Host