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