Closed dy closed 5 years ago
I saw that in your package and I thought it was really cool! I also had thought about a hypothetical atype
package today because of that, but I figured you'd say something about it. Great idea. :smile:
@jamen I guess we may need audio-convert package then, to be able to convert AudioBuffer ←→ *, like pcm-convert extended to AudioBuffers, channels remixing and resampling (todo).
Alright, audio-format package. Hope it will be as useful as good the idea.
In pcm-convert stumbled upon pretty useful and easy to read/write format notation, that turns out also to be pretty performant. That can be extended to any audio-* component and solve the problem of indicating desired data input/output format.
That is just a plain string with tags, like so:
Note how natural they are to read.
To parse that, we just split by
\s+
and match keywords. For sample rate we can use sample-rate package. For custom formats, like 5 channels, we can use an old-school object{channels: 5, ...}
.That allows to shrink API of many components to just:
With that can easily use all
audio-*
components with any thinkable audio data type.