AUDIO(1)                                                 AUDIO(1)

          mp3dec, mp3enc, oggdec, oggenc, flacdec, flacenc, sundec,
          wavdec, pcmconv, mixfs - decode and encode audio files

          audio/mp3dec [ -s seconds ] [ -d ]
          audio/oggdec [ -s seconds ]
          audio/flacdec [ -s seconds ]
          audio/wavdec [ -s seconds ]

          audio/mp3enc [ -hprv ] [ -b bitrate ] [ -B bitrate ] [ -m
          mode ] [ -q q ] [ -s sfreq ] [ -V q ] [ long or silly
          options ]
          audio/flacenc [ -i fmt ] [ -l compresslevel ] [ -P padding ]
          [ -T field=value ]

          audio/pcmconv [ -i fmt ] [ -o fmt ] [ -l length ]

          audio/mixfs [ -D ] [ -s srvname ] [ -m mtpt ] [ /dev/audio ]

          These programs decode and encode various audio formats from
          and to 16-bit stereo PCM (little endian). The decoders read
          the compressed audio data from standard input and produce
          PCM on standard output at a sampling frequency of 44.1KHz.

          Mp3dec decodes MPEG audio (layer 1, 2 and 3). The -d option
          enables debug output to standard error.  Oggdec, flacdec,
          sunwdec and wavdec are like mp3dec but decode OGG Vorbis,
          FLAC lossless audio, Sun audio and RIFF wave.

        Decoding options
          -s seconds   seek to a specific position in seconds before

          The encoders read PCM on standard input and produce com-
          pressed audio on standard output.

          Flacenc, oggenc and mp3enc produce FLAC, OGG Vorbis and MP3
          audio. For mp3enc, the MP3 file will use `constant bit-rate'
          (CBR) encoding by default, but that can be changed via --abr
          (average bitrate desired, ABR) or -v (variable bitrate,

          Oggenc accept raw PCM in the same byte order as /dev/audio
          (little-endian), while mp3enc -r expects big-endian.
          Flacenc by default expects raw PCM in the same format as

     AUDIO(1)                                                 AUDIO(1)

          /dev/audio, but also supports signed integer samples of bit
          widths 4 to 32, either little- or big-endian, one to eight
          channels and arbitrary samplerates, see -i option of

        Encoding options
          -b   set minimum allowed bitrate in Kb/s for VBR, default
               32Kb/s.  For CBR, set the exact bitrate in Kb/s, which
               defaults to 128Kb/s.
          -B   set maximum allowed bitrate in Kb/s for VBR, default
          -h   same as `-q 2'.
          -m   mode may be (s)tereo, (j)oint, (f)orce or (m)ono
               (default j).  force forces mid/side stereo on all
          -p   add CRC error protection (adds an additional 16 bits
               per frame to the stream).  This seems to break play-
          -q   sets output quality to q (see -V).
          -r   input is raw pcm
          -s   set sampling frequency of input file (in KHz) to sfreq,
               default is 44.1.
          -v   use variable bitrate (VBR) encoding
          -V   set quality setting for VBR to q. Default q is 4; 0
               produces highest-quality and largest files, and 9 pro-
               duces lowest-quality and smallest files.

        Long options
          --abr bitrate      sets average bitrate desired in Kb/s,
                             instead of setting quality, and generates
                             ABR encoding.
          --resample sfreq   set sampling frequency of output file (in
                             KHz) to sfreq, default is input sfreq.
          --mp3input input   is an MP3 file

        Silly options
          -f        same as `-q 7'.  Such a deal.
          -o        mark as non-original (i.e. do not set the original
          -c        mark as copyright
          -k        disable sfb=21 cutoff
          -e emp    de-emphasis n/5/c (default n)
          -d        allow channels to have different blocktypes
          -t        disable Xing VBR informational tag
          -a        autoconvert from stereo to mono file for mono
          -x        force byte-swapping of input (see dd(1) instead)
          -S        don't print progress report, VBR histograms
          --athonly only use the ATH for masking
          --nohist  disable VBR histogram display
          --voice   experimental voice mode

     AUDIO(1)                                                 AUDIO(1)

          Pcmconv is a helper program used to convert various PCM sam-
          ple formats. The -i and -o options specify the input and
          output format fmt of the conversion.  Fmt is a concatenated
          string of the following parts:

          s#   sample format is little-endian signed integer where #
               specifies the number of bits

          u#   unsigned little-endian integer format

          S#   signed big-endian integer format

          U#   unsigned big-endian integer format

          f#   floating point format where # has to be 32 or 64 for
               single- or double-precision

          a8   8-bit a-law format

          µ8   8-bit µ-law format

          c#   specifies the number of channels

          r#   gives the samplerate in Hz

          The program reads samples from standard input converting the
          data and writes the result to standard output until it
          reached end of file or, if -l was given, a number of length
          bytes have been consumed from input.

          Mixfs is a fileserver serving a single audio file which
          allows simultaneous playback of audio streams. When run, it
          binds over /dev/audio and mixes the audio samples that are
          written to it.  A service name srvname can be given with the
          -s option which gets posted to /srv.  By default, mixfs
          mounts itself on /mnt/mix and then binds /mnt/mix/audio and
          /mnt/mix/volume over /dev.  /dev/volume from the parent
          namespace is proxied with an additional control "mix" which
          is used to set the output volume of the mixer.  Another
          additional control "dev" can be used to switch between audio
          devices.  Mixfs will resample incoming audio to the format
          of the audio device output if it does not match the default
          (s16c2r44100).  An alternative mountpoint mtpt can be speci-
          fied with the -m option.  The -D option causes 9p debug mes-
          sages to be written to file-descriptor 2.

          Play back an `.mp3'

               audio/mp3dec <foo.mp3 >/dev/audio

     AUDIO(1)                                                 AUDIO(1)

          Encode a `.wav' file as highest-quality MP3.

               audio/mp3enc -q 0 -b 320 <foo.wav >foo.mp3

          Create a fixed 128Kb/s MP3 file from a `.wav' file.

               audio/mp3enc -h <foo.wav >foo.mp3

          Streaming from stereo 44.1KHz raw PCM data, encoding mono at
          16KHz (you may not need dd):

               dd -conv swab | audio/mp3enc -a -r -m m --resample 16 -b 24


          play(1), zuke(1)

          Pcmconv first appeared in 9front (December, 2012).  Mixfs
          first appeared in 9front (December, 2013).  Flacenc first
          appeared in 9front (January, 2021).