discordjs / opus

Native opus bindings for node
MIT License
188 stars 53 forks source link

OpusMultistreamEncoder support #94

Closed Starkrights closed 2 years ago

Starkrights commented 2 years ago

Is your feature request related to a problem? Please describe. This all stems from wanting to combine/overlay two unique Opus Streams into one, to then provide to discordjs' VoiceConnection#play(). Ideally, I'd like to be able to use the OpusMSEncoder/Decoder functionality provided in libopus 1.3, but it appears that this addon only provides bindings for the base OpusEncoder.

Describe the ideal solution An additional set of bindings / package export to provide NodeJS native bindings for the libopus OpusMSEncoder class / opus_multistream_encoder_create() function as described in the libopus docs.

Describe alternatives you've considered I have searched far through the internet for methods to merge/overlay Opus Streams, and it's incredibly baren & tumbleweed-ridden. I've looked through:

As much as I'm really unsure that this functionality doesn't exist somewhere, I'm at the conclusion that for some reason it just doesn't- at least not in a easily nodejs-accessible manner

Additional context All that said, I have almost no idea what I'm doing in this regard, and may be completely overlooking glaringly obvious reasons as to why this hasn't been done anywhere yet. I'm making this request under the assumption that it's valid & attainable. I'd like to think I'm a competent enough ES/Node programmer, but C is foreign to me, not even to mention the concept of creating bindings for a c library. (All of this interests me though, and I'll probably start looking into it myself shortly anyways)

Starkrights commented 2 years ago

This feature request was misinformed. The MultiStream API / encoder suite from libopus does not provide the functionality I described and is more/less useless in a discordjs based use case. Use of the libopus Repacketizer appears to be what I'm looking for, though the libopus docs are very, very slightly unclear regarding the resulting packet.

Having dived into c++, this wrapper, the libopus library, and its docs, I've forked the repo & have begun slowly working on vetting this functionality. I will shortly close this issue, and create another properly-oriented & much less exasperated(⌒_⌒;) issue- which, with any luck, will eventually turn into a PR including the functionality.