Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Re: midified arpeggiator/auto-accompaniment using patterns
name
code content
( s.waitForBoot({ var right, left; MIDIdef.freeAll; if (~midi_initilized.isNil) { MIDIClient.init; MIDIIn.connectAll; ~midi_initialized = 1; }; ~n = ( table: Order(), noteOn: {|n,note| n.table[note] = 1}, noteOff: {|n,note| n.table.removeAt(note)}, get: {|n,i| n.table.indices[i] ?? n.table.indices.first ?? Rest(1) }, seq: {|n,notes| notes.asArray.collect{|i| Plazy{n.get(i)}} } ); MIDIdef.noteOn( \mynoteonhandler, // just a name for this handler { |val, num, chan, src| ~n.noteOn(num) } ); MIDIdef.noteOff( \mynoteoffhandler, // just a name for this handler { |val, num, chan, src| ~n.noteOff(num) // update note table and update ~n /* // only enable the following lines if you want the arpeggio to stop as soon as you release the keys ~n.table.clear */ } ); right = Pbind( \instrument, \default, \midinote, Pseq(~n.seq( [ 0, 2, 1, 2] ++ (([ 0, 2, 1, 2] + 12)!2).flatten )), \dur, 2*Pseq([1, 1, 1, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5 ].normalizeSum) ); left = Pbind( \instrument, \default, \midinote, Pseq(~n.seq([ 0, 2, 0, 2, 0, 2, 0, 2] - 12)), \dur, 2*Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum) ); if (~player.notNil) { ~player.stop; }; ~player = Pn(Ppar([right,left])).play; }); )
code description
Re: Let me know if you have ideas for improvement! (code-wise or feature-wise) -> I used an object prototype to streamline the process of registering notes and getting sequences of them. Code looks simpler to me and easier to further develop :)
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