You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the feature
Add a detune AudioParam to the ConstantSourceNode
Is there a prototype?
This could be prototyped with an AudioWorklet, but I didn't do that.
Describe the feature in more detail
The AudioBufferSourceNode and OscillatorNode both have a detune parameter that modifies the playbackRate, and frequency, respectively.
Adding one to the ConstantSourceNode seems natural since these other source nodes have one.
This would result in a computed offset = offset * pow(2, detune / 1200).
This would be useful (as mentioned recently in the WebAudio slack channel today) to do some processing for an oscillator. The example was an LFO with a frequency of 500 Hz feeding an oscillator with a frequency of 250 Hz. The LFO would cause negative frequencies, but the user wanted the sum to be clipped to 0.
This is possible to simulate by feeding the LFO to the offset param of the ConstantSourceNode where the offset is set to the oscillator frequency. The output is then sent to the frequency AudioParam of the oscillator with the oscillator frequency set to zero. To get the desired clipping, insert a WaveShaperNode after the constant source.
And instead of modulating the oscillator frequency, you'd modulate the constant source node offset. But if you also want to modulate the oscillator detune, you can't model that with this structure. But if you had a detune for the constant source, this would work just fine.
The text was updated successfully, but these errors were encountered:
The computedOffset is offset * 2^(detune/1200), pretty much like how the computedOscFrequency is derived from the frequency and detune values for an oscillator.
Describe the feature
Add a
detune
AudioParam to the ConstantSourceNodeIs there a prototype?
This could be prototyped with an AudioWorklet, but I didn't do that.
Describe the feature in more detail
The
AudioBufferSourceNode
andOscillatorNode
both have adetune
parameter that modifies theplaybackRate
, andfrequency
, respectively.Adding one to the
ConstantSourceNode
seems natural since these other source nodes have one.This would result in a computed offset =
offset * pow(2, detune / 1200)
.This would be useful (as mentioned recently in the WebAudio slack channel today) to do some processing for an oscillator. The example was an LFO with a frequency of 500 Hz feeding an oscillator with a frequency of 250 Hz. The LFO would cause negative frequencies, but the user wanted the sum to be clipped to 0.
This is possible to simulate by feeding the LFO to the offset param of the ConstantSourceNode where the offset is set to the oscillator frequency. The output is then sent to the frequency AudioParam of the oscillator with the oscillator frequency set to zero. To get the desired clipping, insert a WaveShaperNode after the constant source.
And instead of modulating the oscillator frequency, you'd modulate the constant source node offset. But if you also want to modulate the oscillator detune, you can't model that with this structure. But if you had a detune for the constant source, this would work just fine.
The text was updated successfully, but these errors were encountered: