From 89f0e9fc9e788947b1f0e8068f4d33ffbafe05f7 Mon Sep 17 00:00:00 2001 From: perholje Date: Wed, 27 May 2015 13:26:19 +0200 Subject: [PATCH] fixed byte rate RIFF header value The byte rate calculation was hard-coded to 2 channels. Corrected this to include number of channels in the calculation. --- recorderWorker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recorderWorker.js b/recorderWorker.js index a24bb45d..9b268a0a 100644 --- a/recorderWorker.js +++ b/recorderWorker.js @@ -130,8 +130,8 @@ function encodeWAV(samples){ view.setUint16(22, numChannels, true); /* sample rate */ view.setUint32(24, sampleRate, true); - /* byte rate (sample rate * block align) */ - view.setUint32(28, sampleRate * 4, true); + /* byte rate (sample rate * channels * bytes per sample) */ + view.setUint32(28, sampleRate * numChannels * 2, true) /* block align (channel count * bytes per sample) */ view.setUint16(32, numChannels * 2, true); /* bits per sample */