MIDI recording in praxis

I’ve recently implemented a simple MIDI recorder in Lua for praxis. You can see it in action here:

After loading the file midirecorder.lua in praxis (either with dofile or by loading it into a buffer and hitting F1), the MIDI recorder becomes active in the system, and the following functions become available:

  • beginRecording()
  • beginPlayback()
  • stopRecorder()

In addition, you can see the collected data and save it using the method demonstrated in the video by using “inspect” to show the contents of the recorder.notes table.

The way the recorder works is simple. When recording, every frame the recorder checks to see if there are any MIDI events that have been received. If so, it adds them to the table along with the frame number the events were received in. When playing back, the recorder sends the MIDI events in the same order and on the same frames that they were received. Naturally, the precision of this system depends on how high and consistent the framerate is. In practice, I have found that 50 frames per second is plenty for faithfully capturing a lively 3 voice fugue that I may be playing on the MIDI piano. Running midirecorder.lua doesn’t explicitly change the update() function. Instead, it adds a widget containing only an update function, since update() has a call to WidgetLib.callAll(“update”)

I wrote this because I wanted a MIDI recorder in praxis. I have a MIDI piano hooked up and it seems like a natural thing for praxis to be able to do.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s