TooTallNate/node-wav — pull request #2 by naxxfish (2013-05-01 09:02:56+00:00)
Title: Cart Chunk and BWF support

Hi!

Here's the support for cart/bext chunks in Reader(). I've yet to refactor the Writer class, to cope with extra subchunks, which is a little tricker as we'd need to define how the fields are set (I'm guessing the opts that are passed in the constructor, like those in the `fmt ` header). I've also written in a new test, and an example file containing both of these chunks (CC_0101.wav)

One noteworthy change to the behaviour - if Reader encounters an unknown chunk ID, it won't error as it did before - it will emit an `"unknown"` event with the raw buffer data for that chunk. I needed this for my application - and not knowing about a chunk isn't technically an error, so it's convenient to have the logical separation between actual errors and things we just don't understand.

Hopefully, all this will make it easier to support other subchunk types in the future - I have my eye on adding `"iXML"` support too.

I have added one little utility function into reader.js - but this might be better incorporated into the Reader class itself - although there's no real need to.

Hope it's OK!

Cheers,