I am trying to simulate an ocean sound automatically on Pure Data. So far I have accomplished to achieve a very basic sound by filtering some noise with a [bp~]. I have seen that the best range of the cut-off frequency is from 300 to 500 Hz, therefore I would like to have a horizontal slider [hsl] that goes from 300 to 500 and back, automatically and on a loop until I tell it to stop. (I have already assigned the range (300,500) to the slider, I only need to control it automatically now). I have tried with [osc~] but it won't work because the slider is not an audio element and the [osc~]'s output is an audio signal. In the picture I show what I have this far:
So how can I do it to control the slider automatically without having to vary it manually? So far everything works as I want it to, but I need the slider to increase and decrease periodically to simulate the sea waves.
If your question would simply be: How do I automate a slider? The answer would be to look at the [line] object. Line interpolates from a current value to a target value in a given time.
(Note: When controlling signals, we use [line~] instead.)
However, your goal is the simulation of a sea shore wave. In the above slider automation are two issues: 1.) we are operating in control data rate as opposed to signal data rate and 2.) we would want an ease-in and ease-out of the ramping. An oscillator will solve both of the problems at the same time.
(Note: Omitted here for simplification is that the amplitude control should not be linear due to perception of volume not being equal to power increase.)
Since we don't want to change the amplitude only, but the timbre (cut-off frequency of the bandpass) we want to use an sine function we can run a counter through to achieve the desired output range animation including easing-in and -out. Note: The slider acts merely as a visualization in this patch.
(glitch in animation due too misaligned loop-point)