This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

This sketch demonstrates how to use the getVolume and setVolume methods of a Controller object. The class used here is an AudioOutput but you can also get and set the volume of AudioSample, AudioSnippet, AudioInput, and AudioPlayer objects. getVolume and setVolume will get and set the volume of the DataLine that is being used for input or output, but only if that line has a volume control. A DataLine is a low-level JavaSound class that is used for sending audio to, or receiving audio from, the audio system. You will notice in this sketch that you will hear the volume changing (if it's available) but you will not see any difference in the waveform being drawn. The reason for this is that what you see in the output's sample buffers is what it sends to the audio system. The system makes the volume change after receiving the samples.

Source code: getSetVolume waveform

Built with Processing