I am trying to convert a midi file into a regular Pattern expression, so that I can change some of the it values and behaviors, e.g. I would like to load a MIDI file and have a general Pbind code whose pairs represents the MIDI values.
When using SimpleMIDIFile it is possible to create a pattern (a Ppar) that executes the MIDI file appropriately. Is it possible to extract the raw user side code that have originated this pattern?
// download a Bach midi file: "curl http://www.bachcentral.com/BachCentral/ORGAN/toccata1.mid -o ~/Desktop/toccata1.mid".unixCmd; // read it m = SimpleMIDIFile.read( "~/Desktop/toccata1.mid" ); // play it (cmd-. to stop) m.p.play; // takes a few seconds to start because this midifile starts with a rest m.p.postln;
I know that the contents of this Ppar are available when I execute
m.p.inspect, but is it possible to obtain the original expression like this?
Pbind( \instrument, \default, \dur, Pseq ([1, 2, 3, 4], 1), \chan, Pseq([1, 2, 3, 4], 1), \midinote, Pseq([1, 2, 3, 4], 1), \amp, Pseq([1, 2, 3, 4], 1), \sustain, Pseq([1, 2, 3, 4], 1), );
All the best,