Package processing.sound
Class Sound
java.lang.Object
processing.sound.Sound
This class can be used for configuring the Processing Sound library.
The Sound class allows for configuring global properties of the sound
library's audio synthesis and playback, such as the output device, sample
rate or global output volume.
Information on available input and output devices can be obtained by calling
Sound.list()
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
static int
static String[]
static AudioDeviceManager
static SynthesisEngine
Direct access to the underlying JSyn SynthesisEngine object.static int
inputDevice
(int deviceId) Choose the device (sound card) which should be used for grabbing audio input using AudioIn.static int
inputDevice
(String deviceName) static String[]
list()
static String[]
list
(boolean printAll) static String[]
Print and return information on available audio devices and their number of input/output channels.static int
outputDevice
(int deviceId) Choose the device (sound card) which the Sound library's audio output should be sent to.static int
outputDevice
(String deviceName) static void
static int
static int
sampleRate
(int sampleRate) Get or set the internal sample rate of the synthesis engine.static void
status()
Prints information about the sound library's current memory and CPU usage to the console.static void
verbose
(boolean verbose) static void
volume
(float volume) Set the overall output volume of the Processing sound library.
-
Constructor Details
-
Sound
-
Sound
- Parameters:
parent
- typically use "this"sampleRate
- the sample rate to be used by the synthesis engine (default 44100)outputDevice
- the device id of the sound card that sound should be played oninputDevice
- the device id of the sound card from which sound should be capturedvolume
- the overall output volume of the library (default 1.0)
-
-
Method Details
-
getAudioDeviceManager
-
deviceNames
-
list
Print and return information on available audio devices and their number of input/output channels. Under normal circumstances you will not want to call Sound.list() in your actual sketch code, but only for testing to figure out which sound cards are available on a new system and how to select them. However, if the order of devices on your system is prone to fluctuate from reboot to reboot, you can also use the device name array returned by the function to automate device selection by name in your own code.- Parameters:
printAll
- whether to include all devices in the output listing. By default, sound devices without any inputs or outputs are omitted from the output listing for clarity. Pass `true` here if you want a complete list of all devices (for debugging).filter
- only list audio devices whose device name contains this string- Returns:
- an array giving the names of all audio devices available on this computer
-
list
-
list
-
sampleRate
public static int sampleRate() -
sampleRate
public static int sampleRate(int sampleRate) Get or set the internal sample rate of the synthesis engine.- Parameters:
sampleRate
- the sample rate to be used by the synthesis engine (default 44100)- Returns:
- the internal sample rate used by the synthesis engine
-
inputDevice
public static int inputDevice(int deviceId) Choose the device (sound card) which should be used for grabbing audio input using AudioIn. Note that this setting affects the choice of sound card, which is not necessarily the same as the number of the input channel. If your sound card has more than one input channel, you can specify which channel to use in the constructor of the AudioIn class.- Parameters:
deviceId
- the device id obtained from Sound.list()deviceName
- the device name obtained from Sound.list()- See Also:
-
inputDevice
-
outputDevice
public static int outputDevice(int deviceId) Choose the device (sound card) which the Sound library's audio output should be sent to. The output device should support stereo output (2 channels).- Parameters:
deviceId
- the device id obtained from Sound.list()deviceName
- the device name obtained from Sound.list()- See Also:
-
outputDevice
-
defaultOutputDevice
public static int defaultOutputDevice() -
defaultInputDevice
public static int defaultInputDevice() -
volume
public static void volume(float volume) Set the overall output volume of the Processing sound library.- Parameters:
volume
- the desired output volume, normally between 0.0 and 1.0 (default is 1.0)
-
getSynthesisEngine
Direct access to the underlying JSyn SynthesisEngine object. Use at your own risk.- See Also:
-
status
public static void status()Prints information about the sound library's current memory and CPU usage to the console. -
verbose
public static void verbose(boolean verbose) -
printConnections
public static void printConnections()
-