Sunday, December 11, 2016

Simple Data Visualisation and Recording

I find it useful to be able to visualise data - especially when dealing with sensor data. This includes things like a current-state graphical representation, scrolling graphs and the ability to import sensor data into Excel for further analyses or record keeping.

Download here:

This Max patch is simply a visualisation tool that takes up to sixteen channels of data via MIDI pitch bend messages and displays this as a set of sliders, a scrolling point graph and the ability to export to a text file that can be imported into Excel (tab-deliminated with carriage returns).

Peak values can be shown as orange markers on the sliders. The peak data can be cleared. Data that is fed into the scrolling point display as well as the text file has an interval / sampling rate. This is between 0 - 10000 milliseconds as defined by the user. This interval / sampling rate is independent of the rate and which data arrives, which is handy of asynchronous data across multiple channels.

Data per channel can be toggled on or off for the text file recording. The text file can be viewed, cleared and saved to disk. To import the text file into Excel, simply select open from Excel, choose tab-deliminated CSV file, choose tab as the separator. This will present the data via columns as channels, rows as sample periods and cells as data points. From here, the data can be manipulated as per usual in Excel.

To send data in the correct format, simply send a 14-bit MIDI value from software or hardware to the Max patch. Make sure that the correct MIDI device is selected in the patch. The pitch bend from each MIDI channel is a separate data channel in the patch, from 1 - 16.

Data can be sent from Live, Logic, ProTools etc. Data can also be sent from hardware such as MIDI controllers and keyboards.

Data can also be sent from Arduino / Teensy etc. Here is the Teensy code as an example - the important thing to realise is that each sensor's data is sent on a MIDI channel via pitch bend, and that the data is constrained to a 0 - 16383 value range.