Skip to content

Instantly share code, notes, and snippets.

@LFSaw
Last active January 21, 2024 23:34
Show Gist options
  • Save LFSaw/d0fdd9f3e9b212051a190b229192d8bb to your computer and use it in GitHub Desktop.
Save LFSaw/d0fdd9f3e9b212051a190b229192d8bb to your computer and use it in GitHub Desktop.
LFSaw ringtone

LFSaw ringtone

2012, Till Bovermann

Good Morning!

Inspired by a Nokia alarm clock sound from one of their non-smartphone mobiles, I designed an alarm clock sound for your mobile. The basic idea is to start with a very simple and short grain, giving you a chance to reach for the phone and turn it off before it starts to get annoying.

recording

s.options.memSize = 8192 * 8;
(
SynthDef(\grain, {|out = 0, freq = 100, attack = 0, decay = 1, sustain = 0.1, distort = 0, fTime = 0.1, fFac = 1.2, amp = 1, delay = 0|
var startFreq, endFreq, src, aEnv, fEnv;
startFreq = fFac * freq;
endFreq = freq;
aEnv = EnvGen.ar(Env.perc(attack, decay), timeScale: sustain, doneAction: 2, levelScale: amp);
fEnv = EnvGen.ar(Env([startFreq, endFreq], [fTime]));
src = SinOsc.ar(fEnv, 1, mul: 1 + distort).wrap2(1);
Out.ar(out, DelayN.ar(src * aEnv!2, 0.1, delay))
}).add
)
(
Pdef(\grainer, Pbind(
\radiation, Pseq([
Pseq([10] ++ (0.1 ) ++ [10] ++ (0.1!6), 1),
Pseq([ 1] ++ (0.1!6) ++ [ 1], inf)
]),
\instrument, \grain,
\freq, ([1200, 800, 600, 200]!12).flat.collect{|v| v * rrand(0.99, 1)} * Prand([4, 1, 2, 3, 4, 8], inf),
\fTime, 0.0125,
\fFac, 5,
\sustain, 0.1,
\attack, 0.0005,
\decay, 2,
//\distort, {Pwhite(0.1, 5.0)}!(12 * 4),
\amp, 0.1,
\delay, {Pwhite(0.01, 0.1)}!(12 * 4),
\dur, Pkey(\radiation)
)).play
)
Pdef(\grainer).stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment