Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Import midinote, dur, amp and sustain from midi file using SimpleMIDIFile
name
code content
m = SimpleMIDIFile.read( "~/Téléchargements/Super Mario Bros 2 - Mario Dreams.mid" ); ( TempoClock.default.tempo = m.tempo/60; Pdef(\bla, Pbind( \instrument, \default, [\midinote, \dur, \sustain, \amp], Prout({ arg ev; var timescale = 1/16/60; var prevev; m.noteSustainEvents.collect({ arg item, idx; // [track, absTime, \noteOn, channel, note, velo, dur, upVelo] if(idx == 0) { prevev = [item[4], item[1], item[6] * timescale, item[5]/127] } { prevev[1] = item[1] - prevev[1] * timescale; ev = prevev.yield; prevev = [item[4], item[1], item[6] * timescale, item[5]/127]; }; }); prevev[1] = prevev[2]; ev = prevev.yield; }), ) ).play )
code description
There is the .p method (see http://sccode.org/1-5aT) but here is also a way to retrieve the values directly
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