aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorThibault LE MEUR <Thibault.LeMeur@supelec.fr>2006-03-14 05:44:53 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:38:38 -0500
commite311334ee6bdd173d53be52f4fdffa5f39652e26 (patch)
treeb3c7a0f588ccb160b1d9446f0421be662f775033 /Documentation
parentecefb192525c369dde67bf0addd4f96692a801c3 (diff)
[ALSA] Fixes audiophile usb analog capture with the new device_setup parameter
Modules: Documentation,USB generic driver The patch adds the 'device_setup' module parameter and a specific quirk to correctly initialize the audiophile usb device: this fixes the distorted sound bug on the Analog capture port. Backward compatibility is achieved by simply omitting the new parameter. Signed-off-by: Thibault LE MEUR <Thibault.LeMeur@supelec.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt3
-rw-r--r--Documentation/sound/alsa/Audiophile-Usb.txt330
2 files changed, 333 insertions, 0 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 1065beed8d75..f947c4b04ab8 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -1411,6 +1411,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1411 1411
1412 vid - Vendor ID for the device (optional) 1412 vid - Vendor ID for the device (optional)
1413 pid - Product ID for the device (optional) 1413 pid - Product ID for the device (optional)
1414 device_setup - Device specific magic number (optional)
1415 - Influence depends on the device
1416 - Default: 0x0000
1414 1417
1415 This module supports multiple devices, autoprobe and hotplugging. 1418 This module supports multiple devices, autoprobe and hotplugging.
1416 1419
diff --git a/Documentation/sound/alsa/Audiophile-Usb.txt b/Documentation/sound/alsa/Audiophile-Usb.txt
new file mode 100644
index 000000000000..3ba45adbf040
--- /dev/null
+++ b/Documentation/sound/alsa/Audiophile-Usb.txt
@@ -0,0 +1,330 @@
1 Guide to using M-Audio Audiophile USB with ALSA and Jack v1.1
2 ========================================================
3
4 Thibault Le Meur <Thibault.LeMeur@supelec.fr>
5
6This document is a guide to using the M-Audio Audiophile USB (tm) device with
7ALSA and JACK.
8
91 - Audiophile USB Specs and correct usage
10==========================================
11This part is a reminder of important facts about the functions and limitations
12of the device.
13
14The device has 4 audio interfaces, and 2 MIDI ports:
15 * Analog Stereo Input (Ai)
16 * Analog Stereo Output (Ao)
17 * Digital Stereo Input (Di)
18 * Digital Stereo Output (Do)
19 * Midi In (Mi)
20 * Midi Out (Mo)
21
22The internal DAC/ADC has the following caracteristics:
23* sample depth of 16 or 24 bits
24* sample rate from 8kHz to 96kHz
25* Two ports can't use different sample depths at the same time.Moreover, the
26Audiophile USB documentation gives the following Warning: "Please exit any
27audio application running before switching between bit depths"
28
29Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be
30activated at the same time depending on the audio mode selected:
31 * 16-bit/48kHz ==> 4 channels in/ 4 channels out
32 - Ai+Ao+Di+Do
33 * 24-bit/48kHz ==> 4 channels in/2 channels out,
34 or 2 channels in/4 channels out
35 - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do
36 * 24-bit/96kHz ==> 2 channels in, or 2 channels out (half duplex only)
37 - Ai or Ao or Di or Do
38
39Important facts about the Digital interface:
40--------------------------------------------
41 * The Do port additionnaly supports surround-encoded AC-3 and DTS passthrough,
42though I haven't tested it under linux
43 - Note that in this setup only the Do interface can be enabled
44 * Apart from recording an audio digital stream, enabling the Di port is a way
45to syncrhonize the device to an external sample clock
46 - As a consequence, the Di port must be enable only if an active Digital
47source is connected
48 - Enabling Di when no digital source is connected can result in a
49synchronization error (for instance sound played at an odd sample rate)
50
51
522 - Audiophile USB support in ALSA
53==================================
54
552.1 - MIDI ports
56----------------
57The Audiophile USB MIDI ports will be automatically supported once the
58following modules have been loaded:
59 * snd-usb-audio
60 * snd-seq
61 * snd-seq-midi
62
63No additionnal setting is required.
64
652.2 - Audio ports
66-----------------
67
68Audio functions of the Audiophile USB device are handled by the snd-usb-audio
69module. This module can work in a default mode (without any device-specific
70parameter), or in an advanced mode with the device-specific parameter called
71"device_setup".
72
732.2.1 - Default Alsa driver mode
74
75The default behaviour of the snd-usb-audio driver is to parse the device
76capabilities at startup and enable all functions inside the device (including
77all ports at any sample rates and any sample depths supported). This approach
78has the advantage to let the driver easily switch from sample rates/depths
79automatically according to the need of the application claiming the device.
80
81In this case the Audiophile ports are mapped to alsa pcm devices in the
82following way (I suppose the device's index is 1):
83 * hw:1,0 is Ao in playback and Di in capture
84 * hw:1,1 is Do in playback and Ai in capture
85 * hw:1,2 is Do in AC3/DTS passthrough mode
86
87You must note as well that the device uses Big Endian byte encoding so that
88supported audio format are S16_BE for 16-bit depth modes and S24_3BE for
8924-bits depth mode. One exception is the hw:1,2 port which is Little Endian
90compliant and thus uses S16_LE.
91
92Examples:
93 * playing a S24_3BE encoded raw file to the Ao port
94 % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw
95 * recording a S24_3BE encoded raw file from the Ai port
96 % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw
97 * playing a S16_BE encoded raw file to the Do port
98 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw
99
100If you're happy with the default Alsa driver setup and don't experience any
101issue with this mode, then you can skip the following chapter.
102
1032.2.2 - Advanced module setup
104
105Due to the hardware constraints described above, the device initialization made
106by the Alsa driver in default mode may result in a corrupted state of the
107device. For instance, a particularly annoying issue is that the sound captured
108from the Ai port sounds distorted (as if boosted with an excessive high volume
109gain).
110
111For people having this problem, the snd-usb-audio module has a new module
112parameter called "device_setup".
113
1142.2.2.1 - Initializing the working mode of the Audiohile USB
115
116As far as the Audiohile USB device is concerned, this value let the user
117specify:
118 * the sample depth
119 * the sample rate
120 * whether the Di port is used or not
121
122Here is a list of supported device_setup values for this device:
123 * device_setup=0x00 (or omitted)
124 - Alsa driver default mode
125 - maintains backward compatibility with setups that do not use this
126 parameter by not introducing any change
127 - results sometimes in corrupted sound as decribed earlier
128 * device_setup=0x01
129 - 16bits 48kHz mode with Di disabled
130 - Ai,Ao,Do can be used at the same time
131 - hw:1,0 is not available in capture mode
132 - hw:1,2 is not available
133 * device_setup=0x11
134 - 16bits 48kHz mode with Di enabled
135 - Ai,Ao,Di,Do can be used at the same time
136 - hw:1,0 is available in capture mode
137 - hw:1,2 is not available
138 * device_setup=0x09
139 - 24bits 48kHz mode with Di disabled
140 - Ai,Ao,Do can be used at the same time
141 - hw:1,0 is not available in capture mode
142 - hw:1,2 is not available
143 * device_setup=0x19
144 - 24bits 48kHz mode with Di enabled
145 - 3 ports from {Ai,Ao,Di,Do} can be used at the same time
146 - hw:1,0 is available in capture mode and an active digital source must be
147 connected to Di
148 - hw:1,2 is not available
149 * device_setup=0x0D or 0x10
150 - 24bits 96kHz mode
151 - Di is enabled by default for this mode but does not need to be connected
152 to an active source
153 - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time
154 - hw:1,0 is available in captured mode
155 - hw:1,2 is not available
156 * device_setup=0x03
157 - 16bits 48kHz mode with only the Do port enabled
158 - AC3 with DTS passthru (not tested)
159 - Caution with this setup the Do port is mapped to the pcm device hw:1,0
160
1612.2.2.2 - Setting and switching configurations with the device_setup parameter
162
163The parameter can be given:
164 * By manually probing the device (as root):
165 # modprobe -r snd-usb-audio
166 # modprobe snd-usb-audio index=1 device_setup=0x09
167 * Or while configuring the modules options in your modules configuration file
168 - For Fedora distributions, edit the /etc/modprobe.conf file:
169 alias snd-card-1 snd-usb-audio
170 options snd-usb-audio index=1 device_setup=0x09
171
172IMPORTANT NOTE WHEN SWITCHING CONFIGURATION:
173-------------------------------------------
174 * You may need to _first_ intialize the module with the correct device_setup
175 parameter and _only_after_ turn on the Audiophile USB device
176 * This is especially true when switching the sample depth:
177 - first trun off the device
178 - de-register the snd-usb-audio module
179 - change the device_setup parameter (by either manually reprobing the module
180 or changing modprobe.conf)
181 - turn on the device
182
1832.2.2.3 - Setting and switching configurations with the device_setup parameter
184
185If you want to understand the device_setup magic numbers for the Audiophile
186USB, you need some very basic understanding of binary computation. However,
187this is not required to use the parameter and you may skip thi section.
188
189The device_setup is one byte long and its structure is the following:
190
191 +---+---+---+---+---+---+---+---+
192 | b7| b6| b5| b4| b3| b2| b1| b0|
193 +---+---+---+---+---+---+---+---+
194 | 0 | 0 | 0 | Di|24B|96K|DTS|SET|
195 +---+---+---+---+---+---+---+---+
196
197Where:
198 * b0 is the "SET" bit
199 - it MUST be set if device_setup is initialized
200 * b1 is the "DTS" bit
201 - it is set only for Digital output with DTS/AC3
202 - this setup is not tested
203 * b2 is the Rate selection flag
204 - When set to "1" the rate range is 48.1-96kHz
205 - Otherwise the sample rate range is 8-48kHz
206 * b3 is the bit depth selection flag
207 - When set to "1" samples are 24bits long
208 - Otherwise they are 16bits long
209 - Note that b2 implies b3 as the 96kHz mode is only supported for 24 bits
210 samples
211 * b4 is the Digital input flag
212 - When set to "1" the device assumes that an active digital source is
213 connected
214 - You shouldn't enable Di if no source is seen on the port (this leads to
215 synchronization issues)
216 - b4 is implied by b2 (since only one port is enabled at a time no synch
217 error can occur)
218 * b5 to b7 are reserved for future uses, and must be set to "0"
219 - might become Ao, Do, Ai, for b7, b6, b4 respectively
220
221Caution:
222 * there is no check on the value you will give to device_setup
223 - for instance choosing 0x05 (16bits 96kHz) will fail back to 0x09 since
224 b2 implies b3. But _there_will_be_no_warning_ in /var/log/messages
225 * Hardware constraints due to the USB bus limitation aren't checked
226 - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll
227 only be able to use one at the same time
228
2292.2.3 - Technical Details for Audiophile Usb
230
231You may safely skip this section if you're not interrested in driver
232development.
233
234This section describes some internals aspect of the device and summarize the
235data I got by usb-snooping the windows and linux drivers.
236
237The M-Audio Audiophile USB has 7 Usb Interfaces:
238a "USB interface":
239 * Usb Interface nb.0
240 * Usb Interface nb.1
241 - Audio Control function
242 * Usb Interface nb.2
243 - Analog Output
244 * Usb Interface nb.3
245 - Digital Output
246 * Usb Interface nb.4
247 - Analog Input
248 * Usb Interface nb.5
249 - Digital Input
250 * Usb Interface nb.6
251 - MIDI interface compliant with the MIDIMAN quirk
252
253Each interface has 5 altsettings (AltSet 1,2,3,4,5) except:
254 * Interface 3 (Digital Out) has an extra Alset nb.6
255 * Interface 5 (Digital In) does not have Alset nb.3 and 5
256
257Here is a short description of the AltSettings capabilities:
258 * AltSettings 1 corresponds to
259 - 24-bit depth, 48.1-96kHz sample mode
260 - Adaptive playback (Ao and Do), Synch capture (Ai), or Asynch capture (Di)
261 * AltSettings 2 corresponds to
262 - 24-bit depth, 8-48kHz sample mode
263 - Asynch capture and playback (Ao,Ai,Do,Di)
264 * AltSettings 3 corresponds to
265 - 24-bit depth, 8-48kHz sample mode
266 - Synch capture (Ai) and Adaptive playback (Ao,Do)
267 * AltSettings 4 corresponds to
268 - 16-bit depth, 8-48kHz sample mode
269 - Asynch capture and playback (Ao,Ai,Do,Di)
270 * AltSettings 5 corresponds to
271 - 16-bit depth, 8-48kHz sample mode
272 - Synch capture (Ai) and Adaptive playback (Ao,Do)
273 * AltSettings 6 corresponds to
274 - 16-bit depth, 8-48kHz sample mode
275 - Synch playback (Do), audio format type III IEC1937_AC-3
276
277In order to ensure a correct intialization of the device, the driver
278_must_know_ how the device will be used:
279 * if DTS is choosen, only Interface 2 with AltSet nb.6 must be
280 registered
281 * if 96KHz only AltSets nb.1 of each interface must be selected
282 * if samples are using 24bits/48KHz then AltSet 2 must me used if
283 Digital input is connected, and only AltSet nb.3 if Digital input
284 is not connected
285 * if samples are using 16bits/48KHz then AltSet 4 must me used if
286 Digital input is connected, and only AltSet nb.5 if Digital input
287 is not connected
288
289When device_setup is given as a parameter to the snd-usb-audio module, the
290parse_audio_enpoint function uses a quirk called
291"audiophile_skip_setting_quirk" in order to prevent AltSettings not
292corresponding to device_setup from being registered in the driver.
293
2943 - Audiophile USB and Jack support
295===================================
296
297This section deals with support of the Audiophile USB device in Jack.
298The main issue regarding this support is that the device is Big Endian
299compliant.
300
3013.1 - Using the plug alsa plugin
302--------------------------------
303
304Jack doesn't directly support big endian devices. Thus, one way to have support
305for this device with Alsa is to use the Alsa "plug" converter.
306
307For instance here is one way to run Jack with 2 playback channels on Ao and 2
308capture channels from Ai:
309 % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1
310
311
312However you may see the following warning message:
313"You appear to be using the ALSA software "plug" layer, probably a result of
314using the "default" ALSA device. This is less efficient than it could be.
315Consider using a hardware device instead rather than using the plug layer."
316
317
3183.2 - Patching alsa to use direct pcm device
319-------------------------------------------
320A patch for Jack by Andreas Steinmetz adds support for Big Endian devices.
321However it has not been included in the CVS tree.
322
323You can find it at the following URL:
324http://sourceforge.net/tracker/index.php?func=detail&aid=1289682&group_id=39687&
325atid=425939
326
327After having applied the patch you can run jackd with the following command
328line:
329# /usr/local/bin/jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1
330