xref: /linux/Documentation/sound/cards/audiophile-usb.rst (revision 9095bf25ea08135a5b74875dd0e3eeaddc4218a0)
1*4e47556eSTakashi Iwai========================================================
2*4e47556eSTakashi IwaiGuide to using M-Audio Audiophile USB with ALSA and Jack
3*4e47556eSTakashi Iwai========================================================
4*4e47556eSTakashi Iwai
5*4e47556eSTakashi Iwaiv1.5
6*4e47556eSTakashi Iwai
7*4e47556eSTakashi IwaiThibault Le Meur <Thibault.LeMeur@supelec.fr>
8*4e47556eSTakashi Iwai
9*4e47556eSTakashi IwaiThis document is a guide to using the M-Audio Audiophile USB (tm) device with
10*4e47556eSTakashi IwaiALSA and JACK.
11*4e47556eSTakashi Iwai
12*4e47556eSTakashi IwaiHistory
13*4e47556eSTakashi Iwai=======
14*4e47556eSTakashi Iwai
15*4e47556eSTakashi Iwai* v1.4 - Thibault Le Meur (2007-07-11)
16*4e47556eSTakashi Iwai
17*4e47556eSTakashi Iwai  - Added Low Endianness nature of 16bits-modes
18*4e47556eSTakashi Iwai    found by Hakan Lennestal <Hakan.Lennestal@brfsodrahamn.se>
19*4e47556eSTakashi Iwai  - Modifying document structure
20*4e47556eSTakashi Iwai
21*4e47556eSTakashi Iwai* v1.5 - Thibault Le Meur (2007-07-12)
22*4e47556eSTakashi Iwai  - Added AC3/DTS passthru info
23*4e47556eSTakashi Iwai
24*4e47556eSTakashi Iwai
25*4e47556eSTakashi IwaiAudiophile USB Specs and correct usage
26*4e47556eSTakashi Iwai======================================
27*4e47556eSTakashi Iwai
28*4e47556eSTakashi IwaiThis part is a reminder of important facts about the functions and limitations
29*4e47556eSTakashi Iwaiof the device.
30*4e47556eSTakashi Iwai
31*4e47556eSTakashi IwaiThe device has 4 audio interfaces, and 2 MIDI ports:
32*4e47556eSTakashi Iwai
33*4e47556eSTakashi Iwai * Analog Stereo Input (Ai)
34*4e47556eSTakashi Iwai
35*4e47556eSTakashi Iwai   - This port supports 2 pairs of line-level audio inputs (1/4" TS and RCA)
36*4e47556eSTakashi Iwai   - When the 1/4" TS (jack) connectors are connected, the RCA connectors
37*4e47556eSTakashi Iwai     are disabled
38*4e47556eSTakashi Iwai
39*4e47556eSTakashi Iwai * Analog Stereo Output (Ao)
40*4e47556eSTakashi Iwai * Digital Stereo Input (Di)
41*4e47556eSTakashi Iwai * Digital Stereo Output (Do)
42*4e47556eSTakashi Iwai * Midi In (Mi)
43*4e47556eSTakashi Iwai * Midi Out (Mo)
44*4e47556eSTakashi Iwai
45*4e47556eSTakashi IwaiThe internal DAC/ADC has the following characteristics:
46*4e47556eSTakashi Iwai
47*4e47556eSTakashi Iwai* sample depth of 16 or 24 bits
48*4e47556eSTakashi Iwai* sample rate from 8kHz to 96kHz
49*4e47556eSTakashi Iwai* Two interfaces can't use different sample depths at the same time.
50*4e47556eSTakashi Iwai
51*4e47556eSTakashi IwaiMoreover, the Audiophile USB documentation gives the following Warning:
52*4e47556eSTakashi Iwai  Please exit any audio application running before switching between bit depths
53*4e47556eSTakashi Iwai
54*4e47556eSTakashi IwaiDue to the USB 1.1 bandwidth limitation, a limited number of interfaces can be
55*4e47556eSTakashi Iwaiactivated at the same time depending on the audio mode selected:
56*4e47556eSTakashi Iwai
57*4e47556eSTakashi Iwai * 16-bit/48kHz ==> 4 channels in + 4 channels out
58*4e47556eSTakashi Iwai
59*4e47556eSTakashi Iwai   - Ai+Ao+Di+Do
60*4e47556eSTakashi Iwai
61*4e47556eSTakashi Iwai * 24-bit/48kHz ==> 4 channels in + 2 channels out,
62*4e47556eSTakashi Iwai   or 2 channels in + 4 channels out
63*4e47556eSTakashi Iwai
64*4e47556eSTakashi Iwai   - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do
65*4e47556eSTakashi Iwai
66*4e47556eSTakashi Iwai * 24-bit/96kHz ==> 2 channels in _or_ 2 channels out (half duplex only)
67*4e47556eSTakashi Iwai
68*4e47556eSTakashi Iwai   - Ai or Ao or Di or Do
69*4e47556eSTakashi Iwai
70*4e47556eSTakashi IwaiImportant facts about the Digital interface:
71*4e47556eSTakashi Iwai--------------------------------------------
72*4e47556eSTakashi Iwai
73*4e47556eSTakashi Iwai * The Do port additionally supports surround-encoded AC-3 and DTS passthrough,
74*4e47556eSTakashi Iwai   though I haven't tested it under Linux
75*4e47556eSTakashi Iwai
76*4e47556eSTakashi Iwai   - Note that in this setup only the Do interface can be enabled
77*4e47556eSTakashi Iwai
78*4e47556eSTakashi Iwai * Apart from recording an audio digital stream, enabling the Di port is a way
79*4e47556eSTakashi Iwai   to synchronize the device to an external sample clock
80*4e47556eSTakashi Iwai
81*4e47556eSTakashi Iwai   - As a consequence, the Di port must be enable only if an active Digital
82*4e47556eSTakashi Iwai     source is connected
83*4e47556eSTakashi Iwai   - Enabling Di when no digital source is connected can result in a
84*4e47556eSTakashi Iwai     synchronization error (for instance sound played at an odd sample rate)
85*4e47556eSTakashi Iwai
86*4e47556eSTakashi Iwai
87*4e47556eSTakashi IwaiAudiophile USB MIDI support in ALSA
88*4e47556eSTakashi Iwai===================================
89*4e47556eSTakashi Iwai
90*4e47556eSTakashi IwaiThe Audiophile USB MIDI ports will be automatically supported once the
91*4e47556eSTakashi Iwaifollowing modules have been loaded:
92*4e47556eSTakashi Iwai
93*4e47556eSTakashi Iwai * snd-usb-audio
94*4e47556eSTakashi Iwai * snd-seq-midi
95*4e47556eSTakashi Iwai
96*4e47556eSTakashi IwaiNo additional setting is required.
97*4e47556eSTakashi Iwai
98*4e47556eSTakashi Iwai
99*4e47556eSTakashi IwaiAudiophile USB Audio support in ALSA
100*4e47556eSTakashi Iwai====================================
101*4e47556eSTakashi Iwai
102*4e47556eSTakashi IwaiAudio functions of the Audiophile USB device are handled by the snd-usb-audio
103*4e47556eSTakashi Iwaimodule. This module can work in a default mode (without any device-specific
104*4e47556eSTakashi Iwaiparameter), or in an "advanced" mode with the device-specific parameter called
105*4e47556eSTakashi Iwai``device_setup``.
106*4e47556eSTakashi Iwai
107*4e47556eSTakashi IwaiDefault Alsa driver mode
108*4e47556eSTakashi Iwai------------------------
109*4e47556eSTakashi Iwai
110*4e47556eSTakashi IwaiThe default behavior of the snd-usb-audio driver is to list the device
111*4e47556eSTakashi Iwaicapabilities at startup and activate the required mode when required
112*4e47556eSTakashi Iwaiby the applications: for instance if the user is recording in a
113*4e47556eSTakashi Iwai24bit-depth-mode and immediately after wants to switch to a 16bit-depth mode,
114*4e47556eSTakashi Iwaithe snd-usb-audio module will reconfigure the device on the fly.
115*4e47556eSTakashi Iwai
116*4e47556eSTakashi IwaiThis approach has the advantage to let the driver automatically switch from sample
117*4e47556eSTakashi Iwairates/depths automatically according to the user's needs. However, those who
118*4e47556eSTakashi Iwaiare using the device under windows know that this is not how the device is meant to
119*4e47556eSTakashi Iwaiwork: under windows applications must be closed before using the m-audio control
120*4e47556eSTakashi Iwaipanel to switch the device working mode. Thus as we'll see in next section, this
121*4e47556eSTakashi IwaiDefault Alsa driver mode can lead to device misconfigurations.
122*4e47556eSTakashi Iwai
123*4e47556eSTakashi IwaiLet's get back to the Default Alsa driver mode for now.  In this case the
124*4e47556eSTakashi IwaiAudiophile interfaces are mapped to alsa pcm devices in the following
125*4e47556eSTakashi Iwaiway (I suppose the device's index is 1):
126*4e47556eSTakashi Iwai
127*4e47556eSTakashi Iwai * hw:1,0 is Ao in playback and Di in capture
128*4e47556eSTakashi Iwai * hw:1,1 is Do in playback and Ai in capture
129*4e47556eSTakashi Iwai * hw:1,2 is Do in AC3/DTS passthrough mode
130*4e47556eSTakashi Iwai
131*4e47556eSTakashi IwaiIn this mode, the device uses Big Endian byte-encoding so that
132*4e47556eSTakashi Iwaisupported audio format are S16_BE for 16-bit depth modes and S24_3BE for
133*4e47556eSTakashi Iwai24-bits depth mode.
134*4e47556eSTakashi Iwai
135*4e47556eSTakashi IwaiOne exception is the hw:1,2 port which was reported to be Little Endian
136*4e47556eSTakashi Iwaicompliant (supposedly supporting S16_LE) but processes in fact only S16_BE streams.
137*4e47556eSTakashi IwaiThis has been fixed in kernel 2.6.23 and above and now the hw:1,2 interface
138*4e47556eSTakashi Iwaiis reported to be big endian in this default driver mode.
139*4e47556eSTakashi Iwai
140*4e47556eSTakashi IwaiExamples:
141*4e47556eSTakashi Iwai
142*4e47556eSTakashi Iwai * playing a S24_3BE encoded raw file to the Ao port::
143*4e47556eSTakashi Iwai
144*4e47556eSTakashi Iwai   % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw
145*4e47556eSTakashi Iwai
146*4e47556eSTakashi Iwai * recording a  S24_3BE encoded raw file from the Ai port::
147*4e47556eSTakashi Iwai
148*4e47556eSTakashi Iwai   % arecord -D hw:1,1 -c2  -t raw -r48000 -fS24_3BE test.raw
149*4e47556eSTakashi Iwai
150*4e47556eSTakashi Iwai * playing a S16_BE encoded raw file to the Do port::
151*4e47556eSTakashi Iwai
152*4e47556eSTakashi Iwai   % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw
153*4e47556eSTakashi Iwai
154*4e47556eSTakashi Iwai * playing an ac3 sample file to the Do port::
155*4e47556eSTakashi Iwai
156*4e47556eSTakashi Iwai   % aplay -D hw:1,2 --channels=6 ac3_S16_BE_encoded_file.raw
157*4e47556eSTakashi Iwai
158*4e47556eSTakashi IwaiIf you're happy with the default Alsa driver mode and don't experience any
159*4e47556eSTakashi Iwaiissue with this mode, then you can skip the following chapter.
160*4e47556eSTakashi Iwai
161*4e47556eSTakashi IwaiAdvanced module setup
162*4e47556eSTakashi Iwai---------------------
163*4e47556eSTakashi Iwai
164*4e47556eSTakashi IwaiDue to the hardware constraints described above, the device initialization made
165*4e47556eSTakashi Iwaiby the Alsa driver in default mode may result in a corrupted state of the
166*4e47556eSTakashi Iwaidevice. For instance, a particularly annoying issue is that the sound captured
167*4e47556eSTakashi Iwaifrom the Ai interface sounds distorted (as if boosted with an excessive high
168*4e47556eSTakashi Iwaivolume gain).
169*4e47556eSTakashi Iwai
170*4e47556eSTakashi IwaiFor people having this problem, the snd-usb-audio module has a new module
171*4e47556eSTakashi Iwaiparameter called ``device_setup`` (this parameter was introduced in kernel
172*4e47556eSTakashi Iwairelease 2.6.17)
173*4e47556eSTakashi Iwai
174*4e47556eSTakashi IwaiInitializing the working mode of the Audiophile USB
175*4e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
176*4e47556eSTakashi Iwai
177*4e47556eSTakashi IwaiAs far as the Audiophile USB device is concerned, this value let the user
178*4e47556eSTakashi Iwaispecify:
179*4e47556eSTakashi Iwai
180*4e47556eSTakashi Iwai * the sample depth
181*4e47556eSTakashi Iwai * the sample rate
182*4e47556eSTakashi Iwai * whether the Di port is used or not
183*4e47556eSTakashi Iwai
184*4e47556eSTakashi IwaiWhen initialized with ``device_setup=0x00``, the snd-usb-audio module has
185*4e47556eSTakashi Iwaithe same behaviour as when the parameter is omitted (see paragraph "Default
186*4e47556eSTakashi IwaiAlsa driver mode" above)
187*4e47556eSTakashi Iwai
188*4e47556eSTakashi IwaiOthers modes are described in the following subsections.
189*4e47556eSTakashi Iwai
190*4e47556eSTakashi Iwai16-bit modes
191*4e47556eSTakashi Iwai~~~~~~~~~~~~
192*4e47556eSTakashi Iwai
193*4e47556eSTakashi IwaiThe two supported modes are:
194*4e47556eSTakashi Iwai
195*4e47556eSTakashi Iwai * ``device_setup=0x01``
196*4e47556eSTakashi Iwai
197*4e47556eSTakashi Iwai   - 16bits 48kHz mode with Di disabled
198*4e47556eSTakashi Iwai   - Ai,Ao,Do can be used at the same time
199*4e47556eSTakashi Iwai   - hw:1,0 is not available in capture mode
200*4e47556eSTakashi Iwai   - hw:1,2 is not available
201*4e47556eSTakashi Iwai
202*4e47556eSTakashi Iwai * ``device_setup=0x11``
203*4e47556eSTakashi Iwai
204*4e47556eSTakashi Iwai   - 16bits 48kHz mode with Di enabled
205*4e47556eSTakashi Iwai   - Ai,Ao,Di,Do can be used at the same time
206*4e47556eSTakashi Iwai   - hw:1,0 is available in capture mode
207*4e47556eSTakashi Iwai   - hw:1,2 is not available
208*4e47556eSTakashi Iwai
209*4e47556eSTakashi IwaiIn this modes the device operates only at 16bits-modes. Before kernel 2.6.23,
210*4e47556eSTakashi Iwaithe devices where reported to be Big-Endian when in fact they were Little-Endian
211*4e47556eSTakashi Iwaiso that playing a file was a matter of using:
212*4e47556eSTakashi Iwai::
213*4e47556eSTakashi Iwai
214*4e47556eSTakashi Iwai   % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test_S16_LE.raw
215*4e47556eSTakashi Iwai
216*4e47556eSTakashi Iwaiwhere "test_S16_LE.raw" was in fact a little-endian sample file.
217*4e47556eSTakashi Iwai
218*4e47556eSTakashi IwaiThanks to Hakan Lennestal (who discovered the Little-Endiannes of the device in
219*4e47556eSTakashi Iwaithese modes) a fix has been committed (expected in kernel 2.6.23) and
220*4e47556eSTakashi IwaiAlsa now reports Little-Endian interfaces. Thus playing a file now is as simple as
221*4e47556eSTakashi Iwaiusing:
222*4e47556eSTakashi Iwai::
223*4e47556eSTakashi Iwai
224*4e47556eSTakashi Iwai   % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_LE test_S16_LE.raw
225*4e47556eSTakashi Iwai
226*4e47556eSTakashi Iwai
227*4e47556eSTakashi Iwai24-bit modes
228*4e47556eSTakashi Iwai~~~~~~~~~~~~
229*4e47556eSTakashi Iwai
230*4e47556eSTakashi IwaiThe three supported modes are:
231*4e47556eSTakashi Iwai
232*4e47556eSTakashi Iwai * ``device_setup=0x09``
233*4e47556eSTakashi Iwai
234*4e47556eSTakashi Iwai   - 24bits 48kHz mode with Di disabled
235*4e47556eSTakashi Iwai   - Ai,Ao,Do can be used at the same time
236*4e47556eSTakashi Iwai   - hw:1,0 is not available in capture mode
237*4e47556eSTakashi Iwai   - hw:1,2 is not available
238*4e47556eSTakashi Iwai
239*4e47556eSTakashi Iwai * ``device_setup=0x19``
240*4e47556eSTakashi Iwai
241*4e47556eSTakashi Iwai   - 24bits 48kHz mode with Di enabled
242*4e47556eSTakashi Iwai   - 3 ports from {Ai,Ao,Di,Do} can be used at the same time
243*4e47556eSTakashi Iwai   - hw:1,0 is available in capture mode and an active digital source must be
244*4e47556eSTakashi Iwai     connected to Di
245*4e47556eSTakashi Iwai   - hw:1,2 is not available
246*4e47556eSTakashi Iwai
247*4e47556eSTakashi Iwai * ``device_setup=0x0D`` or ``0x10``
248*4e47556eSTakashi Iwai
249*4e47556eSTakashi Iwai   - 24bits 96kHz mode
250*4e47556eSTakashi Iwai   - Di is enabled by default for this mode but does not need to be connected
251*4e47556eSTakashi Iwai     to an active source
252*4e47556eSTakashi Iwai   - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time
253*4e47556eSTakashi Iwai   - hw:1,0 is available in captured mode
254*4e47556eSTakashi Iwai   - hw:1,2 is not available
255*4e47556eSTakashi Iwai
256*4e47556eSTakashi IwaiIn these modes the device is only Big-Endian compliant (see "Default Alsa driver
257*4e47556eSTakashi Iwaimode" above for an aplay command example)
258*4e47556eSTakashi Iwai
259*4e47556eSTakashi IwaiAC3 w/ DTS passthru mode
260*4e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~
261*4e47556eSTakashi Iwai
262*4e47556eSTakashi IwaiThanks to Hakan Lennestal, I now have a report saying that this mode works.
263*4e47556eSTakashi Iwai
264*4e47556eSTakashi Iwai * ``device_setup=0x03``
265*4e47556eSTakashi Iwai
266*4e47556eSTakashi Iwai   - 16bits 48kHz mode with only the Do port enabled
267*4e47556eSTakashi Iwai   - AC3 with DTS passthru
268*4e47556eSTakashi Iwai   - Caution with this setup the Do port is mapped to the pcm device hw:1,0
269*4e47556eSTakashi Iwai
270*4e47556eSTakashi IwaiThe command line used to playback the AC3/DTS encoded .wav-files in this mode:
271*4e47556eSTakashi Iwai::
272*4e47556eSTakashi Iwai
273*4e47556eSTakashi Iwai   % aplay -D hw:1,0 --channels=6 ac3_S16_LE_encoded_file.raw
274*4e47556eSTakashi Iwai
275*4e47556eSTakashi IwaiHow to use the ``device_setup`` parameter
276*4e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
277*4e47556eSTakashi Iwai
278*4e47556eSTakashi IwaiThe parameter can be given:
279*4e47556eSTakashi Iwai
280*4e47556eSTakashi Iwai * By manually probing the device (as root):::
281*4e47556eSTakashi Iwai
282*4e47556eSTakashi Iwai   # modprobe -r snd-usb-audio
283*4e47556eSTakashi Iwai   # modprobe snd-usb-audio index=1 device_setup=0x09
284*4e47556eSTakashi Iwai
285*4e47556eSTakashi Iwai * Or while configuring the modules options in your modules configuration file
286*4e47556eSTakashi Iwai   (typically a .conf file in /etc/modprobe.d/ directory:::
287*4e47556eSTakashi Iwai
288*4e47556eSTakashi Iwai       alias snd-card-1 snd-usb-audio
289*4e47556eSTakashi Iwai       options snd-usb-audio index=1 device_setup=0x09
290*4e47556eSTakashi Iwai
291*4e47556eSTakashi IwaiCAUTION when initializing the device
292*4e47556eSTakashi Iwai-------------------------------------
293*4e47556eSTakashi Iwai
294*4e47556eSTakashi Iwai * Correct initialization on the device requires that device_setup is given to
295*4e47556eSTakashi Iwai   the module BEFORE the device is turned on. So, if you use the "manual probing"
296*4e47556eSTakashi Iwai   method described above, take care to power-on the device AFTER this initialization.
297*4e47556eSTakashi Iwai
298*4e47556eSTakashi Iwai * Failing to respect this will lead to a misconfiguration of the device. In this case
299*4e47556eSTakashi Iwai   turn off the device, unprobe the snd-usb-audio module, then probe it again with
300*4e47556eSTakashi Iwai   correct device_setup parameter and then (and only then) turn on the device again.
301*4e47556eSTakashi Iwai
302*4e47556eSTakashi Iwai * If you've correctly initialized the device in a valid mode and then want to switch
303*4e47556eSTakashi Iwai   to  another mode (possibly with another sample-depth), please use also the following
304*4e47556eSTakashi Iwai   procedure:
305*4e47556eSTakashi Iwai
306*4e47556eSTakashi Iwai   - first turn off the device
307*4e47556eSTakashi Iwai   - de-register the snd-usb-audio module (modprobe -r)
308*4e47556eSTakashi Iwai   - change the device_setup parameter by changing the device_setup
309*4e47556eSTakashi Iwai     option in ``/etc/modprobe.d/*.conf``
310*4e47556eSTakashi Iwai   - turn on the device
311*4e47556eSTakashi Iwai
312*4e47556eSTakashi Iwai * A workaround for this last issue has been applied to kernel 2.6.23, but it may not
313*4e47556eSTakashi Iwai   be enough to ensure the 'stability' of the device initialization.
314*4e47556eSTakashi Iwai
315*4e47556eSTakashi IwaiTechnical details for hackers
316*4e47556eSTakashi Iwai-----------------------------
317*4e47556eSTakashi Iwai
318*4e47556eSTakashi IwaiThis section is for hackers, wanting to understand details about the device
319*4e47556eSTakashi Iwaiinternals and how Alsa supports it.
320*4e47556eSTakashi Iwai
321*4e47556eSTakashi IwaiAudiophile USB's ``device_setup`` structure
322*4e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
323*4e47556eSTakashi Iwai
324*4e47556eSTakashi IwaiIf you want to understand the device_setup magic numbers for the Audiophile
325*4e47556eSTakashi IwaiUSB, you need some very basic understanding of binary computation. However,
326*4e47556eSTakashi Iwaithis is not required to use the parameter and you may skip this section.
327*4e47556eSTakashi Iwai
328*4e47556eSTakashi IwaiThe device_setup is one byte long and its structure is the following:
329*4e47556eSTakashi Iwai::
330*4e47556eSTakashi Iwai
331*4e47556eSTakashi Iwai       +---+---+---+---+---+---+---+---+
332*4e47556eSTakashi Iwai       | b7| b6| b5| b4| b3| b2| b1| b0|
333*4e47556eSTakashi Iwai       +---+---+---+---+---+---+---+---+
334*4e47556eSTakashi Iwai       | 0 | 0 | 0 | Di|24B|96K|DTS|SET|
335*4e47556eSTakashi Iwai       +---+---+---+---+---+---+---+---+
336*4e47556eSTakashi Iwai
337*4e47556eSTakashi IwaiWhere:
338*4e47556eSTakashi Iwai
339*4e47556eSTakashi Iwai * b0 is the ``SET`` bit
340*4e47556eSTakashi Iwai
341*4e47556eSTakashi Iwai   - it MUST be set if device_setup is initialized
342*4e47556eSTakashi Iwai
343*4e47556eSTakashi Iwai * b1 is the ``DTS`` bit
344*4e47556eSTakashi Iwai
345*4e47556eSTakashi Iwai   - it is set only for Digital output with DTS/AC3
346*4e47556eSTakashi Iwai   - this setup is not tested
347*4e47556eSTakashi Iwai
348*4e47556eSTakashi Iwai * b2 is the Rate selection flag
349*4e47556eSTakashi Iwai
350*4e47556eSTakashi Iwai   - When set to ``1`` the rate range is 48.1-96kHz
351*4e47556eSTakashi Iwai   - Otherwise the sample rate range is 8-48kHz
352*4e47556eSTakashi Iwai
353*4e47556eSTakashi Iwai * b3 is the bit depth selection flag
354*4e47556eSTakashi Iwai
355*4e47556eSTakashi Iwai   - When set to ``1`` samples are 24bits long
356*4e47556eSTakashi Iwai   - Otherwise they are 16bits long
357*4e47556eSTakashi Iwai   - Note that b2 implies b3 as the 96kHz mode is only supported for 24 bits
358*4e47556eSTakashi Iwai     samples
359*4e47556eSTakashi Iwai
360*4e47556eSTakashi Iwai * b4 is the Digital input flag
361*4e47556eSTakashi Iwai
362*4e47556eSTakashi Iwai   - When set to ``1`` the device assumes that an active digital source is
363*4e47556eSTakashi Iwai     connected
364*4e47556eSTakashi Iwai   - You shouldn't enable Di if no source is seen on the port (this leads to
365*4e47556eSTakashi Iwai     synchronization issues)
366*4e47556eSTakashi Iwai   - b4 is implied by b2 (since only one port is enabled at a time no synch
367*4e47556eSTakashi Iwai     error can occur)
368*4e47556eSTakashi Iwai
369*4e47556eSTakashi Iwai * b5 to b7 are reserved for future uses, and must be set to ``0``
370*4e47556eSTakashi Iwai
371*4e47556eSTakashi Iwai   - might become Ao, Do, Ai, for b7, b6, b4 respectively
372*4e47556eSTakashi Iwai
373*4e47556eSTakashi IwaiCaution:
374*4e47556eSTakashi Iwai
375*4e47556eSTakashi Iwai * there is no check on the value you will give to device_setup
376*4e47556eSTakashi Iwai
377*4e47556eSTakashi Iwai   - for instance choosing 0x05 (16bits 96kHz) will fail back to 0x09 since
378*4e47556eSTakashi Iwai     b2 implies b3. But _there_will_be_no_warning_ in /var/log/messages
379*4e47556eSTakashi Iwai
380*4e47556eSTakashi Iwai * Hardware constraints due to the USB bus limitation aren't checked
381*4e47556eSTakashi Iwai
382*4e47556eSTakashi Iwai   - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll
383*4e47556eSTakashi Iwai     only be able to use one at the same time
384*4e47556eSTakashi Iwai
385*4e47556eSTakashi IwaiUSB implementation details for this device
386*4e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
387*4e47556eSTakashi Iwai
388*4e47556eSTakashi IwaiYou may safely skip this section if you're not interested in driver
389*4e47556eSTakashi Iwaihacking.
390*4e47556eSTakashi Iwai
391*4e47556eSTakashi IwaiThis section describes some internal aspects of the device and summarizes the
392*4e47556eSTakashi Iwaidata I got by usb-snooping the windows and Linux drivers.
393*4e47556eSTakashi Iwai
394*4e47556eSTakashi IwaiThe M-Audio Audiophile USB has 7 USB Interfaces:
395*4e47556eSTakashi Iwaia "USB interface":
396*4e47556eSTakashi Iwai
397*4e47556eSTakashi Iwai * USB Interface nb.0
398*4e47556eSTakashi Iwai * USB Interface nb.1
399*4e47556eSTakashi Iwai
400*4e47556eSTakashi Iwai   - Audio Control function
401*4e47556eSTakashi Iwai
402*4e47556eSTakashi Iwai * USB Interface nb.2
403*4e47556eSTakashi Iwai
404*4e47556eSTakashi Iwai   - Analog Output
405*4e47556eSTakashi Iwai
406*4e47556eSTakashi Iwai * USB Interface nb.3
407*4e47556eSTakashi Iwai
408*4e47556eSTakashi Iwai   - Digital Output
409*4e47556eSTakashi Iwai
410*4e47556eSTakashi Iwai * USB Interface nb.4
411*4e47556eSTakashi Iwai
412*4e47556eSTakashi Iwai   - Analog Input
413*4e47556eSTakashi Iwai
414*4e47556eSTakashi Iwai * USB Interface nb.5
415*4e47556eSTakashi Iwai
416*4e47556eSTakashi Iwai   - Digital Input
417*4e47556eSTakashi Iwai
418*4e47556eSTakashi Iwai * USB Interface nb.6
419*4e47556eSTakashi Iwai
420*4e47556eSTakashi Iwai   - MIDI interface compliant with the MIDIMAN quirk
421*4e47556eSTakashi Iwai
422*4e47556eSTakashi IwaiEach interface has 5 altsettings (AltSet 1,2,3,4,5) except:
423*4e47556eSTakashi Iwai
424*4e47556eSTakashi Iwai * Interface 3 (Digital Out) has an extra Alset nb.6
425*4e47556eSTakashi Iwai * Interface 5 (Digital In) does not have Alset nb.3 and 5
426*4e47556eSTakashi Iwai
427*4e47556eSTakashi IwaiHere is a short description of the AltSettings capabilities:
428*4e47556eSTakashi Iwai
429*4e47556eSTakashi Iwai* AltSettings 1 corresponds to
430*4e47556eSTakashi Iwai
431*4e47556eSTakashi Iwai  - 24-bit depth, 48.1-96kHz sample mode
432*4e47556eSTakashi Iwai  - Adaptive playback (Ao and Do), Synch capture (Ai), or Asynch capture (Di)
433*4e47556eSTakashi Iwai
434*4e47556eSTakashi Iwai* AltSettings 2 corresponds to
435*4e47556eSTakashi Iwai
436*4e47556eSTakashi Iwai  - 24-bit depth, 8-48kHz sample mode
437*4e47556eSTakashi Iwai  - Asynch capture and playback  (Ao,Ai,Do,Di)
438*4e47556eSTakashi Iwai
439*4e47556eSTakashi Iwai* AltSettings 3 corresponds to
440*4e47556eSTakashi Iwai
441*4e47556eSTakashi Iwai  - 24-bit depth, 8-48kHz sample mode
442*4e47556eSTakashi Iwai  - Synch capture (Ai) and Adaptive playback (Ao,Do)
443*4e47556eSTakashi Iwai
444*4e47556eSTakashi Iwai* AltSettings 4 corresponds to
445*4e47556eSTakashi Iwai
446*4e47556eSTakashi Iwai  - 16-bit depth, 8-48kHz sample mode
447*4e47556eSTakashi Iwai  - Asynch capture and playback  (Ao,Ai,Do,Di)
448*4e47556eSTakashi Iwai
449*4e47556eSTakashi Iwai* AltSettings 5 corresponds to
450*4e47556eSTakashi Iwai
451*4e47556eSTakashi Iwai  - 16-bit depth, 8-48kHz sample mode
452*4e47556eSTakashi Iwai  - Synch capture (Ai) and Adaptive playback (Ao,Do)
453*4e47556eSTakashi Iwai
454*4e47556eSTakashi Iwai* AltSettings 6 corresponds to
455*4e47556eSTakashi Iwai
456*4e47556eSTakashi Iwai  - 16-bit depth, 8-48kHz sample mode
457*4e47556eSTakashi Iwai  - Synch playback (Do), audio format type III IEC1937_AC-3
458*4e47556eSTakashi Iwai
459*4e47556eSTakashi IwaiIn order to ensure a correct initialization of the device, the driver
460*4e47556eSTakashi Iwai*must* *know* how the device will be used:
461*4e47556eSTakashi Iwai
462*4e47556eSTakashi Iwai * if DTS is chosen, only Interface 2 with AltSet nb.6 must be
463*4e47556eSTakashi Iwai   registered
464*4e47556eSTakashi Iwai * if 96KHz only AltSets nb.1 of each interface must be selected
465*4e47556eSTakashi Iwai * if samples are using 24bits/48KHz then AltSet 2 must me used if
466*4e47556eSTakashi Iwai   Digital input is connected, and only AltSet nb.3 if Digital input
467*4e47556eSTakashi Iwai   is not connected
468*4e47556eSTakashi Iwai * if samples are using 16bits/48KHz then AltSet 4 must me used if
469*4e47556eSTakashi Iwai   Digital input is connected, and only AltSet nb.5 if Digital input
470*4e47556eSTakashi Iwai   is not connected
471*4e47556eSTakashi Iwai
472*4e47556eSTakashi IwaiWhen device_setup is given as a parameter to the snd-usb-audio module, the
473*4e47556eSTakashi Iwaiparse_audio_endpoints function uses a quirk called
474*4e47556eSTakashi Iwai``audiophile_skip_setting_quirk`` in order to prevent AltSettings not
475*4e47556eSTakashi Iwaicorresponding to device_setup from being registered in the driver.
476*4e47556eSTakashi Iwai
477*4e47556eSTakashi IwaiAudiophile USB and Jack support
478*4e47556eSTakashi Iwai===============================
479*4e47556eSTakashi Iwai
480*4e47556eSTakashi IwaiThis section deals with support of the Audiophile USB device in Jack.
481*4e47556eSTakashi Iwai
482*4e47556eSTakashi IwaiThere are 2 main potential issues when using Jackd with the device:
483*4e47556eSTakashi Iwai
484*4e47556eSTakashi Iwai* support for Big-Endian devices in 24-bit modes
485*4e47556eSTakashi Iwai* support for 4-in / 4-out channels
486*4e47556eSTakashi Iwai
487*4e47556eSTakashi IwaiDirect support in Jackd
488*4e47556eSTakashi Iwai-----------------------
489*4e47556eSTakashi Iwai
490*4e47556eSTakashi IwaiJack supports big endian devices only in recent versions (thanks to
491*4e47556eSTakashi IwaiAndreas Steinmetz for his first big-endian patch). I can't remember
492*4e47556eSTakashi Iwaiexactly when this support was released into jackd, let's just say that
493*4e47556eSTakashi Iwaiwith jackd version 0.103.0 it's almost ok (just a small bug is affecting
494*4e47556eSTakashi Iwai16bits Big-Endian devices, but since you've read carefully the above
495*4e47556eSTakashi Iwaiparagraphs, you're now using kernel >= 2.6.23 and your 16bits devices
496*4e47556eSTakashi Iwaiare now Little Endians ;-) ).
497*4e47556eSTakashi Iwai
498*4e47556eSTakashi IwaiYou can run jackd with the following command for playback with Ao and
499*4e47556eSTakashi Iwairecord with Ai:
500*4e47556eSTakashi Iwai::
501*4e47556eSTakashi Iwai
502*4e47556eSTakashi Iwai  % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1
503*4e47556eSTakashi Iwai
504*4e47556eSTakashi IwaiUsing Alsa plughw
505*4e47556eSTakashi Iwai-----------------
506*4e47556eSTakashi Iwai
507*4e47556eSTakashi IwaiIf you don't have a recent Jackd installed, you can downgrade to using
508*4e47556eSTakashi Iwaithe Alsa ``plug`` converter.
509*4e47556eSTakashi Iwai
510*4e47556eSTakashi IwaiFor instance here is one way to run Jack with 2 playback channels on Ao and 2
511*4e47556eSTakashi Iwaicapture channels from Ai:
512*4e47556eSTakashi Iwai::
513*4e47556eSTakashi Iwai
514*4e47556eSTakashi Iwai  % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1
515*4e47556eSTakashi Iwai
516*4e47556eSTakashi IwaiHowever you may see the following warning message:
517*4e47556eSTakashi Iwai  You appear to be using the ALSA software "plug" layer, probably a result of
518*4e47556eSTakashi Iwai  using the "default" ALSA device. This is less efficient than it could be.
519*4e47556eSTakashi Iwai  Consider using a hardware device instead rather than using the plug layer.
520*4e47556eSTakashi Iwai
521*4e47556eSTakashi IwaiGetting 2 input and/or output interfaces in Jack
522*4e47556eSTakashi Iwai------------------------------------------------
523*4e47556eSTakashi Iwai
524*4e47556eSTakashi IwaiAs you can see, starting the Jack server this way will only enable 1 stereo
525*4e47556eSTakashi Iwaiinput (Di or Ai) and 1 stereo output (Ao or Do).
526*4e47556eSTakashi Iwai
527*4e47556eSTakashi IwaiThis is due to the following restrictions:
528*4e47556eSTakashi Iwai
529*4e47556eSTakashi Iwai* Jack can only open one capture device and one playback device at a time
530*4e47556eSTakashi Iwai* The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1
531*4e47556eSTakashi Iwai  (and optionally hw:1,2)
532*4e47556eSTakashi Iwai
533*4e47556eSTakashi IwaiIf you want to get Ai+Di and/or Ao+Do support with Jack, you would need to
534*4e47556eSTakashi Iwaicombine the Alsa devices into one logical "complex" device.
535*4e47556eSTakashi Iwai
536*4e47556eSTakashi IwaiIf you want to give it a try, I recommend reading the information from
537*4e47556eSTakashi Iwaithis page: http://www.sound-man.co.uk/linuxaudio/ice1712multi.html
538*4e47556eSTakashi IwaiIt is related to another device (ice1712) but can be adapted to suit
539*4e47556eSTakashi Iwaithe Audiophile USB.
540*4e47556eSTakashi Iwai
541*4e47556eSTakashi IwaiEnabling multiple Audiophile USB interfaces for Jackd will certainly require:
542*4e47556eSTakashi Iwai
543*4e47556eSTakashi Iwai* Making sure your Jackd version has the MMAP_COMPLEX patch (see the ice1712 page)
544*4e47556eSTakashi Iwai* (maybe) patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page)
545*4e47556eSTakashi Iwai* define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc
546*4e47556eSTakashi Iwai  file
547*4e47556eSTakashi Iwai* start jackd with this device
548*4e47556eSTakashi Iwai
549*4e47556eSTakashi IwaiI had no success in testing this for now, if you have any success with this kind
550*4e47556eSTakashi Iwaiof setup, please drop me an email.
551