Skip to content

Instantly share code, notes, and snippets.

@nhthn
Created November 19, 2022 17:37
Show Gist options
  • Save nhthn/56168191c3cf2d1dcf9f124d0693a335 to your computer and use it in GitHub Desktop.
Save nhthn/56168191c3cf2d1dcf9f124d0693a335 to your computer and use it in GitHub Desktop.
Ivo Ivanov type beat
// Ivo Ivanov ripoff: https://www.youtube.com/shorts/1uukKdBGsY0
(
SynthDef(\kick, {
var snd;
snd = SinOsc.ar(Env.perc(0.001, 0.3, curve: -8).ar.linexp(0, 1, 30, 400));
snd = snd + (SinOsc.ar(XLine.ar(4000, 100, 0.01)) * Env.perc(0.001, 0.01).ar);
snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 8000, 0.5) * 3.dbamp * Env.perc(0.01, 0.03).ar);
snd = snd * Env.perc(0.001, 0.2, curve: -1).ar(Done.freeSelf);
snd = snd * 5.dbamp;
snd = snd.tanh;
snd = Pan2.ar(snd, \pan.kr(0));
OffsetOut.ar(\out.kr(0), snd);
}).add;
SynthDef(\snare, {
var snd;
snd = SinOsc.ar(Env.perc(0.001, 0.05, curve: -8).ar.linexp(0, 1, 230, 1000) * [1, 2.3]);
snd = (snd * [0, -15].dbamp).sum;
snd = snd + (SinOsc.ar(XLine.ar(8000, 100, 0.01)) * Env.perc(0.001, 0.01).ar);
snd = snd + (BPF.ar(Hasher.ar(Sweep.ar), 2100, 0.2) * 3.dbamp * Env.perc(0.05, 0.23).ar);
snd = snd + HPF.ar((snd * 3.dbamp).tanh, 100);
snd = snd * Env.perc(0.001, 0.12, curve: -1).ar(Done.freeSelf);
snd = snd * -5.dbamp;
snd = Pan2.ar(snd, \pan.kr(0));
OffsetOut.ar(\out.kr(0), snd);
}).add;
SynthDef(\glitch, {
var snd, seed, randomValue, random;
seed = \seed.kr(0);
randomValue = seed;
random = {
randomValue = Hasher.kr(randomValue);
randomValue;
};
snd = SinOsc.ar(random.().linexp(-1, 1, 100, 8000) * XLine.kr(2, 1, 0.01));
snd = snd * (1 + SinOsc.ar(random.().linexp(-1, 1, 100, 8000)));
snd = BPF.ar(snd, random.().linexp(-1, 1, 100, 8000) * ([1, -1] * 12 * random.()).midiratio, 0.1) * 10.dbamp;
snd = snd.sum;
snd = (snd * 20.dbamp).tanh;
snd = Latch.ar(snd, Impulse.ar(random.().linexp(-1, 1, 1000, 16e3)));
snd = snd * Env.perc(0.001, random.().linexp(-1, 1, 0.01, 0.2), curve: -4).ar(Done.freeSelf);
snd = snd * -5.dbamp;
snd = Pan2.ar(snd, \pan.kr(0));
OffsetOut.ar(\out.kr(0), snd);
}).add;
SynthDef(\pluck, {
var snd, freq;
freq = \freq.kr(440);
snd = SinOsc.ar(freq) * Env.perc(0.001, 0.3).ar * 1000;
snd = SinOsc.ar(freq + snd);
snd = snd + SinOsc.ar(freq);
snd = LPF.ar(snd, XLine.kr(8000, 4000, 0.1));
snd = snd * Env.perc(0.001, 0.3, curve: -8).ar(Done.freeSelf);
snd = Pan2.ar(snd, \pan.kr(0));
OffsetOut.ar(\out.kr(0), snd);
}).add;
SynthDef(\bass, {
var snd, freq;
freq = \freq.kr(440);
snd = Pulse.ar(freq, 0.7);
snd = snd + SinOsc.ar(freq / 2);
snd = LPF.ar(snd, XLine.kr(8000, 1000, 0.4));
snd = snd * 2.dbamp;
snd = snd * Env.perc(0.001, 0.3, curve: -4).ar(Done.freeSelf);
snd = Pan2.ar(snd, \pan.kr(0));
OffsetOut.ar(\out.kr(0), snd);
}).add;
SynthDef(\freqShift, {
var snd, up, down;
snd = LocalIn.ar(1);
snd = snd + (PinkNoise.ar * -20.dbamp);
up = snd;
up = FreqShift.ar(up, LFNoise2.kr(3) * 10);
up = BPF.ar(up, LFNoise2.kr(3).linexp(-1, 1, 100, 4000) * (12 * [-1, 1] * LFNoise2.kr(3)).midiratio, 0.1).sum;
up = LeakDC.ar(up).tanh;
down = snd;
down = FreqShift.ar(down, LFNoise2.kr(3) * 10);
down = CombC.ar(snd, 0.1, 1 / LFNoise2.kr(0.3).linexp(-1, 1, 10, 500), 0.01);
down = LeakDC.ar(down).tanh;
snd = up + down;
LocalOut.ar(snd);
snd = snd * \amp.kr(-20.dbamp);
snd = snd * Env.asr(0, 1, 1).ar(Done.none, \gate.kr(1));
snd = GVerb.ar(snd, revtime: 1);
snd = snd * Env.asr(0, 1, 3).ar(Done.freeSelf, \gate.kr(1));
Out.ar(\out.kr(0), snd);
}).add;
)
(
var s, bpm, beat, phrase, tatum;
s = Server.default;
bpm = 148;
beat = 60 / bpm;
tatum = beat / 4;
phrase = 14 * tatum * 4;
Routine({
var root, freqShift;
root = 54;
s.bind { freqShift = Synth(\freqShift); };
Routine({
3.do {
[
0, \, \, 2, \, \, 3, \,
\, \, \, \, \, \,
8, 8, \, 8, 8, \, 7, \,
\, \, 7, \, \, 7,
0, \, \, 0, \, \, -1, \,
\, \, \, \, \, \,
5, 5, \, 5, 5, \, 3, \,
\, \, 3, \, \, 2,
0, \, \, -5, \, \, 2, \,
\, -5, 3, 2, 0, \,
8, 8, \, 8, 8, \, 7, \,
\, \, 7, \, \, 7,
0, \, \, -5, \, \, 2, \,
\, -5, 3, 0, -4, \,
-5, \, \, \, \, \, \, \,
\, \, \, \, \, \,
].do { |note|
if(note != \) {
s.bind {
Synth(\pluck, [freq: (root + (12 * 2) + note).midicps]);
Synth(\pluck, [freq: (root + (12 * -1) + note).midicps]);
Synth(\bass, [freq: (root + (12 * -2) + note).midicps]);
};
};
tatum.wait;
}
};
}).play;
(phrase * 2).wait;
Routine({
16.do {
[
(synthDef: \kick, args: []),
(synthDef: \glitch, args: [seed: 0]),
(synthDef: \glitch, args: [seed: 1]),
(synthDef: \glitch, args: [seed: 2]),
(synthDef: \snare, args: []),
(synthDef: \glitch, args: [seed: 3]),
(synthDef: \glitch, args: [seed: 4]),
(synthDef: \glitch, args: [seed: 5]),
(synthDef: \glitch, args: [seed: 0]),
(synthDef: \glitch, args: [seed: 1]),
(synthDef: \kick, args: []),
(synthDef: \glitch, args: [seed: 2]),
(synthDef: \snare, args: []),
(synthDef: \glitch, args: [seed: 3]),
].do { |spec|
var repeat;
repeat = [1, 1, 1, 1, 1, 2, 4, 6].choose;
repeat.do {
s.bind { Synth(spec[\synthDef], spec[\args]) };
(tatum / repeat).wait;
};
};
};
}).play;
(phrase * 4).wait;
s.bind { freqShift.set(\gate, 0); };
}).play;
)
@mikiasb
Copy link

mikiasb commented May 15, 2023

I don't if this is the place to ask, but I keep getting "ERROR: syntax error, unexpected '(', expecting end of file
in interpreted text
line 95 char 1:". Straight noob here.

@socalledsound
Copy link

socalledsound commented Jun 25, 2023

...can't believe you said you didn't feel good about your hihat game ; 0 nice simple and solid here. that nicely dialed BPF makes all the difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment