GNU Info

Info Node: (elisp)Sound Output

(elisp)Sound Output


Next: Special Keysyms Prev: Terminal Output Up: System Interface
Enter node , (file) or (file)node

Sound Output
============

   To play sound using Emacs, use the function `play-sound'.  Only
certain systems are supported; if you call `play-sound' on a system
which cannot really do the job, it gives an error.  Emacs version 20 and
earlier did not support sound at all.

   The sound must be stored as a file in RIFF-WAVE format (`.wav') or
Sun Audio format (`.au').

 - Function: play-sound sound
     This function plays a specified sound.  The argument, SOUND, has
     the form `(sound PROPERTIES...)', 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:

    `:file FILE'
          This specifies the file containing the sound to play.  If the
          file name is not absolute, it is expanded against the
          directory `data-directory'.

    `:data DATA'
          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.

    `:volume VOLUME'
          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.

    `:device DEVICE'
          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-sound' calls the
     functions in the list `play-sound-functions'.  Each function is
     called with one argument, SOUND.

 - Function: play-sound-file file &optional volume device
     This function is an alternative interface to playing a sound FILE
     specifying an optional VOLUME and DEVICE.

 - Variable: play-sound-functions
     A list of functions to be called before playing a sound.  Each
     function is called with one argument, a property list that
     describes the sound.


automatically generated by info2www version 1.2.2.9