Last active
June 16, 2016 20:33
-
-
Save antonhornquist/82e39ba6a2f332674ceee18f638618fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
s.boot; | |
s.latency = 0.02; | |
~grid=GRMonome64.new; | |
~grid.spawnGui; | |
~playpos=GRHToggle.newDecoupled(~grid, 0@7, 8, 1, nillable: true).value_(nil); | |
~pages=GRSwitcher(~grid, 0@1, 8, 6); | |
~pageselect=GRHToggle(~grid, 0@0, 4, 1).action_({ |view, value| ~pages.value = value }); | |
~transport=GRHToggle(~grid, 6@0, 2, 1); | |
~transport.action = { |view, value| if (value == 1) { ~player.play } { ~player.stop } }; | |
~scramble=GRButton.newDecoupled(~grid, 4@0).value_(true); | |
~scramble.buttonPressedAction = { 8.do { |togglenum| | |
var mtv= ~pages.currentView; | |
if (mtv.toggleValue(togglenum).notNil) { | |
mtv.setToggleValue(togglenum, 6.rand); | |
} | |
} }; | |
~shuffle=GRButton(~grid, 5@0); | |
~degrees=GRMultiToggleView(~pages, 0@0, 8, 6, nillable: true); | |
~degrees.valuesAreInverted = true; | |
~octaves=GRMultiToggleView(~pages, 0@0, 8, 6); | |
~octaves.valuesAreInverted = true; | |
~cutoffs=GRMultiToggleView(~pages, 0@0, 8, 6); | |
~cutoffs.valuesAreInverted = true; | |
~variation=GRMultiToggleView(~pages, 0@0, 8, 6); | |
~variation.valuesAreInverted = true; | |
8.do { |i| ~octaves.setToggleValue(i, 3) }; | |
SynthDef( | |
\grrr_test, | |
{ |freq, cutoff_freq, variation, gate=1, amp| | |
var sig; | |
var osc1 = VarSaw.ar(freq, width: variation.linlin(0, 1, 0, 0.25)); | |
var osc2 = VarSaw.ar(((freq.cpsmidi)-12).midicps, width: 0); | |
var amp_env = EnvGen.ar(Env.perc(0.01, variation.linlin(0, 1, 0.9, 0.1)), gate, amp, doneAction: 2); | |
var filter_env = EnvGen.ar(Env.perc(0.01, variation.linlin(0, 1, 0.01, 0.6)), gate); | |
sig = RLPF.ar((osc1 * 0.7) + (osc2 * 0.3), cutoff_freq.linexp(0, 1, 20, 4000) + filter_env.linexp(-1, 1, 20, 3000)) * amp_env; | |
Out.ar(0, sig ! 2); | |
} | |
).add; | |
~multi_toggle_view_as_prout = { |view, func| | |
Prout({ | |
loop { | |
8.do { |togglenum| func.(view.toggleValue(togglenum)).yield } | |
} | |
}) | |
}; | |
~pattern=Pbind(*[ | |
\instrument, \grrr_test, | |
\degree, ~multi_toggle_view_as_prout.(~degrees, { |degree| if (degree.notNil, degree, \rest) }), | |
\octave, ~multi_toggle_view_as_prout.(~octaves, { |toggle_value| toggle_value+2 }), | |
\cutoff_freq, ~multi_toggle_view_as_prout.(~cutoffs, { |toggle_value| toggle_value/6 }), | |
\variation, ~multi_toggle_view_as_prout.(~variation, { |toggle_value| toggle_value/6 }), | |
\dur, Prout({ loop { | |
if (~shuffle.value) { 0.16.yield; 0.1.yield } { 0.13.yield; 0.13.yield } | |
}}), | |
\playpos, Prout( { loop { 8.do { |playpos| (~playpos.value = playpos).yield } } }) | |
]); | |
~player=~pattern.asEventStreamPlayer; | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment