wavefile
wavefile copied to clipboard
Do less things: remove base64 stuff
You got a couple of ways to load wav files...
- fromBase64
- fromDataURI
- fromBuffer
and also exporting them:
- toBuffer
- toBase64
- toDataURI
Base64 isn't a good container cuz it takes up way more space, a Uint8Array is way better.
- if the intention is to play something in a
<audio src="">
element then it's better to create a Object URL from a blob - if the intention is to upload stuff via a api using json, then don't there are better ways to send of binary data + json
encourage base64 today isn't so good. it's better to just have one way to solve it so that less code can be shipped and bundled.
also don't know how i feel about the name toBuffer
and fromBuffer
the name mostly implies that it is dealing with NodeJS buffers. how about to/fromUint8array ?