@audio/synth-drum 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/drum.js +1 -1
  2. package/package.json +1 -1
package/drum.js CHANGED
@@ -26,7 +26,7 @@ export function noiseDrum ({ duration = 0.25, fs = 44100, amp = 0.7, seed = 9 }
26
26
  let n = Math.round(duration * fs)
27
27
  let out = new Float32Array(n)
28
28
  let s = seed
29
- for (let i = 0; i < n; i++) { s = (s * 1103515245 + 12345) & 0x7fffffff; out[i] = amp * (s / 0x3fffffff - 1) * Math.exp(-i / n * 7) }
29
+ for (let i = 0; i < n; i++) { s = (Math.imul(s, 1103515245) + 12345) & 0x7fffffff; out[i] = amp * (s / 0x3fffffff - 1) * Math.exp(-i / n * 7) } // imul: exact mod 2³²
30
30
  return out
31
31
  }
32
32
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/synth-drum",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Drum synthesis — membrane kick, metal cymbal, noise snare (Tone.js class)",
5
5
  "type": "module",
6
6
  "sideEffects": false,