]> git.lizzy.rs Git - plan9front.git/blob - sys/man/3/audio
9boot: pxe/kernel memory overlap problem, add unload function
[plan9front.git] / sys / man / 3 / audio
1 .TH AUDIO 3 
2 .SH NAME
3 audio \- SoundBlaster or ESS1688 audio controller
4 .SH SYNOPSIS
5 .nf
6 .B bind -a #A /dev
7 .sp 0.3v
8 .B /dev/audio
9 .B /dev/volume
10 .fi
11 .SH DESCRIPTION
12 The audio device serves a one-level directory,
13 giving access to the stereo audio ports.
14 .B Audio
15 is the data file, which can be read or written to use the port.
16 Audio data is a sequence of stereo samples, left sample first.
17 Each sample is a 16 bit little-endian two's complement integer;
18 the default sampling rate is 44.1 kHz.
19 Some implementations only support audio output
20 and return a zero length when read.
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 input or output.
27 This provides some control over record or playback latency.
28 .PP
29 The file
30 .B audiostat
31 provides additional timing and latency control.  When read, it returns
32 lines of the form
33 .IP
34 .B "bufsize \f2s\fP buffered \f2b\fP offset \f2o\fP time \f2t\fP
35 .PP
36 reporting number of bytes
37 .I s
38 used for DMA operations (i.e., the minimum useful size for reads and writes),
39 the number of bytes
40 .I b
41 currently buffered, and the time
42 .I t
43 at which offset
44 .I o
45 was reached.  Using
46 .I t
47 and
48 .IR o ,
49 it is possible to calculate at what time a byte with a different offset will
50 be recorded or played back.
51 .PP
52 .B Volume
53 is the control file associated with the audio port.
54 Each input and output source has an associated stereo volume control,
55 ranging from 0 (quiet) to 100 (loud).
56 In addition, there are controls for the sampling rate of the D/A and A/D converters
57 and for any tone controls.
58 Reads
59 return lines of the form
60 .IP
61 .I source
62 .B in left
63 .I value 
64 .B right
65 .I value
66 .B out left
67 .I value
68 .B right
69 .I value
70 .PP
71 possibly abbreviated if the values are shared or non-existent.
72 For example, if all of the values are shared, the form degenerates to
73 .RI ` source
74 .IR value '.
75 Valid sources depend on the particular audio device,
76 though all devices have an
77 .B audio
78 stereo source, which controls the output volume from the D/A converter
79 connected to
80 .BR audio .
81 .PP
82 Writes accept the same format with same abbreviations.
83 Writing the string
84 .B reset
85 sets all of the attributes to their default value,
86 and if no attribute is supplied,
87 .B audio
88 is assumed.
89 .PP
90 The Sound Blaster 16 (or MCD) is half-duplex and accepts the following controls on its
91 .B volume
92 file,
93 in the format shown above for reads.
94 .TF "\fLspeaker in out"
95 .TP
96 .B audio out
97 Data written to audio.
98 .TP
99 .B synth in out
100 MIDI synthesizer.
101 .TP
102 .B cd in out
103 CD player.
104 .TP
105 .B line in out
106 Line-level input.
107 .TP
108 .B mic in out
109 Monaural microphone input.
110 .TP
111 .B speaker in out
112 Monaural internal speaker connection.
113 .TP
114 .B treb out
115 Stereo treble tone control.
116 Values less than 50 decrease the treble,
117 those greater increase it.
118 .TP
119 .B bass out
120 Stereo bass tone control.
121 .TP
122 .B speed in out
123 Sampling rate for the D/A and A/D converters,
124 expressed in Hz.
125 Defaults to 44100.
126 .SH SOURCE
127 .B /sys/src/9/port/devaudio.c
128 .SH SEE ALSO
129 .IR usb (4)