Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KilledByAPixel authored May 23, 2020
1 parent b2cce94 commit 16306fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
10 changes: 5 additions & 5 deletions ZzFX.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ class _ZZFX
constructor()
{
this.x = this.CreateAudioContext(); // shared audio context
this.samples = 0; // last played samples
this.volume = .3; // master volume scale
this.sampleRate = 44100; // sample rate for audio
this.samples = 0; // last played samples
}

Play(sound)
Expand Down Expand Up @@ -118,15 +118,15 @@ BuildSamples
const sampleRate = this.sampleRate;
const random = r => r*(Math.random()*2-1);
const sign = v => v>0?1:-1;
const startSlide = slide *= PI2 * 500 / sampleRate**2;
const startSlide = slide *= 500 * PI2 / sampleRate**2;
const modPhase = sign(modulation) * PI2/4
let startFrequency = frequency *=
(1 + random(randomness)) * PI2 / sampleRate;
attack = 99 + attack * sampleRate | 0;
sustain = sustain * sampleRate | 0;
release = release * sampleRate | 0;
delay = delay * sampleRate | 0;
deltaSlide *= PI2 * 500 / sampleRate**3;
deltaSlide *= 500 * PI2 / sampleRate**3;
modulation *= PI2 / sampleRate;
pitchJump *= PI2 / sampleRate;
pitchJumpTime = pitchJumpTime * sampleRate;
Expand Down Expand Up @@ -357,7 +357,7 @@ let zzfxP = // play a sound
sampleRate = 44100,
random = r => r*2*Math.random()-r,
sign = v => v>0?1:-1,
startSlide = slide *= PI2 * 500 / sampleRate**2,
startSlide = slide *= 500 * PI2 / sampleRate**2,
startFrequency = frequency *=
(1 + random(randomness)) * PI2 / sampleRate,
modPhase = sign(modulation) * PI2/4,
Expand All @@ -371,7 +371,7 @@ let zzfxP = // play a sound
sustain = sustain * sampleRate | 0;
release = release * sampleRate | 0;
delay = delay * sampleRate | 0;
deltaSlide *= PI2 * 500 / sampleRate**3;
deltaSlide *= 500 * PI2 / sampleRate**3;
length = attack + sustain + release + delay;
modulation *= PI2 / sampleRate;
pitchJump *= PI2 / sampleRate;
Expand Down
5 changes: 1 addition & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1004,8 +1004,7 @@
{
sounds,
generatedSoundCount,
volume:slider_masterVolume.value,
shortenCode:input_shortenCode.checked,
volume:slider_masterVolume.value
}

return JSON.stringify(data);
Expand All @@ -1024,8 +1023,6 @@
slider_masterVolume.value = data.volume;
if (data.generatedSoundCount)
generatedSoundCount = data.generatedSoundCount;
if (data.shortenCode !== 'undefined' )
input_shortenCode.checked = data.shortenCode;
if (data.sounds)
data.sounds.forEach(o=>o&&AddToList(o));

Expand Down

0 comments on commit 16306fb

Please sign in to comment.