Skip to content

Commit

Permalink
tweak gens
Browse files Browse the repository at this point in the history
  • Loading branch information
KilledByAPixel committed Jun 30, 2024
1 parent 6c029bc commit 25bf641
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
sustain = R()**3/2*lengthScale,
release = R()**3/2*lengthScale,
length = attack + decay + sustain + release,
filter = C()? 0 : R()<.8? 200+R()**2*800 : R()**2*1e3-1500;
filter = C()? 0 : R()<.7? 200+R()**2*800 : R()**2*1e3-1300;

// create random sound
return BuildSound
Expand All @@ -506,7 +506,7 @@
sustain, // sustain
release, // release
R()*5|0, // shape
R()**2*3, // shapeCurve
R()*5, // shapeCurve
C()**3*99*S(), // slide
C()**3*99*S(), // deltaSlide
C()**2*500*S(), // pitchJump
Expand All @@ -516,9 +516,9 @@
R()*C()**3*500*S(),// modulation
C()**4, // bitCrush
C()**3/2, // delay
1 - C(), // sustain volume
1 - R()*.5, // sustain volume
decay, // decay
C()**4, // tremolo
C()**2*.5, // tremolo
filter // filter
);
}
Expand All @@ -529,7 +529,7 @@
const R =(a=1,b=0) => b+(a-b)*Math.random();

if (R()<.5) // apply random filter
sound.filter = R()<.8 ? 200+R()**2*800 : R()**2*1e3-1500;
sound.filter = R()<.7 ? 200+R()**2*800 : R()**2*1e3-1300;

switch (presetName)
{
Expand All @@ -543,7 +543,7 @@
{
sound.frequency = R(200,700);
sound.shape = R(2)|0;
sound.shapeCurve = R(2);
sound.shapeCurve = R(5);
sound.attack = R(.02);
sound.decay = R(.05);
sound.sustain = R(.1);
Expand All @@ -567,7 +567,7 @@
{
sound.frequency = R(99,700);
sound.shape = R(2)|0;
sound.shapeCurve = R(2);
sound.shapeCurve = R(5);
sound.attack = R(.1);
sound.decay = R(.1,.3);
sound.sustain = R(.1,.3);
Expand All @@ -592,7 +592,7 @@
{
sound.frequency = R(50,500);
sound.shape = R(2)|0;
sound.shapeCurve = R(2);
sound.shapeCurve = R(5);
sound.attack = R(.05);
sound.decay = R(.1);
sound.sustain = R(.1);
Expand All @@ -609,7 +609,7 @@
{
sound.frequency = R(50,500);
sound.shape = R(4)|0;
sound.shapeCurve = R(2);
sound.shapeCurve = R(5);
sound.attack = R(.03);
sound.decay = R(.1,.2);
sound.sustain = R(.2);
Expand Down Expand Up @@ -641,7 +641,7 @@
{
sound.frequency = R(30,500);
sound.shape = R(5)|0;
sound.shapeCurve = R(3);
sound.shapeCurve = R(5);
sound.attack = R(.03);
sound.decay = R(.1);
sound.sustain = R(.1);
Expand Down Expand Up @@ -686,7 +686,7 @@
sound.frequency = noteScale[(R(3)|0)*7][0];
sound.randomness = 0;
sound.shape = R(3)|0;
sound.shapeCurve = R(2);
sound.shapeCurve = R(5);
sound.attack = R()<.3 ? R(.05) : R(.2);
sound.decay = R(.2);
sound.sustain = R(1);
Expand Down Expand Up @@ -722,7 +722,7 @@
// convert to fixed point
if (typeof sound.frequency != 'string')
sound.frequency = Fixed(sound.frequency,0);
sound.shapeCurve = Fixed(sound.shapeCurve);
sound.shapeCurve = Fixed(sound.shapeCurve,1);
sound.attack = Fixed(sound.attack);
sound.sustain = Fixed(sound.sustain);
sound.release = Fixed(sound.release);
Expand Down

0 comments on commit 25bf641

Please sign in to comment.