AUDIO(3)                                                 AUDIO(3)

     NAME
          audio - audio device

     SYNOPSIS
          bind -a #A /dev
          /dev/audio
          /dev/audioctl
          /dev/audiostat
          /dev/volume

     DESCRIPTION
          The audio device serves a one-level directory, giving access
          to the stereo audio ports.  Audio is the data file, which
          can be written for audio playback.  Audio data is a sequence
          of stereo samples, left sample first.  Each sample is a 16
          bit little-endian two's complement integer; the default sam-
          pling rate is 44.1 kHz.

          The length of the audio file as returned by stat(2) repre-
          sents the number of bytes buffered for output.

          Audioctl is driver specific control file and left undocu-
          mented here.

          Audiostat is a read only status file. The first line has a
          length of 32 bytes including the newline and starts with the
          string bufsize followed by the preferred write unit (in
          bytes) and the string buffered followed by the number of
          bytes currently queued for output. The numbers are decimal
          and right-padded with spaces to fit.  After this fixed
          header, the contents of the file is driver specific.

          Volume is the control file associated with the audio port.
          Each source has an associated stereo volume control, ranging
          from 0 (quiet) to 100 (loud). In addition, there are con-
          trols for the sampling rate, latency control and for any
          tone controls.  Reads return lines of the form

               source left right

          or

               source value

          Valid sources depend on the particular audio device, though
          all devices have an audio stereo source, which controls the
          output volume from the D/A converter.  Values for speed set
          the sampling frequency of the audio device and delay limits
          the audio data output buffering to a number of samples.

     AUDIO(3)                                                 AUDIO(3)

          Writes accept the same format except that for stereo sources
          left and right can be abbreviated to a single value if both
          should be set the same.

     SOURCE
          /sys/src/9/port/devaudio.c

     SEE ALSO
          nusb(4)