Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Rate Player
name
code content
s.boot; /*============================================ LOAD SOME PIANO SOUNDS HERE ===============================================*/ ( ~chords = Array.new; ~folder = PathName.new(""); // Load your path name here ~folder.entries.do({ arg path; ~chords = ~chords.add(Buffer.read(s,path.fullPath)); }); ) ~chords[rand(7)].play; // test here ( SynthDef(\pnoRhyth, { arg out=0, relTime=1, bufnum=0, rate=1, amp=1; var env, pno; env = EnvGen.ar(Env.perc(0.01, relTime),doneAction:2); pno = BufRd.ar(1, bufnum,Phasor.ar(0,BufRateScale.kr(bufnum)*rate,0,BufFrames.kr(bufnum))); pno = pno*env; pno = pno*amp; Out.ar(out, pno); }).add; ) Synth(\pnoRhyth, [\bufnum, ~chords[rand(7)], \relTime, 1.5, \out, 4, \amp, 1.5]); // Test again /*===================================================== PIANO PLAYERS - there are pno_1 & pno_2 ======================================================*/ t = TempoClock.new(100/60).permanent_(true); ( Pdefn(\rate, Pseq([0,3],inf).midiratio); Pdefn(\amp, 1.5); Pbindef(\pno_1, \instrument, \pnoRhyth, \dur, Pseq([Pseq([0.5],2), Pseq([0.25],2), Pseq([Rest(0.5)],2)],inf), \rate, Pdefn(\rate), \bufnum, ~chords[0], // Pindex(~chords,Pseq((0..7),inf), inf), \relTime, 0.3, \out, 0, \amp, Pdefn(\amp), ); // Player N° 2 // ( Pdefn(\rate, Pseq([0,3],inf).midiratio); Pdefn(\amp, 1.5); Pbindef(\pno_2, \instrument, \pnoRhyth, \dur, Pseq([ Pseq([0.5],2), Pseq([0.25],4), Pseq([Rest(0.5)],2) ],inf), \rate, Pdefn(\rate), \bufnum, ~chords[3], // Pindex(~chords,Pseq((0..7),inf), inf), \relTime, 0.2, \out, 0, \amp, Pdefn(\amp), ); ) ) /*===================================================== CONTROLS for PLAYERS =======================================================*/ Pbindef(\pno_1).play(t,quant:4); Pbindef(\pno_2).play(t,quant:4); Pbindef(\pno_1).resume(t,quant:1); Pbindef(\pno_2).resume(t,quant:1); Pbindef(\pno_1).pause; Pbindef(\pno_2).pause; Pbindef(\pno_1).resume; Pbindef(\pno_1).stop;Pbindef(\pno_2).stop; Pbindef(\pno_1).clear;Pbindef(\pno_2).clear; /*====================================================== AMP BOOST ---------- if needed =======================================================*/ Pdefn(\amp, 1.8); /*====================================================== BUTTON FOR CHANGING RATES =======================================================*/ ( Window.closeAll; w=Window("rate changer",Rect(900,200,300,150)) .front .alwaysOnTop_(true); w.view.decorator_(FlowLayout(w.bounds, 20@10,50@10)); ~tex_1 = StaticText(w.view, 80@20) .string_("Button_1") .align_(\center) .font_(Font("Monaco", 10)) .background_(Color.white); ~tex_2 = StaticText(w.view, 80@20) .string_("Button_2") .align_(\center) .font_(Font("Monaco", 10)) .background_(Color.white); w.view.decorator.nextLine; ~button_1 = Button(w.view, 80@80) .states_([ ["Ebm_1", Color.black, Color.red], ]) .action_({ |button| switch (button.value, 0, { Pdefn(\rate, Pseq([0,3],inf).midiratio) }, ) }); ~button_2 = Button(w.view, 80@80) .states_([ ["Eb_2", Color.black, Color.green], ["F7_3", Color.white, Color.blue] ]) .action_({ |button| switch (button.value, 0, { Pdefn(\rate, Pseq([Pseq([0],3),Pseq([2],1)],inf).midiratio) }, 1, { Pdefn(\rate, Pseq([Pseq([0],4),Pseq([Prand([2,4],inf)],2)],inf).midiratio) } ) }); ); /*============================================================= Pdefn info ================================================================*/ Pdefn(\rate, Pseq([0,3],inf).midiratio); Pdefn(\rate, Pseq([Pseq([0],3),Pseq([2],1)],inf).midiratio); Pdefn(\rate, Pseq([0,3],inf).midiratio); Pdefn(\rate, Pseq([Pseq([0],4),Pseq([Prand([2,4],inf)],2)],inf).midiratio); /*=================================================================*/ t.tempo_(90/60); // Tempo change if needed
code description
This is a player that I use for live work. It takes piano samples (or anything else I guess) and plays them in a rhythmic way that is also based on chord pitches. You'll see the GUI has (for me) chord names to remind me of what harmonic area this plays in. I'm using small sample of Morton Feldman's "Triadic Memories", if that's of any interest.
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