This class provides a cross-platform interface for playing short sound samples.
More...
This class provides a cross-platform interface for playing short sound samples.
(Currently implemented for Windows and Linux).
- See also
- For I/O and network transfer of encoded audio, see the ArNetAudio library.
-
ArSoundsQueue
- Note
- Uses an external program to play WAV files on Linux. If an environment variable named PLAY_WAV is set, that program is used, otherwise, 'play' from the 'sox' toolset is used. PLAY_WAV must contain one word (the command; no arguments) A call to playWavFile() will return immediately after 'play' has finished, even though Linux may still be playing back the sound data. In general, this kind of thing is a problem, especially with speech recognition immediately after playing a sound. Ideally, we should be able to truly block until the sound has finished playback. Alas, it is not an ideal world. Another potential pitfall due to the use of an external program invocation: the program you call must not attempt to issue any output. 'play' from the 'sox' toolset automatically supresses normal output if it isn't called from an interactive terminal, but it may still issue some error messages, which will cause it to hang indefinately.
The volume (level) of audio output from a robot is determined by two things: the computer sound device mixer, and also the amplifier which drives the speakers. The computer's mixer can be adjusted through the operating system: on Linux, you can use the 'aumix' program to adjust the Master and PCM levels. On Windows, use the Windows mixer program. If on Linux, ArSoundPlayer also prodives the setVolume() method, which adjusts the volume of the sound before it is played.