Closed ttencate closed 5 years ago
In synth.js
we compute the sample count like this:
var numSamples = Math.max(1, Math.ceil(sampleRate * this.sound.duration()));
We'd expect 0.28 * 44100 = 12348 samples, but due to floating point error, the ceil
causes one sample too many to exist here. The excessive sample at index 12348 ends up after the attack and sustain periods and goes into the decay period, where we divide by this.decay.value
which is 0, resulting in a single NaN sample at the end.
E.g.. I got this to repro with attack = 0.08, sustain = 0.2 as well, but it doesn't seem to be deterministic.