Skip to content

Instantly share code, notes, and snippets.

@dndrks
Created February 18, 2024 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dndrks/6bde1c5761e18096f559935380198c11 to your computer and use it in GitHub Desktop.
Save dndrks/6bde1c5761e18096f559935380198c11 to your computer and use it in GitHub Desktop.
240218
// Quarks.install("Ease")
{SinOsc.kr(3)}.plot(1);
{EaseOutInBounce.kr(SinOsc.kr(3))}.plot(1);
{Line.kr(0,1,1)}.plot(1)
{SinOsc.ar(3)}.plot(1)
{EaseInCirc.ar(SinOsc.ar(300))!2}.play
{EaseInSine.ar(SinOsc.ar(300))!2}.play
{SinOsc.ar(300)!2}.play
~sample = Buffer.read(s, "/Users/danderks/perm/flac_norns_audio/DANE.ZONE PACK #1/UPRIGHT PIANO/upright_#2 120bpm G.flac")
// trigger one shot on each pulse
SynthDef(\help_PlayBuf, {| out = 0, bufnum = 0 |
var trig;
trig = Impulse.kr(EaseOutInBounce.kr(XLine.kr(0.1, 100, 30)).scope);
Out.ar(out,
PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum), trig, 5000, 0)
)
}).play(s, [\out, 0, \bufnum, ~sample]);
(
SynthDef(\kick,
{
arg pan = 0, t_gate = 0, freq=600;
var sound, env, fbEnv, pitchEnv;
env = EnvGen.kr(
envelope: Env.perc(0.01,3),
gate: t_gate,
doneAction:2
);
fbEnv = EnvGen.kr(
envelope: Env.perc(0.01,0.9),
gate: t_gate
);
pitchEnv = EnvGen.kr(
envelope: Env.perc(0.01,0.1),
gate: t_gate
);
sound = SinOsc.ar(
freq + (pitchEnv*120),
pi/2 + SinOscFB.ar(freq*10, fbEnv,0.2),
env
);
sound = Pan2.ar(sound*0.5,pan);
Out.ar(0, sound);
}
).send(s);
~kick = {
arg freq=60;
if (x.isPlaying, {
x.set(\t_gate,-1.1);
x = Synth(\kick, args: [
\t_gate, 1,
\freq, freq
]);
NodeWatcher.register(x,true);
},{
x = Synth(\kick, args: [
\t_gate, 1,
\freq, freq
]);
NodeWatcher.register(x,true);
});
}
)
(
Routine({
loop {
(EaseOutBack.value(0.9 ** (0..10))).do { |duration|
duration.postln;
// Synth(\kick);
~kick.value();
duration.wait;
};
};
}).play;
)
(
Routine({
90.do { |i|
var duration;
duration = EaseInSine.value(i * 2pi / 60).linlin(0, 1, 0.05, 0.5);
duration.postln;
s.bind { ~kick.value(); };
duration.wait;
};
}).play;
)
(
SynthDef(\sine,
{
arg freq=60, pan=0, modAmp=0, pitchMul=0, amp=1;
var sound, env, fbEnv, pitchEnv;
env = EnvGen.kr(Env.perc(0.01,3),doneAction:2);
fbEnv = EnvGen.kr(Env.perc(0.01,0.9));
pitchEnv = EnvGen.kr(Env.perc(0.01,0.1)) * pitchMul;
sound = SinOsc.ar(
freq + (pitchEnv*freq),
pi/2 + SinOscFB.ar(freq*10, fbEnv, modAmp),
env
);
sound = Pan2.ar(sound*0.5*amp,pan);
Out.ar(0, sound);
}
).send(s);
)
~times = [31,51,61];
~index = -1;
(
Routine({
// loop {
// ~time = rrand(20,300);
var time;
~index = (~index + 1).wrap(0,~times.size-1);
time = ~times.at(~index);
10.do { |i|
var note = (60+Scale.dorian.degrees.at(EaseOutBounce.value(i/10).linlin(0,1,0,6))).midicps;
var modAmp = 1.0.linrand;
var duration = EaseInSine.value(i * 2pi / time).linlin(0, 1, 0.05, 0.5);
duration.postln;
note.postln;
x = Synth(\sine, [
freq: note,
modAmp: modAmp,
amp: 1/10,
pan: rrand(-1,1)
]);
// rrand(0.1, 0.5).yield;
duration.yield;
};
// };
}).play;
)
(Routine({
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment