Skip to content

Specify getFloatTimeDomainData() encoding range #40544

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Josh-Cena
Copy link
Member

Fix #25571. Wondering if you could advise @padenot—thanks!

@Josh-Cena Josh-Cena requested a review from a team as a code owner July 27, 2025 06:42
@Josh-Cena Josh-Cena requested review from sideshowbarker and removed request for a team July 27, 2025 06:42
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Jul 27, 2025
Copy link
Contributor

@@ -10,6 +10,8 @@ browser-compat: api.AnalyserNode.getFloatTimeDomainData

The **`getFloatTimeDomainData()`** method of the {{ domxref("AnalyserNode") }} Interface copies the current waveform, or time-domain, data into a {{jsxref("Float32Array")}} array passed into it. Each array value is a _sample_, the magnitude of the signal at a particular time.

The waveform is encoded as PCM data, which has a nominal range of -1.0 to 1.0, but values can exceed the range such as when down-mixing stereo to mono.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit of a duplicate of the paragraph above, that says it's a copy of the waveform data. But I looked elsewhere on MDN, and I think we should say that waveform data are nominally in [-1, 1] at least once, e.g. in https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Basic_concepts_behind_Web_Audio_API in which we say it's float 32-bits.

encoded might be a bit strange because the data is copied unaltered (which is important).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re: duplication, "A sample, the magnitude of the signal" sounds a bit less straightforward than "PCM data" to me as an amateur. The guide page you linked doesn't really talk about the data encoding at all, so I think this looks like the best place to put it. Would "represented" be a better word?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AnalyserNode::getFloatTimeDomainData() doesn't specify the encoding of the waveform
2 participants