To play sound using Emacs, use the function
certain systems are supported; if you call
play-sound on a
system which cannot really do the job, it gives an error.
The sound must be stored as a file in RIFF-WAVE format (‘.wav’) or Sun Audio format (‘.au’).
This function plays a specified sound. The argument, sound, has the form
...), where the properties consist of alternating keywords (particular symbols recognized specially) and values corresponding to them.
Here is a table of the keywords that are currently meaningful in sound, and their meanings:
- This specifies the file containing the sound to play. If the file name is not absolute, it is expanded against the directory
- This specifies the sound to play without need to refer to a file. The value, data, should be a string containing the same bytes as a sound file. We recommend using a unibyte string.
- This specifies how loud to play the sound. It should be a number in the range of 0 to 1. The default is to use whatever volume has been specified before.
- This specifies the system device on which to play the sound, as a string. The default device is system-dependent.
Before actually playing the sound,
play-soundcalls the functions in the list
play-sound-functions. Each function is called with one argument, sound.
This function is an alternative interface to playing a sound file specifying an optional volume and device.