I want to modulate the square waveform of the Web Audio API OscillatorNode by connecting to other OscillatorNodes. But I can not find the parameter in the AudioParams.

Is this possible at all or is there a workaround?

I thought about creating a "custom" wavetable Oscillator with the "audioContext.createWaveTable()" function. This wavetable could contain different pulses with sweeping pulsewidths.

But than again I have no idea how to control the position of the wavetable pointer via AudioParams to modulate the sweep.

Is this possible or do I have a fundamental misunderstanding how this API works?

有帮助吗?

解决方案 2

You can't, I'm afraid. We don't have pulse-width modulation in the oscillator yet. You'll have to do it by hand in a script processor node.

其他提示

I found a workaround to the PWM problem here: http://musicdsp.org/archive.php?classid=1#8

"Take an upramping sawtooth and its inverse, a downramping sawtooth. Adding these two waves with a well defined delay between 0 and period (1/f) results in a square wave with a duty cycle ranging from 0 to 100%."

The inverse sawtooth can be done with a GainNode with gain value -1.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top