I am exploring the use of a custom waveform with a WebAudio OscillatorNode
. While I have basic programming skills, I am struggling with the mathematical aspects of audio synthesis.
Waveforms are essentially functions, which means I can sample them. However, when it comes to using the
OscillatorNode.createPeriodicWave
method, I need to provide two arrays (real
and imag
) that represent the waveform in the frequency domain.
The AnalyserNode
has FFT methods for generating an array in the frequency domain, but it requires input from another node which complicates things.
I am unable to figure out how to correctly input a wavetable into the AnalyserNode
, and even if I could, it only provides a single array while
OscillatorNode.createPeriodicWave
needs two arrays.
TLDR In simple terms, how can I determine the necessary arguments for
OscillatorNode.createPeriodicWave
when starting with a periodic function?