Skip to content
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

Unclearness regarding the DC-offset in PeriodicWave #2530

Open
dd-pardal opened this issue Nov 29, 2022 · 2 comments
Open

Unclearness regarding the DC-offset in PeriodicWave #2530

dd-pardal opened this issue Nov 29, 2022 · 2 comments

Comments

@dd-pardal
Copy link

dd-pardal commented Nov 29, 2022

Describe the issue

Section 1.28.3.1 states that the element of the [[real]] array at index 0 is the DC-offset but the formula for the waveform in section 1.28.4 doesn't depend on it. Is this value being purposefully ignored? If so, adding a note about it in the spec would be helpful.

Where Is It

Section 1.28.

Additional Information

Firefox and Chromium seem to ignore this value.

@padenot
Copy link
Member

padenot commented Feb 23, 2023

If I remember correctly, being able to DC-offset is intended, back when the PeriodicWave object was not really specified. We when wrote the formula, but must have made a mistake there, dropping the DC-offset part.

Chrome and Firefox currently ignore the value (specifically, set the first real and imaginary coefficient to 0 before doing the inverse Fourier transform), but could use it.

It seems somewhat useful for control signal at least (where there's no dynamic range concerns, and can go outside of [-1.0, 1.0]).

@padenot
Copy link
Member

padenot commented Aug 10, 2023

This is correctly specified in https://webaudio.github.io/web-audio-api/#PeriodicWave-constructors (step 3.), and we can't change it now. Authors can use the ConstantSourceNode to add a DC-offset, and we'll change the spec text to make it clear that this cannot produce a DC-Offset.

@padenot padenot self-assigned this Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants