aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/sound
diff options
context:
space:
mode:
authorThibault Le Meur <Thibault.LeMeur@supelec.fr>2007-07-12 05:26:35 -0400
committerJaroslav Kysela <perex@suse.cz>2007-07-20 05:11:50 -0400
commitf8c78b82b9e47d933629e7060e4a83a277b15ffe (patch)
treebebe05fcce9dc70f5b6fea2459e3950ca909b1e0 /Documentation/sound
parentbe38114a49853e441e694d690e631937de5fc524 (diff)
[ALSA] usb-audio - Fix audiophile-USB quirk for little-endian
Audiophile-usb fix (corrects little-endianness in 16bit modes, resets interfaces at device initialization, and updates the documentation). Signed-off-by: Thibault Le Meur <Thibault.LeMeur@supelec.fr> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'Documentation/sound')
-rw-r--r--Documentation/sound/alsa/Audiophile-Usb.txt230
1 files changed, 151 insertions, 79 deletions
diff --git a/Documentation/sound/alsa/Audiophile-Usb.txt b/Documentation/sound/alsa/Audiophile-Usb.txt
index e40cce83327c..5b7a5487d505 100644
--- a/Documentation/sound/alsa/Audiophile-Usb.txt
+++ b/Documentation/sound/alsa/Audiophile-Usb.txt
@@ -1,4 +1,4 @@
1 Guide to using M-Audio Audiophile USB with ALSA and Jack v1.3 1 Guide to using M-Audio Audiophile USB with ALSA and Jack v1.4
2 ======================================================== 2 ========================================================
3 3
4 Thibault Le Meur <Thibault.LeMeur@supelec.fr> 4 Thibault Le Meur <Thibault.LeMeur@supelec.fr>
@@ -6,8 +6,17 @@
6This document is a guide to using the M-Audio Audiophile USB (tm) device with 6This document is a guide to using the M-Audio Audiophile USB (tm) device with
7ALSA and JACK. 7ALSA and JACK.
8 8
9History
10=======
11* v1.4 - Thibault Le Meur (2007-07-11)
12 - Added Low Endianness nature of 16bits-modes
13 found by Hakan Lennestal <Hakan.Lennestal@brfsodrahamn.se>
14 - Modifying document structure
15
16
91 - Audiophile USB Specs and correct usage 171 - Audiophile USB Specs and correct usage
10========================================== 18==========================================
19
11This part is a reminder of important facts about the functions and limitations 20This part is a reminder of important facts about the functions and limitations
12of the device. 21of the device.
13 22
@@ -25,18 +34,18 @@ The device has 4 audio interfaces, and 2 MIDI ports:
25The internal DAC/ADC has the following characteristics: 34The internal DAC/ADC has the following characteristics:
26* sample depth of 16 or 24 bits 35* sample depth of 16 or 24 bits
27* sample rate from 8kHz to 96kHz 36* sample rate from 8kHz to 96kHz
28* Two ports can't use different sample depths at the same time. Moreover, the 37* Two interfaces can't use different sample depths at the same time.
29Audiophile USB documentation gives the following Warning: "Please exit any 38Moreover, the Audiophile USB documentation gives the following Warning:
30audio application running before switching between bit depths" 39"Please exit any audio application running before switching between bit depths"
31 40
32Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be 41Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be
33activated at the same time depending on the audio mode selected: 42activated at the same time depending on the audio mode selected:
34 * 16-bit/48kHz ==> 4 channels in/4 channels out 43 * 16-bit/48kHz ==> 4 channels in + 4 channels out
35 - Ai+Ao+Di+Do 44 - Ai+Ao+Di+Do
36 * 24-bit/48kHz ==> 4 channels in/2 channels out, 45 * 24-bit/48kHz ==> 4 channels in + 2 channels out,
37 or 2 channels in/4 channels out 46 or 2 channels in + 4 channels out
38 - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do 47 - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do
39 * 24-bit/96kHz ==> 2 channels in, or 2 channels out (half duplex only) 48 * 24-bit/96kHz ==> 2 channels in _or_ 2 channels out (half duplex only)
40 - Ai or Ao or Di or Do 49 - Ai or Ao or Di or Do
41 50
42Important facts about the Digital interface: 51Important facts about the Digital interface:
@@ -52,44 +61,53 @@ source is connected
52synchronization error (for instance sound played at an odd sample rate) 61synchronization error (for instance sound played at an odd sample rate)
53 62
54 63
552 - Audiophile USB support in ALSA 642 - Audiophile USB MIDI support in ALSA
56================================== 65=======================================
57 66
582.1 - MIDI ports 67The Audiophile USB MIDI ports will be automatically supported once the
59----------------
60The Audiophile USB MIDI ports will be automatically supported once the
61following modules have been loaded: 68following modules have been loaded:
62 * snd-usb-audio 69 * snd-usb-audio
63 * snd-seq-midi 70 * snd-seq-midi
64 71
65No additional setting is required. 72No additional setting is required.
66 73
672.2 - Audio ports 74
68----------------- 753 - Audiophile USB Audio support in ALSA
76========================================
69 77
70Audio functions of the Audiophile USB device are handled by the snd-usb-audio 78Audio functions of the Audiophile USB device are handled by the snd-usb-audio
71module. This module can work in a default mode (without any device-specific 79module. This module can work in a default mode (without any device-specific
72parameter), or in an "advanced" mode with the device-specific parameter called 80parameter), or in an "advanced" mode with the device-specific parameter called
73"device_setup". 81"device_setup".
74 82
752.2.1 - Default Alsa driver mode 833.1 - Default Alsa driver mode
76 84------------------------------
77The default behavior of the snd-usb-audio driver is to parse the device 85
78capabilities at startup and enable all functions inside the device (including 86The default behavior of the snd-usb-audio driver is to list the device
79all ports at any supported sample rates and sample depths). This approach 87capabilities at startup and activate the required mode when required
80has the advantage to let the driver easily switch from sample rates/depths 88by the applications: for instance if the user is recording in a
81automatically according to the need of the application claiming the device. 8924bit-depth-mode and immediately after wants to switch to a 16bit-depth mode,
82 90the snd-usb-audio module will reconfigure the device on the fly.
83In this case the Audiophile ports are mapped to alsa pcm devices in the 91
84following way (I suppose the device's index is 1): 92This approach has the advantage to let the driver automatically switch from sample
93rates/depths automatically according to the user's needs. However, those who
94are using the device under windows know that this is not how the device is meant to
95work: under windows applications must be closed before using the m-audio control
96panel to switch the device working mode. Thus as we'll see in next section, this
97Default Alsa driver mode can lead to device misconfigurations.
98
99Let's get back to the Default Alsa driver mode for now. In this case the
100Audiophile interfaces are mapped to alsa pcm devices in the following
101way (I suppose the device's index is 1):
85 * hw:1,0 is Ao in playback and Di in capture 102 * hw:1,0 is Ao in playback and Di in capture
86 * hw:1,1 is Do in playback and Ai in capture 103 * hw:1,1 is Do in playback and Ai in capture
87 * hw:1,2 is Do in AC3/DTS passthrough mode 104 * hw:1,2 is Do in AC3/DTS passthrough mode
88 105
89You must note as well that the device uses Big Endian byte encoding so that 106In this mode, the device uses Big Endian byte-encoding so that
90supported audio format are S16_BE for 16-bit depth modes and S24_3BE for 107supported audio format are S16_BE for 16-bit depth modes and S24_3BE for
9124-bits depth mode. One exception is the hw:1,2 port which is Little Endian 10824-bits depth mode. One exception is the hw:1,2 port which is reported
92compliant and thus uses S16_LE. 109to be Little Endian compliant (supposedly supporting S16_LE) but processes
110in fact only S16_BE streams.
93 111
94Examples: 112Examples:
95 * playing a S24_3BE encoded raw file to the Ao port 113 * playing a S24_3BE encoded raw file to the Ao port
@@ -99,21 +117,23 @@ Examples:
99 * playing a S16_BE encoded raw file to the Do port 117 * playing a S16_BE encoded raw file to the Do port
100 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw 118 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw
101 119
102If you're happy with the default Alsa driver setup and don't experience any 120If you're happy with the default Alsa driver mode and don't experience any
103issue with this mode, then you can skip the following chapter. 121issue with this mode, then you can skip the following chapter.
104 122
1052.2.2 - Advanced module setup 1233.2 - Advanced module setup
124---------------------------
106 125
107Due to the hardware constraints described above, the device initialization made 126Due to the hardware constraints described above, the device initialization made
108by the Alsa driver in default mode may result in a corrupted state of the 127by the Alsa driver in default mode may result in a corrupted state of the
109device. For instance, a particularly annoying issue is that the sound captured 128device. For instance, a particularly annoying issue is that the sound captured
110from the Ai port sounds distorted (as if boosted with an excessive high volume 129from the Ai interface sounds distorted (as if boosted with an excessive high
111gain). 130volume gain).
112 131
113For people having this problem, the snd-usb-audio module has a new module 132For people having this problem, the snd-usb-audio module has a new module
114parameter called "device_setup". 133parameter called "device_setup" (this parameter was introduced in kernel
134release 2.6.17)
115 135
1162.2.2.1 - Initializing the working mode of the Audiophile USB 1363.2.1 - Initializing the working mode of the Audiophile USB
117 137
118As far as the Audiophile USB device is concerned, this value let the user 138As far as the Audiophile USB device is concerned, this value let the user
119specify: 139specify:
@@ -121,33 +141,57 @@ specify:
121 * the sample rate 141 * the sample rate
122 * whether the Di port is used or not 142 * whether the Di port is used or not
123 143
124Here is a list of supported device_setup values for this device: 144When initialized with "device_setup=0x00", the snd-usb-audio module has
125 * device_setup=0x00 (or omitted) 145the same behaviour as when the parameter is omitted (see paragraph "Default
126 - Alsa driver default mode 146Alsa driver mode" above)
127 - maintains backward compatibility with setups that do not use this 147
128 parameter by not introducing any change 148Others modes are described in the following subsections.
129 - results sometimes in corrupted sound as described earlier 149
1503.2.1.1 - 16-bit modes
151
152The two supported modes are:
153
130 * device_setup=0x01 154 * device_setup=0x01
131 - 16bits 48kHz mode with Di disabled 155 - 16bits 48kHz mode with Di disabled
132 - Ai,Ao,Do can be used at the same time 156 - Ai,Ao,Do can be used at the same time
133 - hw:1,0 is not available in capture mode 157 - hw:1,0 is not available in capture mode
134 - hw:1,2 is not available 158 - hw:1,2 is not available
159
135 * device_setup=0x11 160 * device_setup=0x11
136 - 16bits 48kHz mode with Di enabled 161 - 16bits 48kHz mode with Di enabled
137 - Ai,Ao,Di,Do can be used at the same time 162 - Ai,Ao,Di,Do can be used at the same time
138 - hw:1,0 is available in capture mode 163 - hw:1,0 is available in capture mode
139 - hw:1,2 is not available 164 - hw:1,2 is not available
165
166In this modes the device operates only at 16bits-modes. Before kernel 2.6.23,
167the devices where reported to be Big-Endian when in fact they were Little-Endian
168so that playing a file was a matter of using:
169 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test_S16_LE.raw
170where "test_S16_LE.raw" was in fact a little-endian sample file.
171
172Thanks to Hakan Lennestal (who discovered the Little-Endiannes of the device in
173these modes) a fix has been committed (expected in kernel 2.6.23) and
174Alsa now reports Little-Endian interfaces. Thus playing a file now is as simple as
175using:
176 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_LE test_S16_LE.raw
177
1783.2.1.2 - 24-bit modes
179
180The three supported modes are:
181
140 * device_setup=0x09 182 * device_setup=0x09
141 - 24bits 48kHz mode with Di disabled 183 - 24bits 48kHz mode with Di disabled
142 - Ai,Ao,Do can be used at the same time 184 - Ai,Ao,Do can be used at the same time
143 - hw:1,0 is not available in capture mode 185 - hw:1,0 is not available in capture mode
144 - hw:1,2 is not available 186 - hw:1,2 is not available
187
145 * device_setup=0x19 188 * device_setup=0x19
146 - 24bits 48kHz mode with Di enabled 189 - 24bits 48kHz mode with Di enabled
147 - 3 ports from {Ai,Ao,Di,Do} can be used at the same time 190 - 3 ports from {Ai,Ao,Di,Do} can be used at the same time
148 - hw:1,0 is available in capture mode and an active digital source must be 191 - hw:1,0 is available in capture mode and an active digital source must be
149 connected to Di 192 connected to Di
150 - hw:1,2 is not available 193 - hw:1,2 is not available
194
151 * device_setup=0x0D or 0x10 195 * device_setup=0x0D or 0x10
152 - 24bits 96kHz mode 196 - 24bits 96kHz mode
153 - Di is enabled by default for this mode but does not need to be connected 197 - Di is enabled by default for this mode but does not need to be connected
@@ -155,34 +199,61 @@ Here is a list of supported device_setup values for this device:
155 - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time 199 - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time
156 - hw:1,0 is available in captured mode 200 - hw:1,0 is available in captured mode
157 - hw:1,2 is not available 201 - hw:1,2 is not available
202
203In these modes the device is only Big-Endian compliant (see "Default Alsa driver
204mode" above for an aplay command example)
205
2063.2.1.3 - AC3 w/ DTS passthru mode
207
208This mode is untested, I have no AC3 compliant device to test it. I uses:
209
158 * device_setup=0x03 210 * device_setup=0x03
159 - 16bits 48kHz mode with only the Do port enabled 211 - 16bits 48kHz mode with only the Do port enabled
160 - AC3 with DTS passthru (not tested) 212 - AC3 with DTS passthru (not tested)
161 - Caution with this setup the Do port is mapped to the pcm device hw:1,0 213 - Caution with this setup the Do port is mapped to the pcm device hw:1,0
162 214
1632.2.2.2 - Setting and switching configurations with the device_setup parameter 2153.2.2 - How to use the device_setup parameter
216----------------------------------------------
164 217
165The parameter can be given: 218The parameter can be given:
219
166 * By manually probing the device (as root): 220 * By manually probing the device (as root):
167 # modprobe -r snd-usb-audio 221 # modprobe -r snd-usb-audio
168 # modprobe snd-usb-audio index=1 device_setup=0x09 222 # modprobe snd-usb-audio index=1 device_setup=0x09
223
169 * Or while configuring the modules options in your modules configuration file 224 * Or while configuring the modules options in your modules configuration file
170 - For Fedora distributions, edit the /etc/modprobe.conf file: 225 - For Fedora distributions, edit the /etc/modprobe.conf file:
171 alias snd-card-1 snd-usb-audio 226 alias snd-card-1 snd-usb-audio
172 options snd-usb-audio index=1 device_setup=0x09 227 options snd-usb-audio index=1 device_setup=0x09
173 228
174IMPORTANT NOTE WHEN SWITCHING CONFIGURATION: 229CAUTION when initializaing the device
175------------------------------------------- 230-------------------------------------
176 * You may need to _first_ initialize the module with the correct device_setup 231
177 parameter and _only_after_ turn on the Audiophile USB device 232 * Correct initialization on the device requires that device_setup is given to
178 * This is especially true when switching the sample depth: 233 the module BEFORE the device is turned on. So, if you use the "manual probing"
234 method described above, take care to power-on the device AFTER this initialization.
235
236 * Failing to respect this will lead in a misconfiguration of the device. In this case
237 turn off the device, unproble the snd-usb-audio module, then probe it again with
238 correct device_setup parameter and then (and only then) turn on the device again.
239
240 * If you've correctly initialized the device in a valid mode and then want to switch
241 to another mode (possibly with another sample-depth), please use also the following
242 procedure:
179 - first turn off the device 243 - first turn off the device
180 - de-register the snd-usb-audio module (modprobe -r) 244 - de-register the snd-usb-audio module (modprobe -r)
181 - change the device_setup parameter by changing the device_setup 245 - change the device_setup parameter by changing the device_setup
182 option in /etc/modprobe.conf 246 option in /etc/modprobe.conf
183 - turn on the device 247 - turn on the device
248 * A workaround for this last issue has been applied to kernel 2.6.23, but it may not
249 be enough to ensure the 'stability' of the device initialization.
250
2513.2.3 - Technical details for hackers
252-------------------------------------
253This section is for hackers, wanting to understand details about the device
254internals and how Alsa supports it.
184 255
1852.2.2.3 - Audiophile USB's device_setup structure 2563.2.3.1 - Audiophile USB's device_setup structure
186 257
187If you want to understand the device_setup magic numbers for the Audiophile 258If you want to understand the device_setup magic numbers for the Audiophile
188USB, you need some very basic understanding of binary computation. However, 259USB, you need some very basic understanding of binary computation. However,
@@ -228,12 +299,12 @@ Caution:
228 - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll 299 - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll
229 only be able to use one at the same time 300 only be able to use one at the same time
230 301
2312.2.3 - USB implementation details for this device 3023.2.3.2 - USB implementation details for this device
232 303
233You may safely skip this section if you're not interested in driver 304You may safely skip this section if you're not interested in driver
234development. 305hacking.
235 306
236This section describes some internal aspects of the device and summarize the 307This section describes some internal aspects of the device and summarizes the
237data I got by usb-snooping the windows and Linux drivers. 308data I got by usb-snooping the windows and Linux drivers.
238 309
239The M-Audio Audiophile USB has 7 USB Interfaces: 310The M-Audio Audiophile USB has 7 USB Interfaces:
@@ -293,43 +364,45 @@ parse_audio_endpoints function uses a quirk called
293"audiophile_skip_setting_quirk" in order to prevent AltSettings not 364"audiophile_skip_setting_quirk" in order to prevent AltSettings not
294corresponding to device_setup from being registered in the driver. 365corresponding to device_setup from being registered in the driver.
295 366
2963 - Audiophile USB and Jack support 3674 - Audiophile USB and Jack support
297=================================== 368===================================
298 369
299This section deals with support of the Audiophile USB device in Jack. 370This section deals with support of the Audiophile USB device in Jack.
300The main issue regarding this support is that the device is Big Endian
301compliant.
302 371
3033.1 - Using the plug alsa plugin 372There are 2 main potential issues when using Jackd with the device:
304-------------------------------- 373* support for Big-Endian devices in 24-bit modes
374* support for 4-in / 4-out channels
305 375
306Jack doesn't directly support big endian devices. Thus, one way to have support 3764.1 - Direct support in Jackd
307for this device with Alsa is to use the Alsa "plug" converter. 377-----------------------------
378
379Jack supports big endian devices only in recent versions (thanks to
380Andreas Steinmetz for his first big-endian patch). I can't remember
381extacly when this support was released into jackd, let's just say that
382with jackd version 0.103.0 it's almost ok (just a small bug is affecting
38316bits Big-Endian devices, but since you've read carefully the above
384paragraphs, you're now using kernel >= 2.6.23 and your 16bits devices
385are now Little Endians ;-) ).
386
387You can run jackd with the following command for playback with Ao and
388record with Ai:
389 % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1
390
3914.2 - Using Alsa plughw
392-----------------------
393If you don't have a recent Jackd installed, you can downgrade to using
394the Alsa "plug" converter.
308 395
309For instance here is one way to run Jack with 2 playback channels on Ao and 2 396For instance here is one way to run Jack with 2 playback channels on Ao and 2
310capture channels from Ai: 397capture channels from Ai:
311 % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1 398 % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1
312 399
313
314However you may see the following warning message: 400However you may see the following warning message:
315"You appear to be using the ALSA software "plug" layer, probably a result of 401"You appear to be using the ALSA software "plug" layer, probably a result of
316using the "default" ALSA device. This is less efficient than it could be. 402using the "default" ALSA device. This is less efficient than it could be.
317Consider using a hardware device instead rather than using the plug layer." 403Consider using a hardware device instead rather than using the plug layer."
318 404
3193.2 - Patching alsa to use direct pcm device 4054.3 - Getting 2 input and/or output interfaces in Jack
320--------------------------------------------
321A patch for Jack by Andreas Steinmetz adds support for Big Endian devices.
322However it has not been included in the CVS tree.
323
324You can find it at the following URL:
325http://sourceforge.net/tracker/index.php?func=detail&aid=1289682&group_id=39687&
326atid=425939
327
328After having applied the patch you can run jackd with the following command
329line:
330 % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1
331
3323.2 - Getting 2 input and/or output interfaces in Jack
333------------------------------------------------------ 406------------------------------------------------------
334 407
335As you can see, starting the Jack server this way will only enable 1 stereo 408As you can see, starting the Jack server this way will only enable 1 stereo
@@ -339,6 +412,7 @@ This is due to the following restrictions:
339* Jack can only open one capture device and one playback device at a time 412* Jack can only open one capture device and one playback device at a time
340* The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1 413* The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1
341 (and optionally hw:1,2) 414 (and optionally hw:1,2)
415
342If you want to get Ai+Di and/or Ao+Do support with Jack, you would need to 416If you want to get Ai+Di and/or Ao+Do support with Jack, you would need to
343combine the Alsa devices into one logical "complex" device. 417combine the Alsa devices into one logical "complex" device.
344 418
@@ -348,13 +422,11 @@ It is related to another device (ice1712) but can be adapted to suit
348the Audiophile USB. 422the Audiophile USB.
349 423
350Enabling multiple Audiophile USB interfaces for Jackd will certainly require: 424Enabling multiple Audiophile USB interfaces for Jackd will certainly require:
351* patching Jack with the previously mentioned "Big Endian" patch 425* Making sure your Jackd version has the MMAP_COMPLEX patch (see the ice1712 page)
352* patching Jackd with the MMAP_COMPLEX patch (see the ice1712 page) 426* (maybe) patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page)
353* patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page)
354* define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc 427* define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc
355 file 428 file
356* start jackd with this device 429* start jackd with this device
357 430
358I had no success in testing this for now, but this may be due to my OS 431I had no success in testing this for now, if you have any success with this kind
359configuration. If you have any success with this kind of setup, please 432of setup, please drop me an email.
360drop me an email.