for the last two weeks, I tried to record audio and change its codec in realtime in a browser using javascript, I used script processor in all my test cases to record audio in realtime, but on the other hand, I tried too many libraries and packages to encode and decode the audio, but none of them worked, there was always a problem, sometimes the encoder couldn't be able to recognize the audio codec, and sometimes the decoder wasn't able to decode the encoded data.
I made something like this in c# with PvRecodrder which records audio as a short[]
which actually is PCM
buffer that consists of unsigned bytes.
However the channel data of script processor is float32[]
which is so different or even weird in comparison, its value ranges from very small negative numbers to positive numbers around one.
Now I'm just wondering what this channel data actually is?
what is the type and codec of this float32[]
?
.wav
, .pcm
or what?
The channel data of an AudioBuffer
typically contains values between -1 and 1. But since the values are stored in a Float32Array
they could also be much larger or smaller. However playing such an AudioBuffer
with values outside of the nominal range will likely result in audible distortion.