1 ============================================== 2 Guide to using M-Audio Audiophile USB with ALS 3 ============================================== 4 5 v1.5 6 7 Thibault Le Meur <Thibault.LeMeur@supelec.fr> 8 9 This document is a guide to using the M-Audio 10 ALSA and JACK. 11 12 History 13 ======= 14 15 * v1.4 - Thibault Le Meur (2007-07-11) 16 17 - Added Low Endianness nature of 16bits-mode 18 found by Hakan Lennestal <Hakan.Lennestal@b 19 - Modifying document structure 20 21 * v1.5 - Thibault Le Meur (2007-07-12) 22 - Added AC3/DTS passthru info 23 24 25 Audiophile USB Specs and correct usage 26 ====================================== 27 28 This part is a reminder of important facts abo 29 of the device. 30 31 The device has 4 audio interfaces, and 2 MIDI 32 33 * Analog Stereo Input (Ai) 34 35 - This port supports 2 pairs of line-level 36 - When the 1/4" TS (jack) connectors are co 37 are disabled 38 39 * Analog Stereo Output (Ao) 40 * Digital Stereo Input (Di) 41 * Digital Stereo Output (Do) 42 * Midi In (Mi) 43 * Midi Out (Mo) 44 45 The internal DAC/ADC has the following charact 46 47 * sample depth of 16 or 24 bits 48 * sample rate from 8kHz to 96kHz 49 * Two interfaces can't use different sample de 50 51 Moreover, the Audiophile USB documentation giv 52 Please exit any audio application running be 53 54 Due to the USB 1.1 bandwidth limitation, a lim 55 activated at the same time depending on the au 56 57 * 16-bit/48kHz ==> 4 channels in + 4 channels 58 59 - Ai+Ao+Di+Do 60 61 * 24-bit/48kHz ==> 4 channels in + 2 channels 62 or 2 channels in + 4 channels out 63 64 - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao 65 66 * 24-bit/96kHz ==> 2 channels in _or_ 2 chann 67 68 - Ai or Ao or Di or Do 69 70 Important facts about the Digital interface: 71 -------------------------------------------- 72 73 * The Do port additionally supports surround- 74 though I haven't tested it under Linux 75 76 - Note that in this setup only the Do inter 77 78 * Apart from recording an audio digital strea 79 to synchronize the device to an external sa 80 81 - As a consequence, the Di port must be ena 82 source is connected 83 - Enabling Di when no digital source is con 84 synchronization error (for instance sound 85 86 87 Audiophile USB MIDI support in ALSA 88 =================================== 89 90 The Audiophile USB MIDI ports will be automati 91 following modules have been loaded: 92 93 * snd-usb-audio 94 * snd-seq-midi 95 96 No additional setting is required. 97 98 99 Audiophile USB Audio support in ALSA 100 ==================================== 101 102 Audio functions of the Audiophile USB device a 103 module. This module can work in a default mode 104 parameter), or in an "advanced" mode with the 105 ``device_setup``. 106 107 Default Alsa driver mode 108 ------------------------ 109 110 The default behavior of the snd-usb-audio driv 111 capabilities at startup and activate the requi 112 by the applications: for instance if the user 113 24bit-depth-mode and immediately after wants t 114 the snd-usb-audio module will reconfigure the 115 116 This approach has the advantage to let the dri 117 rates/depths automatically according to the us 118 are using the device under windows know that t 119 work: under windows applications must be close 120 panel to switch the device working mode. Thus 121 Default Alsa driver mode can lead to device mi 122 123 Let's get back to the Default Alsa driver mode 124 Audiophile interfaces are mapped to alsa pcm d 125 way (I suppose the device's index is 1): 126 127 * hw:1,0 is Ao in playback and Di in capture 128 * hw:1,1 is Do in playback and Ai in capture 129 * hw:1,2 is Do in AC3/DTS passthrough mode 130 131 In this mode, the device uses Big Endian byte- 132 supported audio format are S16_BE for 16-bit d 133 24-bits depth mode. 134 135 One exception is the hw:1,2 port which was rep 136 compliant (supposedly supporting S16_LE) but p 137 This has been fixed in kernel 2.6.23 and above 138 is reported to be big endian in this default d 139 140 Examples: 141 142 * playing a S24_3BE encoded raw file to the A 143 144 % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_ 145 146 * recording a S24_3BE encoded raw file from 147 148 % arecord -D hw:1,1 -c2 -t raw -r48000 -fS 149 150 * playing a S16_BE encoded raw file to the Do 151 152 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_ 153 154 * playing an ac3 sample file to the Do port:: 155 156 % aplay -D hw:1,2 --channels=6 ac3_S16_BE_e 157 158 If you're happy with the default Alsa driver m 159 issue with this mode, then you can skip the fo 160 161 Advanced module setup 162 --------------------- 163 164 Due to the hardware constraints described abov 165 by the Alsa driver in default mode may result 166 device. For instance, a particularly annoying 167 from the Ai interface sounds distorted (as if 168 volume gain). 169 170 For people having this problem, the snd-usb-au 171 parameter called ``device_setup`` (this parame 172 release 2.6.17) 173 174 Initializing the working mode of the Audiophil 175 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 176 177 As far as the Audiophile USB device is concern 178 specify: 179 180 * the sample depth 181 * the sample rate 182 * whether the Di port is used or not 183 184 When initialized with ``device_setup=0x00``, t 185 the same behaviour as when the parameter is om 186 Alsa driver mode" above) 187 188 Others modes are described in the following su 189 190 16-bit modes 191 ~~~~~~~~~~~~ 192 193 The two supported modes are: 194 195 * ``device_setup=0x01`` 196 197 - 16bits 48kHz mode with Di disabled 198 - Ai,Ao,Do can be used at the same time 199 - hw:1,0 is not available in capture mode 200 - hw:1,2 is not available 201 202 * ``device_setup=0x11`` 203 204 - 16bits 48kHz mode with Di enabled 205 - Ai,Ao,Di,Do can be used at the same time 206 - hw:1,0 is available in capture mode 207 - hw:1,2 is not available 208 209 In this modes the device operates only at 16bi 210 the devices where reported to be Big-Endian wh 211 so that playing a file was a matter of using: 212 :: 213 214 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_ 215 216 where "test_S16_LE.raw" was in fact a little-e 217 218 Thanks to Hakan Lennestal (who discovered the 219 these modes) a fix has been committed (expecte 220 Alsa now reports Little-Endian interfaces. Thu 221 using: 222 :: 223 224 % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_ 225 226 227 24-bit modes 228 ~~~~~~~~~~~~ 229 230 The three supported modes are: 231 232 * ``device_setup=0x09`` 233 234 - 24bits 48kHz mode with Di disabled 235 - Ai,Ao,Do can be used at the same time 236 - hw:1,0 is not available in capture mode 237 - hw:1,2 is not available 238 239 * ``device_setup=0x19`` 240 241 - 24bits 48kHz mode with Di enabled 242 - 3 ports from {Ai,Ao,Di,Do} can be used at 243 - hw:1,0 is available in capture mode and a 244 connected to Di 245 - hw:1,2 is not available 246 247 * ``device_setup=0x0D`` or ``0x10`` 248 249 - 24bits 96kHz mode 250 - Di is enabled by default for this mode bu 251 to an active source 252 - Only 1 port from {Ai,Ao,Di,Do} can be use 253 - hw:1,0 is available in captured mode 254 - hw:1,2 is not available 255 256 In these modes the device is only Big-Endian c 257 mode" above for an aplay command example) 258 259 AC3 w/ DTS passthru mode 260 ~~~~~~~~~~~~~~~~~~~~~~~~ 261 262 Thanks to Hakan Lennestal, I now have a report 263 264 * ``device_setup=0x03`` 265 266 - 16bits 48kHz mode with only the Do port e 267 - AC3 with DTS passthru 268 - Caution with this setup the Do port is ma 269 270 The command line used to playback the AC3/DTS 271 :: 272 273 % aplay -D hw:1,0 --channels=6 ac3_S16_LE_e 274 275 How to use the ``device_setup`` parameter 276 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 277 278 The parameter can be given: 279 280 * By manually probing the device (as root)::: 281 282 # modprobe -r snd-usb-audio 283 # modprobe snd-usb-audio index=1 device_set 284 285 * Or while configuring the modules options in 286 (typically a .conf file in /etc/modprobe.d/ 287 288 alias snd-card-1 snd-usb-audio 289 options snd-usb-audio index=1 device_se 290 291 CAUTION when initializing the device 292 ------------------------------------- 293 294 * Correct initialization on the device requir 295 the module BEFORE the device is turned on. 296 method described above, take care to power- 297 298 * Failing to respect this will lead to a misc 299 turn off the device, unprobe the snd-usb-au 300 correct device_setup parameter and then (an 301 302 * If you've correctly initialized the device 303 to another mode (possibly with another sam 304 procedure: 305 306 - first turn off the device 307 - de-register the snd-usb-audio module (mod 308 - change the device_setup parameter by chan 309 option in ``/etc/modprobe.d/*.conf`` 310 - turn on the device 311 312 * A workaround for this last issue has been a 313 be enough to ensure the 'stability' of the 314 315 Technical details for hackers 316 ----------------------------- 317 318 This section is for hackers, wanting to unders 319 internals and how Alsa supports it. 320 321 Audiophile USB's ``device_setup`` structure 322 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 323 324 If you want to understand the device_setup mag 325 USB, you need some very basic understanding of 326 this is not required to use the parameter and 327 328 The device_setup is one byte long and its stru 329 :: 330 331 +---+---+---+---+---+---+---+---+ 332 | b7| b6| b5| b4| b3| b2| b1| b0| 333 +---+---+---+---+---+---+---+---+ 334 | 0 | 0 | 0 | Di|24B|96K|DTS|SET| 335 +---+---+---+---+---+---+---+---+ 336 337 Where: 338 339 * b0 is the ``SET`` bit 340 341 - it MUST be set if device_setup is initial 342 343 * b1 is the ``DTS`` bit 344 345 - it is set only for Digital output with DT 346 - this setup is not tested 347 348 * b2 is the Rate selection flag 349 350 - When set to ``1`` the rate range is 48.1- 351 - Otherwise the sample rate range is 8-48kH 352 353 * b3 is the bit depth selection flag 354 355 - When set to ``1`` samples are 24bits long 356 - Otherwise they are 16bits long 357 - Note that b2 implies b3 as the 96kHz mode 358 samples 359 360 * b4 is the Digital input flag 361 362 - When set to ``1`` the device assumes that 363 connected 364 - You shouldn't enable Di if no source is s 365 synchronization issues) 366 - b4 is implied by b2 (since only one port 367 error can occur) 368 369 * b5 to b7 are reserved for future uses, and 370 371 - might become Ao, Do, Ai, for b7, b6, b4 r 372 373 Caution: 374 375 * there is no check on the value you will giv 376 377 - for instance choosing 0x05 (16bits 96kHz) 378 b2 implies b3. But _there_will_be_no_warn 379 380 * Hardware constraints due to the USB bus lim 381 382 - choosing b2 will prepare all interfaces f 383 only be able to use one at the same time 384 385 USB implementation details for this device 386 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 387 388 You may safely skip this section if you're not 389 hacking. 390 391 This section describes some internal aspects o 392 data I got by usb-snooping the windows and Lin 393 394 The M-Audio Audiophile USB has 7 USB Interface 395 a "USB interface": 396 397 * USB Interface nb.0 398 * USB Interface nb.1 399 400 - Audio Control function 401 402 * USB Interface nb.2 403 404 - Analog Output 405 406 * USB Interface nb.3 407 408 - Digital Output 409 410 * USB Interface nb.4 411 412 - Analog Input 413 414 * USB Interface nb.5 415 416 - Digital Input 417 418 * USB Interface nb.6 419 420 - MIDI interface compliant with the MIDIMAN 421 422 Each interface has 5 altsettings (AltSet 1,2,3 423 424 * Interface 3 (Digital Out) has an extra Alse 425 * Interface 5 (Digital In) does not have Alse 426 427 Here is a short description of the AltSettings 428 429 * AltSettings 1 corresponds to 430 431 - 24-bit depth, 48.1-96kHz sample mode 432 - Adaptive playback (Ao and Do), Synch captu 433 434 * AltSettings 2 corresponds to 435 436 - 24-bit depth, 8-48kHz sample mode 437 - Asynch capture and playback (Ao,Ai,Do,Di) 438 439 * AltSettings 3 corresponds to 440 441 - 24-bit depth, 8-48kHz sample mode 442 - Synch capture (Ai) and Adaptive playback ( 443 444 * AltSettings 4 corresponds to 445 446 - 16-bit depth, 8-48kHz sample mode 447 - Asynch capture and playback (Ao,Ai,Do,Di) 448 449 * AltSettings 5 corresponds to 450 451 - 16-bit depth, 8-48kHz sample mode 452 - Synch capture (Ai) and Adaptive playback ( 453 454 * AltSettings 6 corresponds to 455 456 - 16-bit depth, 8-48kHz sample mode 457 - Synch playback (Do), audio format type III 458 459 In order to ensure a correct initialization of 460 *must* *know* how the device will be used: 461 462 * if DTS is chosen, only Interface 2 with Alt 463 registered 464 * if 96KHz only AltSets nb.1 of each interfac 465 * if samples are using 24bits/48KHz then AltS 466 Digital input is connected, and only AltSet 467 is not connected 468 * if samples are using 16bits/48KHz then AltS 469 Digital input is connected, and only AltSet 470 is not connected 471 472 When device_setup is given as a parameter to t 473 parse_audio_endpoints function uses a quirk ca 474 ``audiophile_skip_setting_quirk`` in order to 475 corresponding to device_setup from being regis 476 477 Audiophile USB and Jack support 478 =============================== 479 480 This section deals with support of the Audioph 481 482 There are 2 main potential issues when using J 483 484 * support for Big-Endian devices in 24-bit mod 485 * support for 4-in / 4-out channels 486 487 Direct support in Jackd 488 ----------------------- 489 490 Jack supports big endian devices only in recen 491 Andreas Steinmetz for his first big-endian pat 492 exactly when this support was released into ja 493 with jackd version 0.103.0 it's almost ok (jus 494 16bits Big-Endian devices, but since you've re 495 paragraphs, you're now using kernel >= 2.6.23 496 are now Little Endians ;-) ). 497 498 You can run jackd with the following command f 499 record with Ai: 500 :: 501 502 % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 503 504 Using Alsa plughw 505 ----------------- 506 507 If you don't have a recent Jackd installed, yo 508 the Alsa ``plug`` converter. 509 510 For instance here is one way to run Jack with 511 capture channels from Ai: 512 :: 513 514 % jackd -R -dalsa -dplughw:1 -r48000 -p256 - 515 516 However you may see the following warning mess 517 You appear to be using the ALSA software "pl 518 using the "default" ALSA device. This is les 519 Consider using a hardware device instead rat 520 521 Getting 2 input and/or output interfaces in Ja 522 ---------------------------------------------- 523 524 As you can see, starting the Jack server this 525 input (Di or Ai) and 1 stereo output (Ao or Do 526 527 This is due to the following restrictions: 528 529 * Jack can only open one capture device and on 530 * The Audiophile USB is seen as 2 (or three) A 531 (and optionally hw:1,2) 532 533 If you want to get Ai+Di and/or Ao+Do support 534 combine the Alsa devices into one logical "com 535 536 If you want to give it a try, I recommend read 537 this page: http://www.sound-man.co.uk/linuxaud 538 It is related to another device (ice1712) but 539 the Audiophile USB. 540 541 Enabling multiple Audiophile USB interfaces fo 542 543 * Making sure your Jackd version has the MMAP_ 544 * (maybe) patching the alsa-lib/src/pcm/pcm_mu 545 * define a multi device (combination of hw:1,0 546 file 547 * start jackd with this device 548 549 I had no success in testing this for now, if y 550 of setup, please drop me an email.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.