index.txt
AUDIO(1) General Commands Manual AUDIO(1) NAME mp3dec, mp3enc, oggdec, oggenc, flacdec, sundec, wavdec, pcmconv, mixfs - decode and encode audio files SYNOPSIS audio/mp3dec [ -d ] audio/oggdec audio/flacdec audio/wavdec audio/sundec audio/oggenc audio/mp3enc [ -hprv ] [ -b bitrate ] [ -B bitrate ] [ -m mode ] [ -q q ] [ -s sfreq ] [ -V q ] [ long or silly options ] audio/pcmconv [ -i fmt ] [ -o fmt ] [ -l length ] audio/mixfs [ -D ] [ -s srvname ] [ -m mtpt ] DESCRIPTION These programs decode and encode various audio formats from and to 16-bit stereo PCM (little endian). The decoders read the compressed au‐ dio 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 de‐ bug output to standard error. Oggdec, flacdec, sunwdec and wavdec are like mp3dec but decode OGG Vorbis, FLAC lossless audio, Sun audio and RIFF wave. The encoders read PCM on standard input and produce compressed audio on standard output. Oggenc and mp3enc produce 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, VBR). Oggenc accepts raw PCM in the same byte order as /dev/audio (little-en‐ dian), t mp3enc -r expects big-endian. 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 256Kb/s. -h same as -m mode may be (s)tereo, (j)oint, (f)orce or (m)ono (default j). force forces mid/side stereo on all frames. -p add CRC error protection (adds an additional 16 bits per frame to the stream). This seems to break playback. -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 produces lowest-quality and smallest files. Long options --abr bitrate sets average bitrate desired in Kb/s, instead of setting qual‐ ity, 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 Such a deal. -o mark as non-original (i.e. do not set the original bit) -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 encoding -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 Pcmconv is a helper program used to convert various PCM sample formats. The -i and -o options specify the input and output format fmt of the conver‐ sion. 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# singed 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 in‐ put. Mixfs is a fileserver serving a single audio file which allows simulta‐ neous 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 over /dev. A alternative mountpoint mtpt can be specified with the -m op‐ tion. The -D option causes 9p debug messages to be written to file-de‐ scriptor 2. EXAMPLE Play back an audio/mp3dec <foo.mp3 >/dev/audio Encode a file as highest-quality MP3. audio/mp3enc -q 0 -b 320 <foo.wav >foo.mp3 Create a fixed 128Kb/s MP3 file from a 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 SOURCE /sys/src/cmd/audio SEE ALSO play(1), juke(7), playlistfs(7) http://www.underbit.com/products/mad/ http://xiph.org/doc/ http://flac.sourceforge.net/documentation.html HISTORY Pcmconv first appeared in 9front (December, 2012). Mixfs first ap‐ peared in 9front (December, 2013). AUDIO(1)