diff --git a/crates/audio-context-napi/Cargo.toml b/crates/audio-context-napi/Cargo.toml index e9b6f85e..b9adc2d3 100644 --- a/crates/audio-context-napi/Cargo.toml +++ b/crates/audio-context-napi/Cargo.toml @@ -17,7 +17,7 @@ napi7 = ["napi/napi7"] [dependencies] napi = { version = "3.13.0", default-features = false, features = ["dyn-symbols"] } napi-derive = "3.6.9" -web-audio-api = "1.7.0" +web-audio-api = "1.8.0" base64 = "0.22.1" [build-dependencies] diff --git a/crates/audio-context-napi/__test__/audio.test.mjs b/crates/audio-context-napi/__test__/audio.test.mjs index 9e7f4173..0420b62b 100644 --- a/crates/audio-context-napi/__test__/audio.test.mjs +++ b/crates/audio-context-napi/__test__/audio.test.mjs @@ -39,7 +39,9 @@ test('renders an oscillator through a gain offline', async () => { assert.equal(rendered.length, 4800); assert.equal(rendered.numberOfChannels, 1); const samples = rendered.channelData(0); - assert.ok(Math.abs(rms(samples.subarray(480)) - 0.5) < 0.02, `rms ${rms(samples)}`); + // The square is the spec's normalized PeriodicWave (peak 1, RMS about 0.83), as in Chrome. + const level = rms(samples.subarray(480)); + assert.ok(Math.abs(level - 0.415) < 0.01, `rms ${level}`); assert.equal(context.state, 'closed'); await assert.rejects(async () => context.startRendering(), /InvalidStateError/); });