2023-04-09 05:32:36 +00:00
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
|
2023-04-09 02:12:36 +00:00
|
|
|
(
|
2023-09-30 08:11:55 +00:00
|
|
|
~to = TouchOSC(~touchosc_ip, 9000);
|
2023-04-09 02:12:36 +00:00
|
|
|
|
2023-04-09 06:44:59 +00:00
|
|
|
|
2023-04-15 06:03:16 +00:00
|
|
|
~tracknum = 0;
|
|
|
|
~granulator = ~granulators[0];
|
2023-04-09 02:12:36 +00:00
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
~speedlock = 0;
|
|
|
|
~speedquant = 0;
|
|
|
|
|
2023-04-09 02:12:36 +00:00
|
|
|
OSCdef.freeAll;
|
|
|
|
|
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
~to.button('/grains/reset', 0, { | v |
|
2023-04-09 02:12:36 +00:00
|
|
|
if( v > 0, {
|
|
|
|
~buflen = ~to.v('/grains/buflen');
|
2023-04-09 05:32:36 +00:00
|
|
|
(0..3).do({|i|
|
|
|
|
~granulators[i].reset(~buflen);
|
|
|
|
});
|
2023-04-09 02:12:36 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-09-23 05:05:33 +00:00
|
|
|
~quantspeed = { |v| 2.pow((v * 4 + 0.5).round - 5) };
|
2023-09-17 00:11:31 +00:00
|
|
|
|
2023-10-01 03:58:20 +00:00
|
|
|
|
|
|
|
~quantharmonics = {
|
|
|
|
arg f, quantise=0;
|
|
|
|
if(quantise != 0, {
|
|
|
|
var fraction = f.asFraction(7, false);
|
|
|
|
fraction[0] / fraction[1];
|
|
|
|
},
|
|
|
|
{ f }
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
// control ganging is hella laggy, do it in TouchOSC
|
|
|
|
|
2023-09-23 05:05:33 +00:00
|
|
|
|
2023-10-01 03:58:20 +00:00
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
~setspeed = { | track, v |
|
|
|
|
var speed, qv = if(~speedquant > 0, { ~quantspeed.value(v) }, { v });
|
|
|
|
speed = qv / ~buflen;
|
|
|
|
if(~speedlock > 0, {
|
|
|
|
(0..3).do({|n|
|
|
|
|
~possynths[n].set(\speed, speed);
|
|
|
|
if( n != track, {
|
|
|
|
var url = ("/grains/speed" ++ n).asSymbol;
|
|
|
|
~to.s_(url, v);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
{ ~possynths[track].set(\speed, speed) });
|
|
|
|
};
|
|
|
|
|
|
|
|
// setrecord: toggles record on (1) or off (0) for a track, and also sets the
|
|
|
|
// track's input mix to 0 so that it doesn't start fadeing out. If the track
|
|
|
|
// is the currently selected track, set its touchosc control to 0.
|
2023-09-23 05:06:05 +00:00
|
|
|
// keeps the level for each track in an array and resets it
|
|
|
|
|
|
|
|
~mixlevel = Array.new(4);
|
|
|
|
|
|
|
|
(0..3).do({~mixlevel.add(0.25)});
|
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
|
|
|
|
~setrecord = { | track, v |
|
|
|
|
~granulators[track].record_(v);
|
|
|
|
if(v == 0, {
|
2023-09-23 05:06:05 +00:00
|
|
|
~mixlevel[track] = ~granulators[track].mix;
|
2023-09-17 00:11:31 +00:00
|
|
|
~granulators[track].mix_(0);
|
2023-09-23 05:06:05 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
~granulators[track].mix_(~mixlevel[track]);
|
2023-09-17 00:11:31 +00:00
|
|
|
});
|
2023-09-23 05:06:05 +00:00
|
|
|
if( track == ~tracknum, { ~to.v_('/track/mix', ~granulators[track].mix); })
|
2023-09-17 00:11:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-04-09 02:12:36 +00:00
|
|
|
|
|
|
|
// note: ~buflen is the variable for buffer length, which only gets set to
|
|
|
|
// ~to.v('/grains/buflen') when the buffer is reset with the clear button
|
|
|
|
|
|
|
|
~to.slider('/grains/buflen', ~buflen, TouchOSCScale(0.1, 10.0), {});
|
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
|
2023-04-10 07:13:43 +00:00
|
|
|
~to.button('/grains/mode0', 0, { |v| ~granulators[0].mode_(v); ~setmode.value(0, v) });
|
|
|
|
~to.button('/grains/mode1', 0, { |v| ~granulators[1].mode_(v); ~setmode.value(1, v) });
|
|
|
|
~to.button('/grains/mode2', 0, { |v| ~granulators[2].mode_(v); ~setmode.value(2, v) });
|
|
|
|
~to.button('/grains/mode3', 0, { |v| ~granulators[3].mode_(v); ~setmode.value(3, v) });
|
2023-04-09 02:12:36 +00:00
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
~to.slider('/grains/speed0', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(0, v) });
|
|
|
|
~to.slider('/grains/speed1', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(1, v) });
|
|
|
|
~to.slider('/grains/speed2', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(2, v) });
|
|
|
|
~to.slider('/grains/speed3', 1, TouchOSCScale(0, 2), { |v| ~setspeed.value(3, v) });
|
|
|
|
|
2023-04-09 06:44:59 +00:00
|
|
|
|
|
|
|
~to.slider('/grains/passthrough', 0.75, TouchOSCScale(0, 1), { |v| ~grainmixer.set(\passthrough, v) });
|
2023-04-09 02:12:36 +00:00
|
|
|
|
2023-04-09 06:44:59 +00:00
|
|
|
~to.slider('/grains/mix0', 0.5, TouchOSCScale(0, 1), { | v | ~granulators[0].gain_(v) });
|
|
|
|
~to.slider('/grains/mix1', 0.5, TouchOSCScale(0, 1),{ | v | ~granulators[1].gain_(v) });
|
|
|
|
~to.slider('/grains/mix2', 0.5, TouchOSCScale(0, 1),{ | v | ~granulators[2].gain_(v) });
|
|
|
|
~to.slider('/grains/mix3', 0.5, TouchOSCScale(0, 1),{ | v | ~granulators[3].gain_(v) });
|
2023-04-09 02:12:36 +00:00
|
|
|
|
2023-09-17 00:11:31 +00:00
|
|
|
~to.button('/grains/lock', 0, { |v| ~speedlock = v });
|
|
|
|
|
|
|
|
~to.button('/grains/quant', 0, { |v| ~speedquant = v });
|
2023-04-09 05:10:04 +00:00
|
|
|
|
2023-10-01 03:58:20 +00:00
|
|
|
~to.button('/grains/metronome', 0, { |v|
|
|
|
|
if( v == 1, {
|
|
|
|
~bps = ~beatsperbar / ~buflen;
|
|
|
|
~tc.tempo_(~bps);
|
|
|
|
});
|
|
|
|
|
|
|
|
~metromix.set(\amp, v)
|
|
|
|
});
|
|
|
|
|
2023-04-09 06:44:59 +00:00
|
|
|
|
2023-04-16 07:45:15 +00:00
|
|
|
// Page 2: track
|
2023-04-15 06:03:16 +00:00
|
|
|
|
|
|
|
|
2023-09-30 08:21:29 +00:00
|
|
|
~to.xy('/track/triggersize', [ 100, 0.125 ], TouchOSCScale(0, 400), TouchOSCScale(0, 1.5), { |v|
|
2023-04-16 07:45:15 +00:00
|
|
|
~granulator.trigger_(v[0]);
|
|
|
|
~granulator.size_(v[1]);
|
2023-04-15 06:03:16 +00:00
|
|
|
});
|
2023-04-09 06:44:59 +00:00
|
|
|
|
|
|
|
~to.slider('/track/blur', 0, TouchOSCScale(0, 0.25), { |v| ~granulator.blur_(v) });
|
2023-04-10 06:25:04 +00:00
|
|
|
|
|
|
|
~to.button('/track/dust', 0, { |v| ~granulator.dust_(v) });
|
|
|
|
~to.button('/track/back', 0, { |v| ~granulator.back_(v)});
|
2023-09-23 05:06:26 +00:00
|
|
|
~to.button('/track/slope', 0, { |v| ~granulator.slope_(v) });
|
2023-04-10 06:25:04 +00:00
|
|
|
|
|
|
|
~to.button('/track/chorus', 0, { |v| ~granulator.chorus_(v) });
|
2023-10-01 03:58:20 +00:00
|
|
|
~to.slider('/track/harmonics', 2, TouchOSCScale(0.5, 3), { |v|
|
|
|
|
~granulator.harmonics_(~quantharmonics.value(v, 1))
|
|
|
|
});
|
2023-04-10 06:25:04 +00:00
|
|
|
~to.slider('/track/detune', 0, TouchOSCScale(0, 0.059), { |v| ~granulator.detune_(v) });
|
|
|
|
~to.slider('/track/pitch', 0, TouchOSCScale(-2, 2), { |v| ~granulator.pitch_(v.round) });
|
|
|
|
|
2023-04-09 06:44:59 +00:00
|
|
|
~to.slider('/track/mix', 0.25, TouchOSCScale(0, 1), { |v| ~granulator.mix_(v); });
|
|
|
|
~to.slider('/track/pan', 0, TouchOSCScale(-1, 1), { |v| ~granulator.pan_(v) });
|
|
|
|
~to.slider('/track/track', 0.5, TouchOSCScale(-1, 1), { |v| ~granulator.track_(v) });
|
|
|
|
~to.slider('/track/jitter', 0.25, TouchOSCScale(0, 1), { |v| ~granulator.jitter_(v) });
|
|
|
|
|
|
|
|
|
2023-04-15 06:03:16 +00:00
|
|
|
|
|
|
|
~to.button('/trackselect', 0, { |v|
|
2023-04-16 07:45:15 +00:00
|
|
|
~tracknum = v.asInteger;
|
|
|
|
~granulator = ~granulators[~tracknum];
|
|
|
|
|
|
|
|
~to.v_('/track/triggersize', [~granulator.trigger, ~granulator.size]);
|
|
|
|
~to.v_('/track/blur', ~granulator.blur);
|
2023-04-15 06:03:16 +00:00
|
|
|
~to.v_('/track/mix', ~granulator.mix);
|
2023-04-16 07:45:15 +00:00
|
|
|
~to.v_('/track/pan', ~granulator.pan);
|
|
|
|
~to.v_('/track/track', ~granulator.track);
|
|
|
|
~to.v_('/track/jitter', ~granulator.jitter);
|
|
|
|
~to.v_('/track/dust', ~granulator.dust);
|
|
|
|
~to.v_('/track/slope', ~granulator.slope);
|
|
|
|
~to.v_('/track/back', ~granulator.back);
|
|
|
|
~to.v_('/track/chorus', ~granulator.chorus);
|
2023-10-01 03:58:20 +00:00
|
|
|
~to.v_('/track/harmonics', ~granulator.harmonics);
|
2023-04-16 07:45:15 +00:00
|
|
|
~to.v_('/track/detune', ~granulator.detune);
|
|
|
|
~to.v_('/track/pitch', ~granulator.pitch);
|
|
|
|
});
|
2023-04-15 06:03:16 +00:00
|
|
|
|
2023-09-30 08:11:55 +00:00
|
|
|
// set up the record buttons on the front page now because /track/mix has been defined
|
|
|
|
|
|
|
|
~to.button('/grains/record0', 0, { | v | ~setrecord.value(0, v) });
|
|
|
|
~to.button('/grains/record1', 0, { | v | ~setrecord.value(1, v) });
|
|
|
|
~to.button('/grains/record2', 0, { | v | ~setrecord.value(2, v) });
|
|
|
|
~to.button('/grains/record3', 0, { | v | ~setrecord.value(3, v) });
|
|
|
|
|
2023-04-15 06:03:16 +00:00
|
|
|
|
2023-04-09 06:44:59 +00:00
|
|
|
|
2023-04-09 02:12:36 +00:00
|
|
|
|
|
|
|
~to.slider(
|
|
|
|
'/fx/filterfreq',
|
|
|
|
10000, TouchOSCScaleExp(100, 10000), { |v| ~filter.set(\freq, v) }
|
|
|
|
);
|
|
|
|
|
2023-04-09 05:32:36 +00:00
|
|
|
|
2023-04-09 02:12:36 +00:00
|
|
|
~to.slider('/fx/grainmix', 1.0, TouchOSCScale(0, 1), { |v| ~grainmixer.set(\grains, v) } );
|
|
|
|
~to.slider('/fx/filtermix', 0.8, TouchOSCScale(0, 1), { |v| ~filter.set(\amp, v) } );
|
|
|
|
~to.button('/fx/filtermoda', 1, { |v| ~filtermod.set(\a, v) });
|
|
|
|
~to.button('/fx/filtermodb', 0, { |v| ~filtermod.set(\b, v) });
|
|
|
|
~to.button('/fx/filtermodc', 0, { |v| ~filtermod.set(\c, v) });
|
|
|
|
|
|
|
|
|
|
|
|
~to.slider('/fx/delay', 0.2,TouchOSCScale(0, 1), { |v| ~delay.set(\delaytime, v) } );
|
|
|
|
~to.slider('/fx/decay', 1, TouchOSCScale(0, 5), { |v| ~delay.set(\decaytime, v) } );
|
|
|
|
|
|
|
|
~to.slider('/fx/delaymix', 0.2, TouchOSCScale(0, 1), { |v| ~delay.set(\amp, v) } );
|
|
|
|
|
|
|
|
|
|
|
|
~to.slider('/fx/reverbwet', 0.33,TouchOSCScale(0, 1), { |v| ~reverb.set(\mix, v) } );
|
|
|
|
~to.slider('/fx/reverbroom', 0.5,TouchOSCScale(0, 1), { |v| ~reverb.set(\room, v) } );
|
|
|
|
~to.slider('/fx/reverbdamp', 0.5,TouchOSCScale(0, 1), { |v| ~reverb.set(\damp, v) } );
|
|
|
|
|
|
|
|
~to.slider('/fx/reverbmix', 0.2, TouchOSCScale(0, 1), { |v| ~reverb.set(\amp, v) } );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// note - the three LFOs have different rate ranges
|
|
|
|
|
|
|
|
~to.slider('/lfos/afreq', 0.5,TouchOSCScale(0.001, 2), { |v| ~lfoa.set(\freq, v) } );
|
|
|
|
~to.slider('/lfos/aamp', 0, TouchOSCScale(0, 1), { |v| ~lfoa.set(\amp, v) });
|
|
|
|
|
|
|
|
~to.slider('/lfos/bfreq', 0.5,TouchOSCScale(0.01, 20), { |v| ~lfob.set(\freq, v) } );
|
|
|
|
~to.slider('/lfos/bamp', 0, TouchOSCScale(0, 1), { |v| ~lfob.set(\amp, v) });
|
|
|
|
|
|
|
|
~to.slider('/lfos/cfreq', 0.5,TouchOSCScale(0.1, 200), { |v| ~lfoc.set(\freq, v) } );
|
|
|
|
~to.slider('/lfos/camp', 0, TouchOSCScale(0, 1), { |v| ~lfoc.set(\amp, v) });
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|