Scale the output of all sound in this sketch
Scaled between 0.0 (silence) and 1.0 (full volume). 1.0 is the maximum amplitude of a digital sound, so multiplying by greater than 1.0 may cause digital distortion. To fade, provide arampTime
parameter. For more complex fades, see the Envelope class.Alternately, you can pass in a signal source such as an oscillator to modulate the amplitude with an audio signal.
How This Works: When you load the p5.sound module, it creates a single instance of p5sound. All sound objects in this module output to p5sound before reaching your computer's output. So if you change the amplitude of p5sound, it impacts all of the sound in this module.
If no value is provided, returns a Web Audio API Gain Node
Syntax
outputVolume(volume, [rampTime], [timeFromNow])
Parameters
volume
Number|Object:
Volume (amplitude) between 0.0 and 1.0 or modulating signal/oscillator
rampTime
Number:
Fade for t seconds
timeFromNow
Number:
Schedule this event to happen at t seconds in the future
Notice any errors or typos? Please let us know. Please feel free to edit lib/addons/p5.sound.js and open a pull request!