1 Guide to using M-Audio Audiophile USB with ALSA and Jack v1.2
2 ========================================================
4 Thibault Le Meur <Thibault.LeMeur@supelec.fr>
6 This document is a guide to using the M-Audio Audiophile USB (tm) device with
9 1 - Audiophile USB Specs and correct usage
10 ==========================================
11 This part is a reminder of important facts about the functions and limitations
14 The device has 4 audio interfaces, and 2 MIDI ports:
15 * Analog Stereo Input (Ai)
16 - This port supports 2 pairs of line-level audio inputs (1/4" TS and RCA)
17 - When the 1/4" TS (jack) connectors are connected, the RCA connectors
19 * Analog Stereo Output (Ao)
20 * Digital Stereo Input (Di)
21 * Digital Stereo Output (Do)
25 The internal DAC/ADC has the following caracteristics:
26 * sample depth of 16 or 24 bits
27 * sample rate from 8kHz to 96kHz
28 * Two ports can't use different sample depths at the same time.Moreover, the
29 Audiophile USB documentation gives the following Warning: "Please exit any
30 audio application running before switching between bit depths"
32 Due to the USB 1.1 bandwidth limitation, a limited number of interfaces can be
33 activated at the same time depending on the audio mode selected:
34 * 16-bit/48kHz ==> 4 channels in/ 4 channels out
36 * 24-bit/48kHz ==> 4 channels in/2 channels out,
37 or 2 channels in/4 channels out
38 - 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)
40 - Ai or Ao or Di or Do
42 Important facts about the Digital interface:
43 --------------------------------------------
44 * The Do port additionnaly supports surround-encoded AC-3 and DTS passthrough,
45 though I haven't tested it under linux
46 - Note that in this setup only the Do interface can be enabled
47 * Apart from recording an audio digital stream, enabling the Di port is a way
48 to synchronize the device to an external sample clock
49 - As a consequence, the Di port must be enable only if an active Digital
51 - Enabling Di when no digital source is connected can result in a
52 synchronization error (for instance sound played at an odd sample rate)
55 2 - Audiophile USB support in ALSA
56 ==================================
60 The Audiophile USB MIDI ports will be automatically supported once the
61 following modules have been loaded:
66 No additionnal setting is required.
71 Audio functions of the Audiophile USB device are handled by the snd-usb-audio
72 module. This module can work in a default mode (without any device-specific
73 parameter), or in an advanced mode with the device-specific parameter called
76 2.2.1 - Default Alsa driver mode
78 The default behaviour of the snd-usb-audio driver is to parse the device
79 capabilities at startup and enable all functions inside the device (including
80 all ports at any sample rates and any sample depths supported). This approach
81 has the advantage to let the driver easily switch from sample rates/depths
82 automatically according to the need of the application claiming the device.
84 In this case the Audiophile ports are mapped to alsa pcm devices in the
85 following way (I suppose the device's index is 1):
86 * hw:1,0 is Ao in playback and Di in capture
87 * hw:1,1 is Do in playback and Ai in capture
88 * hw:1,2 is Do in AC3/DTS passthrough mode
90 You must note as well that the device uses Big Endian byte encoding so that
91 supported audio format are S16_BE for 16-bit depth modes and S24_3BE for
92 24-bits depth mode. One exception is the hw:1,2 port which is Little Endian
93 compliant and thus uses S16_LE.
96 * playing a S24_3BE encoded raw file to the Ao port
97 % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw
98 * recording a S24_3BE encoded raw file from the Ai port
99 % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw
100 * playing a S16_BE encoded raw file to the Do port
101 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw
103 If you're happy with the default Alsa driver setup and don't experience any
104 issue with this mode, then you can skip the following chapter.
106 2.2.2 - Advanced module setup
108 Due to the hardware constraints described above, the device initialization made
109 by the Alsa driver in default mode may result in a corrupted state of the
110 device. For instance, a particularly annoying issue is that the sound captured
111 from the Ai port sounds distorted (as if boosted with an excessive high volume
114 For people having this problem, the snd-usb-audio module has a new module
115 parameter called "device_setup".
117 2.2.2.1 - Initializing the working mode of the Audiohile USB
119 As far as the Audiohile USB device is concerned, this value let the user
123 * whether the Di port is used or not
125 Here is a list of supported device_setup values for this device:
126 * device_setup=0x00 (or omitted)
127 - Alsa driver default mode
128 - maintains backward compatibility with setups that do not use this
129 parameter by not introducing any change
130 - results sometimes in corrupted sound as decribed earlier
132 - 16bits 48kHz mode with Di disabled
133 - Ai,Ao,Do can be used at the same time
134 - hw:1,0 is not available in capture mode
135 - hw:1,2 is not available
137 - 16bits 48kHz mode with Di enabled
138 - Ai,Ao,Di,Do can be used at the same time
139 - hw:1,0 is available in capture mode
140 - hw:1,2 is not available
142 - 24bits 48kHz mode with Di disabled
143 - Ai,Ao,Do can be used at the same time
144 - hw:1,0 is not available in capture mode
145 - hw:1,2 is not available
147 - 24bits 48kHz mode with Di enabled
148 - 3 ports from {Ai,Ao,Di,Do} can be used at the same time
149 - hw:1,0 is available in capture mode and an active digital source must be
151 - hw:1,2 is not available
152 * device_setup=0x0D or 0x10
154 - Di is enabled by default for this mode but does not need to be connected
156 - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time
157 - hw:1,0 is available in captured mode
158 - hw:1,2 is not available
160 - 16bits 48kHz mode with only the Do port enabled
161 - AC3 with DTS passthru (not tested)
162 - Caution with this setup the Do port is mapped to the pcm device hw:1,0
164 2.2.2.2 - Setting and switching configurations with the device_setup parameter
166 The parameter can be given:
167 * By manually probing the device (as root):
168 # modprobe -r snd-usb-audio
169 # modprobe snd-usb-audio index=1 device_setup=0x09
170 * Or while configuring the modules options in your modules configuration file
171 - For Fedora distributions, edit the /etc/modprobe.conf file:
172 alias snd-card-1 snd-usb-audio
173 options snd-usb-audio index=1 device_setup=0x09
175 IMPORTANT NOTE WHEN SWITCHING CONFIGURATION:
176 -------------------------------------------
177 * You may need to _first_ intialize the module with the correct device_setup
178 parameter and _only_after_ turn on the Audiophile USB device
179 * This is especially true when switching the sample depth:
180 - first trun off the device
181 - de-register the snd-usb-audio module
182 - change the device_setup parameter (by either manually reprobing the module
183 or changing modprobe.conf)
186 2.2.2.3 - Audiophile USB's device_setup structure
188 If you want to understand the device_setup magic numbers for the Audiophile
189 USB, you need some very basic understanding of binary computation. However,
190 this is not required to use the parameter and you may skip thi section.
192 The device_setup is one byte long and its structure is the following:
194 +---+---+---+---+---+---+---+---+
195 | b7| b6| b5| b4| b3| b2| b1| b0|
196 +---+---+---+---+---+---+---+---+
197 | 0 | 0 | 0 | Di|24B|96K|DTS|SET|
198 +---+---+---+---+---+---+---+---+
201 * b0 is the "SET" bit
202 - it MUST be set if device_setup is initialized
203 * b1 is the "DTS" bit
204 - it is set only for Digital output with DTS/AC3
205 - this setup is not tested
206 * b2 is the Rate selection flag
207 - When set to "1" the rate range is 48.1-96kHz
208 - Otherwise the sample rate range is 8-48kHz
209 * b3 is the bit depth selection flag
210 - When set to "1" samples are 24bits long
211 - Otherwise they are 16bits long
212 - Note that b2 implies b3 as the 96kHz mode is only supported for 24 bits
214 * b4 is the Digital input flag
215 - When set to "1" the device assumes that an active digital source is
217 - You shouldn't enable Di if no source is seen on the port (this leads to
218 synchronization issues)
219 - b4 is implied by b2 (since only one port is enabled at a time no synch
221 * b5 to b7 are reserved for future uses, and must be set to "0"
222 - might become Ao, Do, Ai, for b7, b6, b4 respectively
225 * there is no check on the value you will give to device_setup
226 - for instance choosing 0x05 (16bits 96kHz) will fail back to 0x09 since
227 b2 implies b3. But _there_will_be_no_warning_ in /var/log/messages
228 * Hardware constraints due to the USB bus limitation aren't checked
229 - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll
230 only be able to use one at the same time
232 2.2.3 - USB implementation details for this device
234 You may safely skip this section if you're not interrested in driver
237 This section describes some internals aspect of the device and summarize the
238 data I got by usb-snooping the windows and linux drivers.
240 The M-Audio Audiophile USB has 7 USB Interfaces:
244 - Audio Control function
254 - MIDI interface compliant with the MIDIMAN quirk
256 Each interface has 5 altsettings (AltSet 1,2,3,4,5) except:
257 * Interface 3 (Digital Out) has an extra Alset nb.6
258 * Interface 5 (Digital In) does not have Alset nb.3 and 5
260 Here is a short description of the AltSettings capabilities:
261 * AltSettings 1 corresponds to
262 - 24-bit depth, 48.1-96kHz sample mode
263 - Adaptive playback (Ao and Do), Synch capture (Ai), or Asynch capture (Di)
264 * AltSettings 2 corresponds to
265 - 24-bit depth, 8-48kHz sample mode
266 - Asynch capture and playback (Ao,Ai,Do,Di)
267 * AltSettings 3 corresponds to
268 - 24-bit depth, 8-48kHz sample mode
269 - Synch capture (Ai) and Adaptive playback (Ao,Do)
270 * AltSettings 4 corresponds to
271 - 16-bit depth, 8-48kHz sample mode
272 - Asynch capture and playback (Ao,Ai,Do,Di)
273 * AltSettings 5 corresponds to
274 - 16-bit depth, 8-48kHz sample mode
275 - Synch capture (Ai) and Adaptive playback (Ao,Do)
276 * AltSettings 6 corresponds to
277 - 16-bit depth, 8-48kHz sample mode
278 - Synch playback (Do), audio format type III IEC1937_AC-3
280 In order to ensure a correct intialization of the device, the driver
281 _must_know_ how the device will be used:
282 * if DTS is choosen, only Interface 2 with AltSet nb.6 must be
284 * if 96KHz only AltSets nb.1 of each interface must be selected
285 * if samples are using 24bits/48KHz then AltSet 2 must me used if
286 Digital input is connected, and only AltSet nb.3 if Digital input
288 * if samples are using 16bits/48KHz then AltSet 4 must me used if
289 Digital input is connected, and only AltSet nb.5 if Digital input
292 When device_setup is given as a parameter to the snd-usb-audio module, the
293 parse_audio_enpoint function uses a quirk called
294 "audiophile_skip_setting_quirk" in order to prevent AltSettings not
295 corresponding to device_setup from being registered in the driver.
297 3 - Audiophile USB and Jack support
298 ===================================
300 This section deals with support of the Audiophile USB device in Jack.
301 The main issue regarding this support is that the device is Big Endian
304 3.1 - Using the plug alsa plugin
305 --------------------------------
307 Jack doesn't directly support big endian devices. Thus, one way to have support
308 for this device with Alsa is to use the Alsa "plug" converter.
310 For instance here is one way to run Jack with 2 playback channels on Ao and 2
311 capture channels from Ai:
312 % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1
315 However you may see the following warning message:
316 "You appear to be using the ALSA software "plug" layer, probably a result of
317 using the "default" ALSA device. This is less efficient than it could be.
318 Consider using a hardware device instead rather than using the plug layer."
321 3.2 - Patching alsa to use direct pcm device
322 -------------------------------------------
323 A patch for Jack by Andreas Steinmetz adds support for Big Endian devices.
324 However it has not been included in the CVS tree.
326 You can find it at the following URL:
327 http://sourceforge.net/tracker/index.php?func=detail&aid=1289682&group_id=39687&
330 After having applied the patch you can run jackd with the following command
332 % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1