discordjs / discordjs/opus

Support decoding as float32

Open
#171 1 comment 0 reactions 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
253
Forks
74
PR merge metrics
No merged PRs in 30d

Description

### Feature

Some workloads such as machine learning often require floating-point representations of audio waveforms. While it's technically possible to decode Opus packets to 16-bit PCM and then convert to float32, doing this conversion in JavaScript adds unnecessary overhead that slows down programs. libopus natively supports decoding to float32 through the opus_decode_float function, but this is not yet implemented in the current version. I believe adding this feature would be highly beneficial.

### Ideal solution or implementation

Add binding support for libopus' opus_decode_float function to enable direct float32 output.

### Alternative solutions or implementations

_No response_

### Other context

I've already implemented this locally for my project, verified against PCM-to-float32 conversions with nearly identical results. May I open a PR with this?

Contributor guide

Open the contributing guide

Research direction

Start by locating the native binding entry point for libopus's opus_decode_float function and the existing decode path. Compare the resulting float32 output with the current PCM-to-float32 conversion, then verify that direct float32 decoding works for the supported audio workloads.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, nodejs
Domain
audio-video-rtc
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.