Skip to content
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

Opus encoders? #113

Open
weaversam8 opened this issue Oct 31, 2024 · 1 comment
Open

Opus encoders? #113

weaversam8 opened this issue Oct 31, 2024 · 1 comment

Comments

@weaversam8
Copy link

Hi Ethan!

This project seems to be focused primarily on decoding only- would you accept PRs that added support for encoding some of these codecs (specifically Opus/Ogg Opus)? Is focusing this library on decoders the goal, or is encoding just one of those harder problems?

Related: are there any existing WASM libraries folks use with this implementation to encode opus/opus ogg audio from the browser?

@eshaz
Copy link
Owner

eshaz commented Nov 1, 2024

Hello,

This is a good question. Right now, the focus of this library is solely on decoding; however, I'm not opposed to considering this. I don't have a use case right now for encoding audio in a browser, which is the primary reason it's not here.

Encoding shouldn't be all that much more effort to add. The build infrastructure and interface patterns for decoding established in this library could be applied to encoding, probably without too many issues. The input to an encoder is a little more difficult to pin down. Perhaps it should take in the same types that the decoders return (i.e. Float32 arrays for each audio channel). If encoding was added, it would need to be released as separate packages from the decoders, i.e. opus-encoder, or flac-encoder, since I would like to keep the decoders as small as possible for web use.

I am planning on adding a PCM decoder, which would be a WASM implementation that converts Wav, and maybe other formats to Float32 arrays for the WebAudio api. If encoding was added, this PCM decoder would make it possible to encode from Wav to Opus. This would be interesting to be able to compose the decoders and encoders like this.

<wav data> -> [pcm-decoder] -> <float 32 arrays> -> [opus-encoder] -> <opus data> or
<flac data> -> [flac-decoder] -> <float 32 arrays> -> [opus-encoder] -> <opus data>

Obviously, I'd have to rename the repo if encoders are added :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants