Diff from midified arpeggiator/auto-accompaniment using patterns by 56228375 (03 Jan'20 01:19) to Re: midified arpeggiator/auto-accompaniment using patterns by elgiano (11 Jan'20 18:03)

name
Re: midified arpeggiator/auto-accompaniment using patterns
description
ProofRe: of concLept codme know if yoru have midified as forpegg iatompr/auto-accovempaniment! system, qui(ckly rodeact-wingse to chord chfeangture-wise) -> MidiI ius received as inpu object, and supercollider's default insotrumypent (I kntow, I know) is genetreatmlinge the output. This crodce iss accompanimentf to a blog article at httpgis://techrinogems.bl nogspot.com/2020/01/mes akind g-arpeggiator-tin-g sequperncollider.html Lets me know if you thavem. iCodeas floroks simpler tove ment! (coand e-wiasier tor featurthe-wisr develop :)
code
( s.waitForBoot({ var right, left; var n0, n1, n2; var note_getter; MIDIdef.freeAll; if (~midi_initilized.isNil) { MIDIClient.init; MIDIIn.connectAll; ~midi_initialized = 1; }; ~n = ( table: Order(), note_On: {|n,note| n.table[note] = 0!127;}, ~ 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| ~note_table[.num] = 1; // update note table aOnd update ~n ~n = ~note_table.selectIndices({|itenum, i| item != 0}); } ); MIDIdef.noteOff( \mynoteoffhandler, // just a name for this handler { |val, num, chan, src| ~n.note_table[Off(num]) = 0; // 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 = ~no.te_table.seclectIndices({|item, i| item != 0});ar if (~n == []) { ~n = nil; }; */ } ); note_getter = { | index | Plazy { if (~n.isNil) { Pseq([Rest(1)]); } { ~n[index] ?? (~n[0] ?? Pseq([Rest(1)])); }; }; }; n0 = note_getter.(0); n1 = note_getter.(1); n2 = note_getter.(2); right = Pbind( \instrument, \default, \midinote, Pseq(~n.seq( [ n0, n2, n1, n2] ++ (([ n0, n2, n1, n2] + 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*2) ); left = Pbind( \instrument, \default, \midinote, Pseq(~n.seq([ n0, n2, n0, n2, n0, n2, n0, n2] - 12)), \dur, 2*Pseq([1, 1, 1, 1, 1, 1, 1, 1].normalizeSum*2) ); if (~player.notNil) { ~player.stop; }; ~player = Pn(Ppar([right,left])).play; }); )
category tags
pattern, arpeggio, midi, code fork, arpeggiator, autoaccompaniment
ancestors
1-5cr