-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: ability to decode back to buffers #12
Comments
I had the decode audio logic in the lib, but decided to remove it, because:
You can reference the decoder code here Alternatively, perhaps there is a way to get the PCM out of an audio tag? |
Makes perfect sense that you removed it :) In my case I can't use the One question from me: the |
To get the packets out of an ogg file, you will need to parse each page, and then parse the segment table to get the packet boundaries. I've seen some libs around which can do this. I think speex.js has something and perhaps aurora.js as well. https://github.com/jpemartins/speex.js/blob/master/src/ogg.js |
If you can follow the logic after encode(), you need to do the same, but backwards. |
I have created a new branch for opus only operation. I have included a decoder for completeness. It has not been documented or thoroughly tested, but the happy path is working. Check it out if you are still in need. |
Merged decoder which allows decoding back to buffers. |
Oh boy, I'm only just catching up on this. It's super that you broke them out to two separate scripts - thank you! |
@chris-rudmin Any chance you could write a little documentation on how to use the decoding script? I'm trying to use your excellent library to record audio for Twilio, which only accepts mp3, wav, aiff or ulaw, but unfortunately not ogg/opus. So I can either store the files as ogg on the server and transcode with ffmpeg before sending to Twilio, or get access to the buffers after downsampling and save them as wav. |
You create a worker with the decoder and then pass it a typed array with your encoded data along with the decode command. Sounds like it might be easier to use the original recorder is and record wav. |
I'm working on at a bit of code which stores generated audio files in IndexedDB, but also uses the Web Audio API as well.
As it stands your version of Recorderjs is epic and works amazingly well, but because Chrome's implementation doesn't support Opus in
decodeAudioData
, when I pass an ogg file in it fails to decode. I can see from the emscriptened libopus that the decode functionality is there, but that Recorderjs doesn't have a correspondingdecode
call. Is there any chance you can add it? I'd do a PR, but I'm not quite sure how to work with the emscriptened code, I'm afraid :-/The text was updated successfully, but these errors were encountered: