The Plan 9 audio interface is composed of 4 files

The Plan 9 audio interface is composed of 4 files:

; walk -fexp /dev/audio* /dev/volume
--rw-rw-rw /dev/audio
---w--w--w- /dev/audioctl
--r--r--r-- /dev/audiostat
--rw--rw--rw- /dev/volume

/dev/audio is the most important and is used to play (write) and record (read) audio:

; audio/mp3dec <file.mp3 >/dev/audio
; dd -conv swap </dev/audio | audio/mp3enc >rec.mp3

/dev/audiostat is for driver-specific status:

; cat /dev/audiostat
bufsize 1024 buffered   7168
codec 0 pin 22 inpin 23
[...]
pin 22 out jack ext front hpout green  aout 16,  aout 17
pin 23 in nothing sep rear micin pink
[...]
outpath aout 16  pin 22
inpath pin 23  ain 20

The output would then be different for every driver. Above is a demonstration.

/dev/audioctl is the counterpart for audiostat, and is used for driver-specific control:

# hda
; echo pin 22 >/dev/audioctl
# nusb/audio
; echo out off >/dev/audioctl

This allows you to send configuration messages to the driver.

/dev/volume controls the volume, sampling rate, delay, and format controls:

; cat /dev/volume
dev /dev/audio
mix 100 100
fmtout s16c2r44100
speed 44100
master 89
master 89
recgain 0 0
delay 1764
; echo master 50 >/dev/volume
; echo speed 48000 >/dev/volume
; echo delay 1920 >/dev/volume # 40 ms

All of the drivers implement this interface: AC97, SB16, Intel HDA, USB audio, MNT Reform, ... You can have more than one available (locally or not).

/dev/audio
/dev/audioU93a25
/dev/volume
/dev/volumeU93a25
Last updated