Search code examples
audiosignal-processingfftweb-audio-api

Unexpected fundamental hum in audio demonstration


I am trying to create a spectral audio demonstration using the web audio API's periodicWave generator. Which can be seen here: http://orazdow.github.io/bars/

Whenever I have a fair amount of partials turned on the sound is dominated by a loud buzzy hum at the fundamental.

I wasn't expecting this and would like to understand the cause. I was hoping to generate something similar to Pure Data's fourier resynthesis example, which can be seen here at section 3.8.2, but with pure tones rather than filtered noise. I am only writing values to the real part array.

The dominating tone was not what I expected or wanted, so I am hoping to understand what is causing it.


Solution

  • I think the oscillators are doing what's intended. If you have a flat spectrum (which is what you have in your demo by default except it's band-limited), the signal should be approximately a pulse train (periodic signal of impulses).

    I think if you create such a periodic sequence of impulses and listen, it will sound like the oscillators.