Hi all, I’ve got what I think is a relatively simple question about SimpleMIDIFile (wslib extension). Let’s say I’ve got a .mid file that has multiple channels. Is there a way to isolate or separate channels from one another? For example, I might want to use a different SynthDef for each MIDI channel.
I’ve tried extracting all the channel 0 events and loading them into a new SMF instance. When I convert to pattern and play, I get silence, but lots of \default Synths on the server, and my CPU is around 25-30%. I wonder if I’m missing a step somewhere:
s.boot;
m = SimpleMIDIFile.read("/Users/eli/Desktop/bwv772.mid");
~m_ch0 = SimpleMIDIFile.new("~/Desktop/channel0.mid");
~m_ch0.init1(2, m.tempo, m.timeSignatures[0][1]);
~m_ch0.addAllMIDIEvents( m.midiChannelEvents(0) );
~m_ch0.p.play; //silence, significant CPU usage
I’ve also tried using patterns (Pselect) to handle the filtering, but the note durations get erroneously quantized to the nearest beat (or maybe rests are being ignored?), which destroys the original rhythm:
s.boot;
m = SimpleMIDIFile.read("/Users/eli/Desktop/bwv772.mid");
m.p.select({arg ev; ev[\chan]==0}).play; //malformed metric values
Basically, I want the equivalent of having multiple MIDI tracks/channels in a DAW, and e.g. muting one of them, or assigning a different instrument to play one of them. What is the easiest way to do this?
By the way, this is the test file I’m using: http://www.jsbach.net/midi/bwv772.mid
Thanks,
Eli