]> git.lizzy.rs Git - plan9front.git/blob - sys/man/3/audio
d79d7564ef4ddf043db1f35dac488e2ff1c291de
[plan9front.git] / sys / man / 3 / audio
1 .TH AUDIO 3 
2 .SH NAME
3 audio \- audio device
4 .SH SYNOPSIS
5 .nf
6 .B bind -a #A /dev
7 .sp 0.3v
8 .B /dev/audio
9 .B /dev/audioctl
10 .B /dev/audiostat
11 .B /dev/volume
12 .fi
13 .SH DESCRIPTION
14 The audio device serves a one-level directory,
15 giving access to the stereo audio ports.
16 .B Audio
17 is the data file, which can be written for audio playback.
18 Audio data is a sequence of stereo samples, left sample first.
19 Each sample is a 16 bit little-endian two's complement integer;
20 the default sampling rate is 44.1 kHz.
21 .PP
22 The length of the
23 .B audio
24 file as returned by
25 .IR stat (2)
26 represents the number of bytes buffered for output.
27 .PP
28 .B Audioctl
29 is driver specific control file and left undocumented here.
30 .PP
31 .B Audiostat
32 is a read only status file. The first line has a length of 32 bytes
33 including the newline and starts with the string
34 .B bufsize
35 followed by the prefered write unit (in bytes) and the string
36 .B buffered
37 followed by the number of bytes currently queued for output. The
38 numbers are decimal and right-padded with spaces to fit.
39 After this fixed header, the contents of the file is driver specific.
40 .PP
41 .B Volume
42 is the control file associated with the audio port.  Each source has
43 an associated stereo volume control,
44 ranging from 0 (quiet) to 100 (loud). 
45 In addition, there are controls for the sampling rate,
46 latency control and for any tone controls.
47 Reads
48 return lines of the form
49 .IP
50 .I source
51 .I left
52 .I right
53 .PP
54 or
55 .IP
56 .I source
57 .I value
58 .PP
59 Valid sources depend on the particular audio device,
60 though all devices have an
61 .B audio
62 stereo source, which controls the output volume from the D/A converter.
63 Values for
64 .B speed
65 set the sampling frequency of the audio device and
66 .B delay
67 limits the audio data output buffering to a number of samples.
68 .PP
69 Writes accept the same format except that for stereo sources 
70 .I left
71 and
72 .I right
73 can be abbreviated to a single
74 .I value
75 if both should be set the same.
76 .SH SOURCE
77 .B /sys/src/9/port/devaudio.c
78 .SH SEE ALSO
79 .IR nusb (4)