Skip to content

Waveform is not bandlimited #2

Description

@rsimmons

The generated pulse waveform is not "bandlimited". This may require major changes to fix, but it might be worth adding a disclaimer in the docs at least, since it means there will be audible artifacts.

All the waveforms generated by the builtin Web Audio OscillatorNode are bandlimited (per the spec). The relevant part of the spec explains:

Mathematically speaking, a continuous-time periodic waveform can have very high (or infinitely high) frequency information when considered in the frequency domain. When this waveform is sampled as a discrete-time digital audio signal at a particular sample-rate, then care must be taken to discard (filter out) the high-frequency information higher than the Nyquist frequency before converting the waveform to a digital form. If this is not done, then aliasing of higher frequencies (than the Nyquist frequency) will fold back as mirror images into frequencies lower than the Nyquist frequency. In many cases this will cause audibly objectionable artifacts. This is a basic and well understood principle of audio DSP.

One way to generate a bandlimited pulse wave is to subtract two bandlimited sawtooth waves, so that might be a way to fix it if you were so inclined.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions