w3c / w3c/webcodecs

Clarify AudioEncoderConfig.sampleRate semantics

Open Beginner friendly
#370 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

editorial
Dominant language
HTML
Stars
1.3k
Forks
194
Avg merge
1d 13h
Merged PRs (30d)
3

Description

Semantics of AudioEncoderConfig.sampleRate are not that "we will encode with this sampleRate", but rather: "this is the sampleRate of our input". We may resample to a different rate where required by underlying encoder libraries. For example libopus only supports a handful of rates.

We should update the dict-member dfn to reflect this.

For concerns about resampling's affect on quality, please see
https://wiki.xiph.org/OpusFAQ#But_won.27t_the_resampler_hurt_the_quality.3F_Isn.27t_it_better_to_use_44.1_kHz_directly.3F

Aside: Chrome has a bug where AudioEncoder may emit an AudioDecoderConfig with incorrect sampleRate.
https://bugs.chromium.org/p/chromium/issues/detail?id=1254496

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the AudioEncoderConfig.sampleRate dictionary-member definition in the WebCodecs specification and compare its wording with the issue's input-sample-rate semantics. Update the definition to clarify that resampling may occur for underlying encoder constraints, then check the surrounding specification text for consistency.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
api, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.