14e47556eSTakashi Iwai======================================================== 24e47556eSTakashi IwaiGuide to using M-Audio Audiophile USB with ALSA and Jack 34e47556eSTakashi Iwai======================================================== 44e47556eSTakashi Iwai 54e47556eSTakashi Iwaiv1.5 64e47556eSTakashi Iwai 74e47556eSTakashi IwaiThibault Le Meur <Thibault.LeMeur@supelec.fr> 84e47556eSTakashi Iwai 94e47556eSTakashi IwaiThis document is a guide to using the M-Audio Audiophile USB (tm) device with 104e47556eSTakashi IwaiALSA and JACK. 114e47556eSTakashi Iwai 124e47556eSTakashi IwaiHistory 134e47556eSTakashi Iwai======= 144e47556eSTakashi Iwai 154e47556eSTakashi Iwai* v1.4 - Thibault Le Meur (2007-07-11) 164e47556eSTakashi Iwai 174e47556eSTakashi Iwai - Added Low Endianness nature of 16bits-modes 184e47556eSTakashi Iwai found by Hakan Lennestal <Hakan.Lennestal@brfsodrahamn.se> 194e47556eSTakashi Iwai - Modifying document structure 204e47556eSTakashi Iwai 214e47556eSTakashi Iwai* v1.5 - Thibault Le Meur (2007-07-12) 224e47556eSTakashi Iwai - Added AC3/DTS passthru info 234e47556eSTakashi Iwai 244e47556eSTakashi Iwai 254e47556eSTakashi IwaiAudiophile USB Specs and correct usage 264e47556eSTakashi Iwai====================================== 274e47556eSTakashi Iwai 284e47556eSTakashi IwaiThis part is a reminder of important facts about the functions and limitations 294e47556eSTakashi Iwaiof the device. 304e47556eSTakashi Iwai 314e47556eSTakashi IwaiThe device has 4 audio interfaces, and 2 MIDI ports: 324e47556eSTakashi Iwai 334e47556eSTakashi Iwai * Analog Stereo Input (Ai) 344e47556eSTakashi Iwai 354e47556eSTakashi Iwai - This port supports 2 pairs of line-level audio inputs (1/4" TS and RCA) 364e47556eSTakashi Iwai - When the 1/4" TS (jack) connectors are connected, the RCA connectors 374e47556eSTakashi Iwai are disabled 384e47556eSTakashi Iwai 394e47556eSTakashi Iwai * Analog Stereo Output (Ao) 404e47556eSTakashi Iwai * Digital Stereo Input (Di) 414e47556eSTakashi Iwai * Digital Stereo Output (Do) 424e47556eSTakashi Iwai * Midi In (Mi) 434e47556eSTakashi Iwai * Midi Out (Mo) 444e47556eSTakashi Iwai 454e47556eSTakashi IwaiThe internal DAC/ADC has the following characteristics: 464e47556eSTakashi Iwai 474e47556eSTakashi Iwai* sample depth of 16 or 24 bits 484e47556eSTakashi Iwai* sample rate from 8kHz to 96kHz 494e47556eSTakashi Iwai* Two interfaces can't use different sample depths at the same time. 504e47556eSTakashi Iwai 514e47556eSTakashi IwaiMoreover, the Audiophile USB documentation gives the following Warning: 524e47556eSTakashi Iwai Please exit any audio application running before switching between bit depths 534e47556eSTakashi Iwai 544e47556eSTakashi IwaiDue to the USB 1.1 bandwidth limitation, a limited number of interfaces can be 554e47556eSTakashi Iwaiactivated at the same time depending on the audio mode selected: 564e47556eSTakashi Iwai 574e47556eSTakashi Iwai * 16-bit/48kHz ==> 4 channels in + 4 channels out 584e47556eSTakashi Iwai 594e47556eSTakashi Iwai - Ai+Ao+Di+Do 604e47556eSTakashi Iwai 614e47556eSTakashi Iwai * 24-bit/48kHz ==> 4 channels in + 2 channels out, 624e47556eSTakashi Iwai or 2 channels in + 4 channels out 634e47556eSTakashi Iwai 644e47556eSTakashi Iwai - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do 654e47556eSTakashi Iwai 664e47556eSTakashi Iwai * 24-bit/96kHz ==> 2 channels in _or_ 2 channels out (half duplex only) 674e47556eSTakashi Iwai 684e47556eSTakashi Iwai - Ai or Ao or Di or Do 694e47556eSTakashi Iwai 704e47556eSTakashi IwaiImportant facts about the Digital interface: 714e47556eSTakashi Iwai-------------------------------------------- 724e47556eSTakashi Iwai 734e47556eSTakashi Iwai * The Do port additionally supports surround-encoded AC-3 and DTS passthrough, 744e47556eSTakashi Iwai though I haven't tested it under Linux 754e47556eSTakashi Iwai 764e47556eSTakashi Iwai - Note that in this setup only the Do interface can be enabled 774e47556eSTakashi Iwai 784e47556eSTakashi Iwai * Apart from recording an audio digital stream, enabling the Di port is a way 794e47556eSTakashi Iwai to synchronize the device to an external sample clock 804e47556eSTakashi Iwai 814e47556eSTakashi Iwai - As a consequence, the Di port must be enable only if an active Digital 824e47556eSTakashi Iwai source is connected 834e47556eSTakashi Iwai - Enabling Di when no digital source is connected can result in a 844e47556eSTakashi Iwai synchronization error (for instance sound played at an odd sample rate) 854e47556eSTakashi Iwai 864e47556eSTakashi Iwai 874e47556eSTakashi IwaiAudiophile USB MIDI support in ALSA 884e47556eSTakashi Iwai=================================== 894e47556eSTakashi Iwai 904e47556eSTakashi IwaiThe Audiophile USB MIDI ports will be automatically supported once the 914e47556eSTakashi Iwaifollowing modules have been loaded: 924e47556eSTakashi Iwai 934e47556eSTakashi Iwai * snd-usb-audio 944e47556eSTakashi Iwai * snd-seq-midi 954e47556eSTakashi Iwai 964e47556eSTakashi IwaiNo additional setting is required. 974e47556eSTakashi Iwai 984e47556eSTakashi Iwai 994e47556eSTakashi IwaiAudiophile USB Audio support in ALSA 1004e47556eSTakashi Iwai==================================== 1014e47556eSTakashi Iwai 1024e47556eSTakashi IwaiAudio functions of the Audiophile USB device are handled by the snd-usb-audio 1034e47556eSTakashi Iwaimodule. This module can work in a default mode (without any device-specific 1044e47556eSTakashi Iwaiparameter), or in an "advanced" mode with the device-specific parameter called 1054e47556eSTakashi Iwai``device_setup``. 1064e47556eSTakashi Iwai 1074e47556eSTakashi IwaiDefault Alsa driver mode 1084e47556eSTakashi Iwai------------------------ 1094e47556eSTakashi Iwai 1104e47556eSTakashi IwaiThe default behavior of the snd-usb-audio driver is to list the device 1114e47556eSTakashi Iwaicapabilities at startup and activate the required mode when required 1124e47556eSTakashi Iwaiby the applications: for instance if the user is recording in a 1134e47556eSTakashi Iwai24bit-depth-mode and immediately after wants to switch to a 16bit-depth mode, 1144e47556eSTakashi Iwaithe snd-usb-audio module will reconfigure the device on the fly. 1154e47556eSTakashi Iwai 1164e47556eSTakashi IwaiThis approach has the advantage to let the driver automatically switch from sample 1174e47556eSTakashi Iwairates/depths automatically according to the user's needs. However, those who 1184e47556eSTakashi Iwaiare using the device under windows know that this is not how the device is meant to 1194e47556eSTakashi Iwaiwork: under windows applications must be closed before using the m-audio control 1204e47556eSTakashi Iwaipanel to switch the device working mode. Thus as we'll see in next section, this 1214e47556eSTakashi IwaiDefault Alsa driver mode can lead to device misconfigurations. 1224e47556eSTakashi Iwai 1234e47556eSTakashi IwaiLet's get back to the Default Alsa driver mode for now. In this case the 1244e47556eSTakashi IwaiAudiophile interfaces are mapped to alsa pcm devices in the following 1254e47556eSTakashi Iwaiway (I suppose the device's index is 1): 1264e47556eSTakashi Iwai 1274e47556eSTakashi Iwai * hw:1,0 is Ao in playback and Di in capture 1284e47556eSTakashi Iwai * hw:1,1 is Do in playback and Ai in capture 1294e47556eSTakashi Iwai * hw:1,2 is Do in AC3/DTS passthrough mode 1304e47556eSTakashi Iwai 1314e47556eSTakashi IwaiIn this mode, the device uses Big Endian byte-encoding so that 1324e47556eSTakashi Iwaisupported audio format are S16_BE for 16-bit depth modes and S24_3BE for 1334e47556eSTakashi Iwai24-bits depth mode. 1344e47556eSTakashi Iwai 1354e47556eSTakashi IwaiOne exception is the hw:1,2 port which was reported to be Little Endian 1364e47556eSTakashi Iwaicompliant (supposedly supporting S16_LE) but processes in fact only S16_BE streams. 1374e47556eSTakashi IwaiThis has been fixed in kernel 2.6.23 and above and now the hw:1,2 interface 1384e47556eSTakashi Iwaiis reported to be big endian in this default driver mode. 1394e47556eSTakashi Iwai 1404e47556eSTakashi IwaiExamples: 1414e47556eSTakashi Iwai 1424e47556eSTakashi Iwai * playing a S24_3BE encoded raw file to the Ao port:: 1434e47556eSTakashi Iwai 1444e47556eSTakashi Iwai % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw 1454e47556eSTakashi Iwai 1464e47556eSTakashi Iwai * recording a S24_3BE encoded raw file from the Ai port:: 1474e47556eSTakashi Iwai 1484e47556eSTakashi Iwai % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw 1494e47556eSTakashi Iwai 1504e47556eSTakashi Iwai * playing a S16_BE encoded raw file to the Do port:: 1514e47556eSTakashi Iwai 1524e47556eSTakashi Iwai % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw 1534e47556eSTakashi Iwai 1544e47556eSTakashi Iwai * playing an ac3 sample file to the Do port:: 1554e47556eSTakashi Iwai 1564e47556eSTakashi Iwai % aplay -D hw:1,2 --channels=6 ac3_S16_BE_encoded_file.raw 1574e47556eSTakashi Iwai 1584e47556eSTakashi IwaiIf you're happy with the default Alsa driver mode and don't experience any 1594e47556eSTakashi Iwaiissue with this mode, then you can skip the following chapter. 1604e47556eSTakashi Iwai 1614e47556eSTakashi IwaiAdvanced module setup 1624e47556eSTakashi Iwai--------------------- 1634e47556eSTakashi Iwai 1644e47556eSTakashi IwaiDue to the hardware constraints described above, the device initialization made 1654e47556eSTakashi Iwaiby the Alsa driver in default mode may result in a corrupted state of the 1664e47556eSTakashi Iwaidevice. For instance, a particularly annoying issue is that the sound captured 1674e47556eSTakashi Iwaifrom the Ai interface sounds distorted (as if boosted with an excessive high 1684e47556eSTakashi Iwaivolume gain). 1694e47556eSTakashi Iwai 1704e47556eSTakashi IwaiFor people having this problem, the snd-usb-audio module has a new module 1714e47556eSTakashi Iwaiparameter called ``device_setup`` (this parameter was introduced in kernel 1724e47556eSTakashi Iwairelease 2.6.17) 1734e47556eSTakashi Iwai 1744e47556eSTakashi IwaiInitializing the working mode of the Audiophile USB 1754e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1764e47556eSTakashi Iwai 1774e47556eSTakashi IwaiAs far as the Audiophile USB device is concerned, this value let the user 1784e47556eSTakashi Iwaispecify: 1794e47556eSTakashi Iwai 1804e47556eSTakashi Iwai * the sample depth 1814e47556eSTakashi Iwai * the sample rate 1824e47556eSTakashi Iwai * whether the Di port is used or not 1834e47556eSTakashi Iwai 1844e47556eSTakashi IwaiWhen initialized with ``device_setup=0x00``, the snd-usb-audio module has 1854e47556eSTakashi Iwaithe same behaviour as when the parameter is omitted (see paragraph "Default 1864e47556eSTakashi IwaiAlsa driver mode" above) 1874e47556eSTakashi Iwai 1884e47556eSTakashi IwaiOthers modes are described in the following subsections. 1894e47556eSTakashi Iwai 1904e47556eSTakashi Iwai16-bit modes 1914e47556eSTakashi Iwai~~~~~~~~~~~~ 1924e47556eSTakashi Iwai 1934e47556eSTakashi IwaiThe two supported modes are: 1944e47556eSTakashi Iwai 1954e47556eSTakashi Iwai * ``device_setup=0x01`` 1964e47556eSTakashi Iwai 1974e47556eSTakashi Iwai - 16bits 48kHz mode with Di disabled 1984e47556eSTakashi Iwai - Ai,Ao,Do can be used at the same time 1994e47556eSTakashi Iwai - hw:1,0 is not available in capture mode 2004e47556eSTakashi Iwai - hw:1,2 is not available 2014e47556eSTakashi Iwai 2024e47556eSTakashi Iwai * ``device_setup=0x11`` 2034e47556eSTakashi Iwai 2044e47556eSTakashi Iwai - 16bits 48kHz mode with Di enabled 2054e47556eSTakashi Iwai - Ai,Ao,Di,Do can be used at the same time 2064e47556eSTakashi Iwai - hw:1,0 is available in capture mode 2074e47556eSTakashi Iwai - hw:1,2 is not available 2084e47556eSTakashi Iwai 2094e47556eSTakashi IwaiIn this modes the device operates only at 16bits-modes. Before kernel 2.6.23, 2104e47556eSTakashi Iwaithe devices where reported to be Big-Endian when in fact they were Little-Endian 2114e47556eSTakashi Iwaiso that playing a file was a matter of using: 2124e47556eSTakashi Iwai:: 2134e47556eSTakashi Iwai 2144e47556eSTakashi Iwai % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test_S16_LE.raw 2154e47556eSTakashi Iwai 2164e47556eSTakashi Iwaiwhere "test_S16_LE.raw" was in fact a little-endian sample file. 2174e47556eSTakashi Iwai 2184e47556eSTakashi IwaiThanks to Hakan Lennestal (who discovered the Little-Endiannes of the device in 2194e47556eSTakashi Iwaithese modes) a fix has been committed (expected in kernel 2.6.23) and 2204e47556eSTakashi IwaiAlsa now reports Little-Endian interfaces. Thus playing a file now is as simple as 2214e47556eSTakashi Iwaiusing: 2224e47556eSTakashi Iwai:: 2234e47556eSTakashi Iwai 2244e47556eSTakashi Iwai % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_LE test_S16_LE.raw 2254e47556eSTakashi Iwai 2264e47556eSTakashi Iwai 2274e47556eSTakashi Iwai24-bit modes 2284e47556eSTakashi Iwai~~~~~~~~~~~~ 2294e47556eSTakashi Iwai 2304e47556eSTakashi IwaiThe three supported modes are: 2314e47556eSTakashi Iwai 2324e47556eSTakashi Iwai * ``device_setup=0x09`` 2334e47556eSTakashi Iwai 2344e47556eSTakashi Iwai - 24bits 48kHz mode with Di disabled 2354e47556eSTakashi Iwai - Ai,Ao,Do can be used at the same time 2364e47556eSTakashi Iwai - hw:1,0 is not available in capture mode 2374e47556eSTakashi Iwai - hw:1,2 is not available 2384e47556eSTakashi Iwai 2394e47556eSTakashi Iwai * ``device_setup=0x19`` 2404e47556eSTakashi Iwai 2414e47556eSTakashi Iwai - 24bits 48kHz mode with Di enabled 2424e47556eSTakashi Iwai - 3 ports from {Ai,Ao,Di,Do} can be used at the same time 2434e47556eSTakashi Iwai - hw:1,0 is available in capture mode and an active digital source must be 2444e47556eSTakashi Iwai connected to Di 2454e47556eSTakashi Iwai - hw:1,2 is not available 2464e47556eSTakashi Iwai 2474e47556eSTakashi Iwai * ``device_setup=0x0D`` or ``0x10`` 2484e47556eSTakashi Iwai 2494e47556eSTakashi Iwai - 24bits 96kHz mode 2504e47556eSTakashi Iwai - Di is enabled by default for this mode but does not need to be connected 2514e47556eSTakashi Iwai to an active source 2524e47556eSTakashi Iwai - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time 2534e47556eSTakashi Iwai - hw:1,0 is available in captured mode 2544e47556eSTakashi Iwai - hw:1,2 is not available 2554e47556eSTakashi Iwai 2564e47556eSTakashi IwaiIn these modes the device is only Big-Endian compliant (see "Default Alsa driver 2574e47556eSTakashi Iwaimode" above for an aplay command example) 2584e47556eSTakashi Iwai 2594e47556eSTakashi IwaiAC3 w/ DTS passthru mode 2604e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~ 2614e47556eSTakashi Iwai 2624e47556eSTakashi IwaiThanks to Hakan Lennestal, I now have a report saying that this mode works. 2634e47556eSTakashi Iwai 2644e47556eSTakashi Iwai * ``device_setup=0x03`` 2654e47556eSTakashi Iwai 2664e47556eSTakashi Iwai - 16bits 48kHz mode with only the Do port enabled 2674e47556eSTakashi Iwai - AC3 with DTS passthru 2684e47556eSTakashi Iwai - Caution with this setup the Do port is mapped to the pcm device hw:1,0 2694e47556eSTakashi Iwai 2704e47556eSTakashi IwaiThe command line used to playback the AC3/DTS encoded .wav-files in this mode: 2714e47556eSTakashi Iwai:: 2724e47556eSTakashi Iwai 2734e47556eSTakashi Iwai % aplay -D hw:1,0 --channels=6 ac3_S16_LE_encoded_file.raw 2744e47556eSTakashi Iwai 2754e47556eSTakashi IwaiHow to use the ``device_setup`` parameter 2764e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2774e47556eSTakashi Iwai 2784e47556eSTakashi IwaiThe parameter can be given: 2794e47556eSTakashi Iwai 2804e47556eSTakashi Iwai * By manually probing the device (as root)::: 2814e47556eSTakashi Iwai 2824e47556eSTakashi Iwai # modprobe -r snd-usb-audio 2834e47556eSTakashi Iwai # modprobe snd-usb-audio index=1 device_setup=0x09 2844e47556eSTakashi Iwai 2854e47556eSTakashi Iwai * Or while configuring the modules options in your modules configuration file 2864e47556eSTakashi Iwai (typically a .conf file in /etc/modprobe.d/ directory::: 2874e47556eSTakashi Iwai 2884e47556eSTakashi Iwai alias snd-card-1 snd-usb-audio 2894e47556eSTakashi Iwai options snd-usb-audio index=1 device_setup=0x09 2904e47556eSTakashi Iwai 2914e47556eSTakashi IwaiCAUTION when initializing the device 2924e47556eSTakashi Iwai------------------------------------- 2934e47556eSTakashi Iwai 2944e47556eSTakashi Iwai * Correct initialization on the device requires that device_setup is given to 2954e47556eSTakashi Iwai the module BEFORE the device is turned on. So, if you use the "manual probing" 2964e47556eSTakashi Iwai method described above, take care to power-on the device AFTER this initialization. 2974e47556eSTakashi Iwai 2984e47556eSTakashi Iwai * Failing to respect this will lead to a misconfiguration of the device. In this case 2994e47556eSTakashi Iwai turn off the device, unprobe the snd-usb-audio module, then probe it again with 3004e47556eSTakashi Iwai correct device_setup parameter and then (and only then) turn on the device again. 3014e47556eSTakashi Iwai 3024e47556eSTakashi Iwai * If you've correctly initialized the device in a valid mode and then want to switch 3034e47556eSTakashi Iwai to another mode (possibly with another sample-depth), please use also the following 3044e47556eSTakashi Iwai procedure: 3054e47556eSTakashi Iwai 3064e47556eSTakashi Iwai - first turn off the device 3074e47556eSTakashi Iwai - de-register the snd-usb-audio module (modprobe -r) 3084e47556eSTakashi Iwai - change the device_setup parameter by changing the device_setup 3094e47556eSTakashi Iwai option in ``/etc/modprobe.d/*.conf`` 3104e47556eSTakashi Iwai - turn on the device 3114e47556eSTakashi Iwai 3124e47556eSTakashi Iwai * A workaround for this last issue has been applied to kernel 2.6.23, but it may not 3134e47556eSTakashi Iwai be enough to ensure the 'stability' of the device initialization. 3144e47556eSTakashi Iwai 3154e47556eSTakashi IwaiTechnical details for hackers 3164e47556eSTakashi Iwai----------------------------- 3174e47556eSTakashi Iwai 3184e47556eSTakashi IwaiThis section is for hackers, wanting to understand details about the device 3194e47556eSTakashi Iwaiinternals and how Alsa supports it. 3204e47556eSTakashi Iwai 3214e47556eSTakashi IwaiAudiophile USB's ``device_setup`` structure 3224e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3234e47556eSTakashi Iwai 3244e47556eSTakashi IwaiIf you want to understand the device_setup magic numbers for the Audiophile 3254e47556eSTakashi IwaiUSB, you need some very basic understanding of binary computation. However, 3264e47556eSTakashi Iwaithis is not required to use the parameter and you may skip this section. 3274e47556eSTakashi Iwai 3284e47556eSTakashi IwaiThe device_setup is one byte long and its structure is the following: 3294e47556eSTakashi Iwai:: 3304e47556eSTakashi Iwai 3314e47556eSTakashi Iwai +---+---+---+---+---+---+---+---+ 3324e47556eSTakashi Iwai | b7| b6| b5| b4| b3| b2| b1| b0| 3334e47556eSTakashi Iwai +---+---+---+---+---+---+---+---+ 3344e47556eSTakashi Iwai | 0 | 0 | 0 | Di|24B|96K|DTS|SET| 3354e47556eSTakashi Iwai +---+---+---+---+---+---+---+---+ 3364e47556eSTakashi Iwai 3374e47556eSTakashi IwaiWhere: 3384e47556eSTakashi Iwai 3394e47556eSTakashi Iwai * b0 is the ``SET`` bit 3404e47556eSTakashi Iwai 3414e47556eSTakashi Iwai - it MUST be set if device_setup is initialized 3424e47556eSTakashi Iwai 3434e47556eSTakashi Iwai * b1 is the ``DTS`` bit 3444e47556eSTakashi Iwai 3454e47556eSTakashi Iwai - it is set only for Digital output with DTS/AC3 3464e47556eSTakashi Iwai - this setup is not tested 3474e47556eSTakashi Iwai 3484e47556eSTakashi Iwai * b2 is the Rate selection flag 3494e47556eSTakashi Iwai 3504e47556eSTakashi Iwai - When set to ``1`` the rate range is 48.1-96kHz 3514e47556eSTakashi Iwai - Otherwise the sample rate range is 8-48kHz 3524e47556eSTakashi Iwai 3534e47556eSTakashi Iwai * b3 is the bit depth selection flag 3544e47556eSTakashi Iwai 3554e47556eSTakashi Iwai - When set to ``1`` samples are 24bits long 3564e47556eSTakashi Iwai - Otherwise they are 16bits long 3574e47556eSTakashi Iwai - Note that b2 implies b3 as the 96kHz mode is only supported for 24 bits 3584e47556eSTakashi Iwai samples 3594e47556eSTakashi Iwai 3604e47556eSTakashi Iwai * b4 is the Digital input flag 3614e47556eSTakashi Iwai 3624e47556eSTakashi Iwai - When set to ``1`` the device assumes that an active digital source is 3634e47556eSTakashi Iwai connected 3644e47556eSTakashi Iwai - You shouldn't enable Di if no source is seen on the port (this leads to 3654e47556eSTakashi Iwai synchronization issues) 3664e47556eSTakashi Iwai - b4 is implied by b2 (since only one port is enabled at a time no synch 3674e47556eSTakashi Iwai error can occur) 3684e47556eSTakashi Iwai 3694e47556eSTakashi Iwai * b5 to b7 are reserved for future uses, and must be set to ``0`` 3704e47556eSTakashi Iwai 3714e47556eSTakashi Iwai - might become Ao, Do, Ai, for b7, b6, b4 respectively 3724e47556eSTakashi Iwai 3734e47556eSTakashi IwaiCaution: 3744e47556eSTakashi Iwai 3754e47556eSTakashi Iwai * there is no check on the value you will give to device_setup 3764e47556eSTakashi Iwai 3774e47556eSTakashi Iwai - for instance choosing 0x05 (16bits 96kHz) will fail back to 0x09 since 3784e47556eSTakashi Iwai b2 implies b3. But _there_will_be_no_warning_ in /var/log/messages 3794e47556eSTakashi Iwai 3804e47556eSTakashi Iwai * Hardware constraints due to the USB bus limitation aren't checked 3814e47556eSTakashi Iwai 3824e47556eSTakashi Iwai - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll 3834e47556eSTakashi Iwai only be able to use one at the same time 3844e47556eSTakashi Iwai 3854e47556eSTakashi IwaiUSB implementation details for this device 3864e47556eSTakashi Iwai~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3874e47556eSTakashi Iwai 3884e47556eSTakashi IwaiYou may safely skip this section if you're not interested in driver 3894e47556eSTakashi Iwaihacking. 3904e47556eSTakashi Iwai 3914e47556eSTakashi IwaiThis section describes some internal aspects of the device and summarizes the 3924e47556eSTakashi Iwaidata I got by usb-snooping the windows and Linux drivers. 3934e47556eSTakashi Iwai 3944e47556eSTakashi IwaiThe M-Audio Audiophile USB has 7 USB Interfaces: 3954e47556eSTakashi Iwaia "USB interface": 3964e47556eSTakashi Iwai 3974e47556eSTakashi Iwai * USB Interface nb.0 3984e47556eSTakashi Iwai * USB Interface nb.1 3994e47556eSTakashi Iwai 4004e47556eSTakashi Iwai - Audio Control function 4014e47556eSTakashi Iwai 4024e47556eSTakashi Iwai * USB Interface nb.2 4034e47556eSTakashi Iwai 4044e47556eSTakashi Iwai - Analog Output 4054e47556eSTakashi Iwai 4064e47556eSTakashi Iwai * USB Interface nb.3 4074e47556eSTakashi Iwai 4084e47556eSTakashi Iwai - Digital Output 4094e47556eSTakashi Iwai 4104e47556eSTakashi Iwai * USB Interface nb.4 4114e47556eSTakashi Iwai 4124e47556eSTakashi Iwai - Analog Input 4134e47556eSTakashi Iwai 4144e47556eSTakashi Iwai * USB Interface nb.5 4154e47556eSTakashi Iwai 4164e47556eSTakashi Iwai - Digital Input 4174e47556eSTakashi Iwai 4184e47556eSTakashi Iwai * USB Interface nb.6 4194e47556eSTakashi Iwai 4204e47556eSTakashi Iwai - MIDI interface compliant with the MIDIMAN quirk 4214e47556eSTakashi Iwai 4224e47556eSTakashi IwaiEach interface has 5 altsettings (AltSet 1,2,3,4,5) except: 4234e47556eSTakashi Iwai 4244e47556eSTakashi Iwai * Interface 3 (Digital Out) has an extra Alset nb.6 4254e47556eSTakashi Iwai * Interface 5 (Digital In) does not have Alset nb.3 and 5 4264e47556eSTakashi Iwai 4274e47556eSTakashi IwaiHere is a short description of the AltSettings capabilities: 4284e47556eSTakashi Iwai 4294e47556eSTakashi Iwai* AltSettings 1 corresponds to 4304e47556eSTakashi Iwai 4314e47556eSTakashi Iwai - 24-bit depth, 48.1-96kHz sample mode 4324e47556eSTakashi Iwai - Adaptive playback (Ao and Do), Synch capture (Ai), or Asynch capture (Di) 4334e47556eSTakashi Iwai 4344e47556eSTakashi Iwai* AltSettings 2 corresponds to 4354e47556eSTakashi Iwai 4364e47556eSTakashi Iwai - 24-bit depth, 8-48kHz sample mode 4374e47556eSTakashi Iwai - Asynch capture and playback (Ao,Ai,Do,Di) 4384e47556eSTakashi Iwai 4394e47556eSTakashi Iwai* AltSettings 3 corresponds to 4404e47556eSTakashi Iwai 4414e47556eSTakashi Iwai - 24-bit depth, 8-48kHz sample mode 4424e47556eSTakashi Iwai - Synch capture (Ai) and Adaptive playback (Ao,Do) 4434e47556eSTakashi Iwai 4444e47556eSTakashi Iwai* AltSettings 4 corresponds to 4454e47556eSTakashi Iwai 4464e47556eSTakashi Iwai - 16-bit depth, 8-48kHz sample mode 4474e47556eSTakashi Iwai - Asynch capture and playback (Ao,Ai,Do,Di) 4484e47556eSTakashi Iwai 4494e47556eSTakashi Iwai* AltSettings 5 corresponds to 4504e47556eSTakashi Iwai 4514e47556eSTakashi Iwai - 16-bit depth, 8-48kHz sample mode 4524e47556eSTakashi Iwai - Synch capture (Ai) and Adaptive playback (Ao,Do) 4534e47556eSTakashi Iwai 4544e47556eSTakashi Iwai* AltSettings 6 corresponds to 4554e47556eSTakashi Iwai 4564e47556eSTakashi Iwai - 16-bit depth, 8-48kHz sample mode 4574e47556eSTakashi Iwai - Synch playback (Do), audio format type III IEC1937_AC-3 4584e47556eSTakashi Iwai 4594e47556eSTakashi IwaiIn order to ensure a correct initialization of the device, the driver 4604e47556eSTakashi Iwai*must* *know* how the device will be used: 4614e47556eSTakashi Iwai 4624e47556eSTakashi Iwai * if DTS is chosen, only Interface 2 with AltSet nb.6 must be 4634e47556eSTakashi Iwai registered 4644e47556eSTakashi Iwai * if 96KHz only AltSets nb.1 of each interface must be selected 4654e47556eSTakashi Iwai * if samples are using 24bits/48KHz then AltSet 2 must me used if 4664e47556eSTakashi Iwai Digital input is connected, and only AltSet nb.3 if Digital input 4674e47556eSTakashi Iwai is not connected 4684e47556eSTakashi Iwai * if samples are using 16bits/48KHz then AltSet 4 must me used if 4694e47556eSTakashi Iwai Digital input is connected, and only AltSet nb.5 if Digital input 4704e47556eSTakashi Iwai is not connected 4714e47556eSTakashi Iwai 4724e47556eSTakashi IwaiWhen device_setup is given as a parameter to the snd-usb-audio module, the 4734e47556eSTakashi Iwaiparse_audio_endpoints function uses a quirk called 4744e47556eSTakashi Iwai``audiophile_skip_setting_quirk`` in order to prevent AltSettings not 4754e47556eSTakashi Iwaicorresponding to device_setup from being registered in the driver. 4764e47556eSTakashi Iwai 4774e47556eSTakashi IwaiAudiophile USB and Jack support 4784e47556eSTakashi Iwai=============================== 4794e47556eSTakashi Iwai 4804e47556eSTakashi IwaiThis section deals with support of the Audiophile USB device in Jack. 4814e47556eSTakashi Iwai 4824e47556eSTakashi IwaiThere are 2 main potential issues when using Jackd with the device: 4834e47556eSTakashi Iwai 4844e47556eSTakashi Iwai* support for Big-Endian devices in 24-bit modes 4854e47556eSTakashi Iwai* support for 4-in / 4-out channels 4864e47556eSTakashi Iwai 4874e47556eSTakashi IwaiDirect support in Jackd 4884e47556eSTakashi Iwai----------------------- 4894e47556eSTakashi Iwai 4904e47556eSTakashi IwaiJack supports big endian devices only in recent versions (thanks to 4914e47556eSTakashi IwaiAndreas Steinmetz for his first big-endian patch). I can't remember 4924e47556eSTakashi Iwaiexactly when this support was released into jackd, let's just say that 4934e47556eSTakashi Iwaiwith jackd version 0.103.0 it's almost ok (just a small bug is affecting 4944e47556eSTakashi Iwai16bits Big-Endian devices, but since you've read carefully the above 4954e47556eSTakashi Iwaiparagraphs, you're now using kernel >= 2.6.23 and your 16bits devices 4964e47556eSTakashi Iwaiare now Little Endians ;-) ). 4974e47556eSTakashi Iwai 4984e47556eSTakashi IwaiYou can run jackd with the following command for playback with Ao and 4994e47556eSTakashi Iwairecord with Ai: 5004e47556eSTakashi Iwai:: 5014e47556eSTakashi Iwai 5024e47556eSTakashi Iwai % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1 5034e47556eSTakashi Iwai 5044e47556eSTakashi IwaiUsing Alsa plughw 5054e47556eSTakashi Iwai----------------- 5064e47556eSTakashi Iwai 5074e47556eSTakashi IwaiIf you don't have a recent Jackd installed, you can downgrade to using 5084e47556eSTakashi Iwaithe Alsa ``plug`` converter. 5094e47556eSTakashi Iwai 5104e47556eSTakashi IwaiFor instance here is one way to run Jack with 2 playback channels on Ao and 2 5114e47556eSTakashi Iwaicapture channels from Ai: 5124e47556eSTakashi Iwai:: 5134e47556eSTakashi Iwai 5144e47556eSTakashi Iwai % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1 5154e47556eSTakashi Iwai 5164e47556eSTakashi IwaiHowever you may see the following warning message: 5174e47556eSTakashi Iwai You appear to be using the ALSA software "plug" layer, probably a result of 5184e47556eSTakashi Iwai using the "default" ALSA device. This is less efficient than it could be. 5194e47556eSTakashi Iwai Consider using a hardware device instead rather than using the plug layer. 5204e47556eSTakashi Iwai 5214e47556eSTakashi IwaiGetting 2 input and/or output interfaces in Jack 5224e47556eSTakashi Iwai------------------------------------------------ 5234e47556eSTakashi Iwai 5244e47556eSTakashi IwaiAs you can see, starting the Jack server this way will only enable 1 stereo 5254e47556eSTakashi Iwaiinput (Di or Ai) and 1 stereo output (Ao or Do). 5264e47556eSTakashi Iwai 5274e47556eSTakashi IwaiThis is due to the following restrictions: 5284e47556eSTakashi Iwai 5294e47556eSTakashi Iwai* Jack can only open one capture device and one playback device at a time 5304e47556eSTakashi Iwai* The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1 5314e47556eSTakashi Iwai (and optionally hw:1,2) 5324e47556eSTakashi Iwai 5334e47556eSTakashi IwaiIf you want to get Ai+Di and/or Ao+Do support with Jack, you would need to 5344e47556eSTakashi Iwaicombine the Alsa devices into one logical "complex" device. 5354e47556eSTakashi Iwai 5364e47556eSTakashi IwaiIf you want to give it a try, I recommend reading the information from 5374e47556eSTakashi Iwaithis page: http://www.sound-man.co.uk/linuxaudio/ice1712multi.html 5384e47556eSTakashi IwaiIt is related to another device (ice1712) but can be adapted to suit 5394e47556eSTakashi Iwaithe Audiophile USB. 5404e47556eSTakashi Iwai 5414e47556eSTakashi IwaiEnabling multiple Audiophile USB interfaces for Jackd will certainly require: 5424e47556eSTakashi Iwai 5434e47556eSTakashi Iwai* Making sure your Jackd version has the MMAP_COMPLEX patch (see the ice1712 page) 5444e47556eSTakashi Iwai* (maybe) patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page) 5454e47556eSTakashi Iwai* define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc 5464e47556eSTakashi Iwai file 5474e47556eSTakashi Iwai* start jackd with this device 5484e47556eSTakashi Iwai 5494e47556eSTakashi IwaiI had no success in testing this for now, if you have any success with this kind 5504e47556eSTakashi Iwaiof setup, please drop me an email. 551