Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: MIDIFile player with CC capability
name
code content
( // create a MIDI file m = SimpleMIDIFile("~/output.mid"); m.init1; m.timeMode_( \seconds ); // correct timeMode // add some random Notes ((0,(1/8)..5)).do({ |starttime| m.addNote( 36 + 50.rand, 32 + 96.rand, starttime, [0.1,0.05].choose, 127, track: 1 ) }); // add some random CCs ((0,(1/8)..5)).do({ |starttime| m.addMIDITypeEvent(type: 'cc', args: [7, 128.rand], absTime: starttime, track: 1 ) }); m.adjustEndOfTrack; // may not be really needed, but nice if you want to do m.plot ) MIDIClient.init; ( ~events = m.midiEvents; ~midiout = MIDIOut(0); ~routine = { var lastTime = 0; ~events.do({ |evt| (evt[1] - lastTime).wait; lastTime = evt[1]; switch( evt[2].post, \noteOn, { ~midiout.noteOn( *evt[3..].postln ); }, \noteOff, { ~midiout.noteOff( *evt[3..].postln ); }, \cc, { ~midiout.control( *evt[3..].postln ); } ); }); }.fork; )
code description
Play a midi file and include CC value changes. Code taken from sc-users mailinglist. http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/simpleMIDIfile-play-via-MIDIOut-including-CC-td7632193.html
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change