문제

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