w3c / w3c/webcodecs

copyTo from planar to interleave should copy / convert all channels

Open
#819 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It is useful to copy all frames of an AudioData containing planar data to a buffer containing interleaved data, in one go. However, planeIndex is required in copyTo AudioDatacopyToOptions, so one has to write:

    let data = new AudioData({ ... });
    let destInterleaved = new Int16Array(...);
    data.copyTo(destInterleaved, {planeIndex: 0, format: "s16"});

and this appears to copy all channels in Chrome (and soon, Firefox), despite the planeIndex:0 bit. I think it's good behaviour and we should clarify this in the spec.

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 by reading the WebCodecs specification sections defining AudioData.copyTo and AudioDataCopyToOptions, focusing on planeIndex when converting planar data to interleaved output. Done means the specification clearly states whether planeIndex: 0 copies or converts all channels, consistent with the behavior described for Chrome and Firefox.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.