TooTallNate / node-wav

`Reader` and `Writer` streams for Microsoft WAVE audio files
MIT License
181 stars 37 forks source link

Seems to be cutting binary words in two. #31

Open joelle-o-world opened 5 years ago

joelle-o-world commented 5 years ago

Sometimes when decoding a wav file stream (32-bit Float PCM little endian) I find I'm getting Buffers which have a length (in bytes) that is not a multiple of four. I don't understand why this is happening as 32 bit floats are each 4 bytes long.

I've tried ignoring these chunks and I have also tried cutting off the remainder bytes and prepending them to the next chunk. Either way I get very strange results further down the pipe-line, sometimes an entire file appears to be silent.

Note: I am first using fluent-ffmpeg to transcode mp3's into WAV format (as a stream), then using this library to strip the wav headers. Afterwards I use Float32Array's to view the PCM data for each audio chunk. Hence how I have noticed the bug.

I have now found I can use FFMPEG to strip the wav headers, which solves the problem. But I thought I should also flag it here.

All best, Joel