From 4bf3a8094ab951dc54462c723185f49d88cf5012 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Tue, 11 Feb 2020 13:57:02 +0100 Subject: [PATCH] Given value of 0 for weird amplitudes --- voicegardens/static/voicegardens.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/voicegardens/static/voicegardens.js b/voicegardens/static/voicegardens.js index 755b869..c907b0a 100644 --- a/voicegardens/static/voicegardens.js +++ b/voicegardens/static/voicegardens.js @@ -218,7 +218,11 @@ class GeneratedShape { **/ // sound and properties passed into shape creation this.soundRecorded = soundRecorded; - this.soundAmplitude = soundAmplitude; + + // ensure that erroneous minus amplitudes are at least given 0 + if (soundAmplitude < 0) this.soundAmplitude = 0.0; + else this.soundAmplitude = soundAmplitude; + this.soundDuration = soundDuration; // mouse hover awareness for sound playing