-
Notifications
You must be signed in to change notification settings - Fork 22.9k
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
Conversation
Preview URLs (comment last updated: 2025-08-12 01:34:36) |
@@ -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. |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Josh-Cena I don’t have any special insight to offer here, so I’m going ahead and marking it approved, but leaving it unmerged and up to you whether to wait for resolution of the review comment (or else leave that as an issue for a follow-up PR)
files/en-us/web/api/analysernode/getfloattimedomaindata/index.md
Outdated
Show resolved
Hide resolved
@padenot PTAL, thanks! |
Looks good, thanks! |
Thanks both :) |
Fix #25571. Wondering if you could advise @padenot—thanks!