162306a36Sopenharmony_ci======================================================== 262306a36Sopenharmony_ciGuide to using M-Audio Audiophile USB with ALSA and Jack 362306a36Sopenharmony_ci======================================================== 462306a36Sopenharmony_ci 562306a36Sopenharmony_civ1.5 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciThibault Le Meur <Thibault.LeMeur@supelec.fr> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciThis document is a guide to using the M-Audio Audiophile USB (tm) device with 1062306a36Sopenharmony_ciALSA and JACK. 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ciHistory 1362306a36Sopenharmony_ci======= 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci* v1.4 - Thibault Le Meur (2007-07-11) 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci - Added Low Endianness nature of 16bits-modes 1862306a36Sopenharmony_ci found by Hakan Lennestal <Hakan.Lennestal@brfsodrahamn.se> 1962306a36Sopenharmony_ci - Modifying document structure 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci* v1.5 - Thibault Le Meur (2007-07-12) 2262306a36Sopenharmony_ci - Added AC3/DTS passthru info 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciAudiophile USB Specs and correct usage 2662306a36Sopenharmony_ci====================================== 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciThis part is a reminder of important facts about the functions and limitations 2962306a36Sopenharmony_ciof the device. 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciThe device has 4 audio interfaces, and 2 MIDI ports: 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci * Analog Stereo Input (Ai) 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci - This port supports 2 pairs of line-level audio inputs (1/4" TS and RCA) 3662306a36Sopenharmony_ci - When the 1/4" TS (jack) connectors are connected, the RCA connectors 3762306a36Sopenharmony_ci are disabled 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci * Analog Stereo Output (Ao) 4062306a36Sopenharmony_ci * Digital Stereo Input (Di) 4162306a36Sopenharmony_ci * Digital Stereo Output (Do) 4262306a36Sopenharmony_ci * Midi In (Mi) 4362306a36Sopenharmony_ci * Midi Out (Mo) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ciThe internal DAC/ADC has the following characteristics: 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci* sample depth of 16 or 24 bits 4862306a36Sopenharmony_ci* sample rate from 8kHz to 96kHz 4962306a36Sopenharmony_ci* Two interfaces can't use different sample depths at the same time. 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciMoreover, the Audiophile USB documentation gives the following Warning: 5262306a36Sopenharmony_ci Please exit any audio application running before switching between bit depths 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciDue to the USB 1.1 bandwidth limitation, a limited number of interfaces can be 5562306a36Sopenharmony_ciactivated at the same time depending on the audio mode selected: 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci * 16-bit/48kHz ==> 4 channels in + 4 channels out 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci - Ai+Ao+Di+Do 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci * 24-bit/48kHz ==> 4 channels in + 2 channels out, 6262306a36Sopenharmony_ci or 2 channels in + 4 channels out 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci - Ai+Ao+Do or Ai+Di+Ao or Ai+Di+Do or Di+Ao+Do 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci * 24-bit/96kHz ==> 2 channels in _or_ 2 channels out (half duplex only) 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci - Ai or Ao or Di or Do 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciImportant facts about the Digital interface: 7162306a36Sopenharmony_ci-------------------------------------------- 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci * The Do port additionally supports surround-encoded AC-3 and DTS passthrough, 7462306a36Sopenharmony_ci though I haven't tested it under Linux 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci - Note that in this setup only the Do interface can be enabled 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci * Apart from recording an audio digital stream, enabling the Di port is a way 7962306a36Sopenharmony_ci to synchronize the device to an external sample clock 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci - As a consequence, the Di port must be enable only if an active Digital 8262306a36Sopenharmony_ci source is connected 8362306a36Sopenharmony_ci - Enabling Di when no digital source is connected can result in a 8462306a36Sopenharmony_ci synchronization error (for instance sound played at an odd sample rate) 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ciAudiophile USB MIDI support in ALSA 8862306a36Sopenharmony_ci=================================== 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ciThe Audiophile USB MIDI ports will be automatically supported once the 9162306a36Sopenharmony_cifollowing modules have been loaded: 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci * snd-usb-audio 9462306a36Sopenharmony_ci * snd-seq-midi 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ciNo additional setting is required. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ciAudiophile USB Audio support in ALSA 10062306a36Sopenharmony_ci==================================== 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ciAudio functions of the Audiophile USB device are handled by the snd-usb-audio 10362306a36Sopenharmony_cimodule. This module can work in a default mode (without any device-specific 10462306a36Sopenharmony_ciparameter), or in an "advanced" mode with the device-specific parameter called 10562306a36Sopenharmony_ci``device_setup``. 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_ciDefault Alsa driver mode 10862306a36Sopenharmony_ci------------------------ 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ciThe default behavior of the snd-usb-audio driver is to list the device 11162306a36Sopenharmony_cicapabilities at startup and activate the required mode when required 11262306a36Sopenharmony_ciby the applications: for instance if the user is recording in a 11362306a36Sopenharmony_ci24bit-depth-mode and immediately after wants to switch to a 16bit-depth mode, 11462306a36Sopenharmony_cithe snd-usb-audio module will reconfigure the device on the fly. 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ciThis approach has the advantage to let the driver automatically switch from sample 11762306a36Sopenharmony_cirates/depths automatically according to the user's needs. However, those who 11862306a36Sopenharmony_ciare using the device under windows know that this is not how the device is meant to 11962306a36Sopenharmony_ciwork: under windows applications must be closed before using the m-audio control 12062306a36Sopenharmony_cipanel to switch the device working mode. Thus as we'll see in next section, this 12162306a36Sopenharmony_ciDefault Alsa driver mode can lead to device misconfigurations. 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ciLet's get back to the Default Alsa driver mode for now. In this case the 12462306a36Sopenharmony_ciAudiophile interfaces are mapped to alsa pcm devices in the following 12562306a36Sopenharmony_ciway (I suppose the device's index is 1): 12662306a36Sopenharmony_ci 12762306a36Sopenharmony_ci * hw:1,0 is Ao in playback and Di in capture 12862306a36Sopenharmony_ci * hw:1,1 is Do in playback and Ai in capture 12962306a36Sopenharmony_ci * hw:1,2 is Do in AC3/DTS passthrough mode 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ciIn this mode, the device uses Big Endian byte-encoding so that 13262306a36Sopenharmony_cisupported audio format are S16_BE for 16-bit depth modes and S24_3BE for 13362306a36Sopenharmony_ci24-bits depth mode. 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ciOne exception is the hw:1,2 port which was reported to be Little Endian 13662306a36Sopenharmony_cicompliant (supposedly supporting S16_LE) but processes in fact only S16_BE streams. 13762306a36Sopenharmony_ciThis has been fixed in kernel 2.6.23 and above and now the hw:1,2 interface 13862306a36Sopenharmony_ciis reported to be big endian in this default driver mode. 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ciExamples: 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci * playing a S24_3BE encoded raw file to the Ao port:: 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci % aplay -D hw:1,0 -c2 -t raw -r48000 -fS24_3BE test.raw 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci * recording a S24_3BE encoded raw file from the Ai port:: 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci % arecord -D hw:1,1 -c2 -t raw -r48000 -fS24_3BE test.raw 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci * playing a S16_BE encoded raw file to the Do port:: 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test.raw 15362306a36Sopenharmony_ci 15462306a36Sopenharmony_ci * playing an ac3 sample file to the Do port:: 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci % aplay -D hw:1,2 --channels=6 ac3_S16_BE_encoded_file.raw 15762306a36Sopenharmony_ci 15862306a36Sopenharmony_ciIf you're happy with the default Alsa driver mode and don't experience any 15962306a36Sopenharmony_ciissue with this mode, then you can skip the following chapter. 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ciAdvanced module setup 16262306a36Sopenharmony_ci--------------------- 16362306a36Sopenharmony_ci 16462306a36Sopenharmony_ciDue to the hardware constraints described above, the device initialization made 16562306a36Sopenharmony_ciby the Alsa driver in default mode may result in a corrupted state of the 16662306a36Sopenharmony_cidevice. For instance, a particularly annoying issue is that the sound captured 16762306a36Sopenharmony_cifrom the Ai interface sounds distorted (as if boosted with an excessive high 16862306a36Sopenharmony_civolume gain). 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ciFor people having this problem, the snd-usb-audio module has a new module 17162306a36Sopenharmony_ciparameter called ``device_setup`` (this parameter was introduced in kernel 17262306a36Sopenharmony_cirelease 2.6.17) 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ciInitializing the working mode of the Audiophile USB 17562306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ciAs far as the Audiophile USB device is concerned, this value let the user 17862306a36Sopenharmony_cispecify: 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci * the sample depth 18162306a36Sopenharmony_ci * the sample rate 18262306a36Sopenharmony_ci * whether the Di port is used or not 18362306a36Sopenharmony_ci 18462306a36Sopenharmony_ciWhen initialized with ``device_setup=0x00``, the snd-usb-audio module has 18562306a36Sopenharmony_cithe same behaviour as when the parameter is omitted (see paragraph "Default 18662306a36Sopenharmony_ciAlsa driver mode" above) 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ciOthers modes are described in the following subsections. 18962306a36Sopenharmony_ci 19062306a36Sopenharmony_ci16-bit modes 19162306a36Sopenharmony_ci~~~~~~~~~~~~ 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ciThe two supported modes are: 19462306a36Sopenharmony_ci 19562306a36Sopenharmony_ci * ``device_setup=0x01`` 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ci - 16bits 48kHz mode with Di disabled 19862306a36Sopenharmony_ci - Ai,Ao,Do can be used at the same time 19962306a36Sopenharmony_ci - hw:1,0 is not available in capture mode 20062306a36Sopenharmony_ci - hw:1,2 is not available 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci * ``device_setup=0x11`` 20362306a36Sopenharmony_ci 20462306a36Sopenharmony_ci - 16bits 48kHz mode with Di enabled 20562306a36Sopenharmony_ci - Ai,Ao,Di,Do can be used at the same time 20662306a36Sopenharmony_ci - hw:1,0 is available in capture mode 20762306a36Sopenharmony_ci - hw:1,2 is not available 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ciIn this modes the device operates only at 16bits-modes. Before kernel 2.6.23, 21062306a36Sopenharmony_cithe devices where reported to be Big-Endian when in fact they were Little-Endian 21162306a36Sopenharmony_ciso that playing a file was a matter of using: 21262306a36Sopenharmony_ci:: 21362306a36Sopenharmony_ci 21462306a36Sopenharmony_ci % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_BE test_S16_LE.raw 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ciwhere "test_S16_LE.raw" was in fact a little-endian sample file. 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ciThanks to Hakan Lennestal (who discovered the Little-Endiannes of the device in 21962306a36Sopenharmony_cithese modes) a fix has been committed (expected in kernel 2.6.23) and 22062306a36Sopenharmony_ciAlsa now reports Little-Endian interfaces. Thus playing a file now is as simple as 22162306a36Sopenharmony_ciusing: 22262306a36Sopenharmony_ci:: 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci % aplay -D hw:1,1 -c2 -t raw -r48000 -fS16_LE test_S16_LE.raw 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_ci24-bit modes 22862306a36Sopenharmony_ci~~~~~~~~~~~~ 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ciThe three supported modes are: 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci * ``device_setup=0x09`` 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci - 24bits 48kHz mode with Di disabled 23562306a36Sopenharmony_ci - Ai,Ao,Do can be used at the same time 23662306a36Sopenharmony_ci - hw:1,0 is not available in capture mode 23762306a36Sopenharmony_ci - hw:1,2 is not available 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ci * ``device_setup=0x19`` 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci - 24bits 48kHz mode with Di enabled 24262306a36Sopenharmony_ci - 3 ports from {Ai,Ao,Di,Do} can be used at the same time 24362306a36Sopenharmony_ci - hw:1,0 is available in capture mode and an active digital source must be 24462306a36Sopenharmony_ci connected to Di 24562306a36Sopenharmony_ci - hw:1,2 is not available 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_ci * ``device_setup=0x0D`` or ``0x10`` 24862306a36Sopenharmony_ci 24962306a36Sopenharmony_ci - 24bits 96kHz mode 25062306a36Sopenharmony_ci - Di is enabled by default for this mode but does not need to be connected 25162306a36Sopenharmony_ci to an active source 25262306a36Sopenharmony_ci - Only 1 port from {Ai,Ao,Di,Do} can be used at the same time 25362306a36Sopenharmony_ci - hw:1,0 is available in captured mode 25462306a36Sopenharmony_ci - hw:1,2 is not available 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ciIn these modes the device is only Big-Endian compliant (see "Default Alsa driver 25762306a36Sopenharmony_cimode" above for an aplay command example) 25862306a36Sopenharmony_ci 25962306a36Sopenharmony_ciAC3 w/ DTS passthru mode 26062306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~ 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ciThanks to Hakan Lennestal, I now have a report saying that this mode works. 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci * ``device_setup=0x03`` 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_ci - 16bits 48kHz mode with only the Do port enabled 26762306a36Sopenharmony_ci - AC3 with DTS passthru 26862306a36Sopenharmony_ci - Caution with this setup the Do port is mapped to the pcm device hw:1,0 26962306a36Sopenharmony_ci 27062306a36Sopenharmony_ciThe command line used to playback the AC3/DTS encoded .wav-files in this mode: 27162306a36Sopenharmony_ci:: 27262306a36Sopenharmony_ci 27362306a36Sopenharmony_ci % aplay -D hw:1,0 --channels=6 ac3_S16_LE_encoded_file.raw 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ciHow to use the ``device_setup`` parameter 27662306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ciThe parameter can be given: 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci * By manually probing the device (as root)::: 28162306a36Sopenharmony_ci 28262306a36Sopenharmony_ci # modprobe -r snd-usb-audio 28362306a36Sopenharmony_ci # modprobe snd-usb-audio index=1 device_setup=0x09 28462306a36Sopenharmony_ci 28562306a36Sopenharmony_ci * Or while configuring the modules options in your modules configuration file 28662306a36Sopenharmony_ci (typically a .conf file in /etc/modprobe.d/ directory::: 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci alias snd-card-1 snd-usb-audio 28962306a36Sopenharmony_ci options snd-usb-audio index=1 device_setup=0x09 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_ciCAUTION when initializing the device 29262306a36Sopenharmony_ci------------------------------------- 29362306a36Sopenharmony_ci 29462306a36Sopenharmony_ci * Correct initialization on the device requires that device_setup is given to 29562306a36Sopenharmony_ci the module BEFORE the device is turned on. So, if you use the "manual probing" 29662306a36Sopenharmony_ci method described above, take care to power-on the device AFTER this initialization. 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_ci * Failing to respect this will lead to a misconfiguration of the device. In this case 29962306a36Sopenharmony_ci turn off the device, unprobe the snd-usb-audio module, then probe it again with 30062306a36Sopenharmony_ci correct device_setup parameter and then (and only then) turn on the device again. 30162306a36Sopenharmony_ci 30262306a36Sopenharmony_ci * If you've correctly initialized the device in a valid mode and then want to switch 30362306a36Sopenharmony_ci to another mode (possibly with another sample-depth), please use also the following 30462306a36Sopenharmony_ci procedure: 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci - first turn off the device 30762306a36Sopenharmony_ci - de-register the snd-usb-audio module (modprobe -r) 30862306a36Sopenharmony_ci - change the device_setup parameter by changing the device_setup 30962306a36Sopenharmony_ci option in ``/etc/modprobe.d/*.conf`` 31062306a36Sopenharmony_ci - turn on the device 31162306a36Sopenharmony_ci 31262306a36Sopenharmony_ci * A workaround for this last issue has been applied to kernel 2.6.23, but it may not 31362306a36Sopenharmony_ci be enough to ensure the 'stability' of the device initialization. 31462306a36Sopenharmony_ci 31562306a36Sopenharmony_ciTechnical details for hackers 31662306a36Sopenharmony_ci----------------------------- 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ciThis section is for hackers, wanting to understand details about the device 31962306a36Sopenharmony_ciinternals and how Alsa supports it. 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ciAudiophile USB's ``device_setup`` structure 32262306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ciIf you want to understand the device_setup magic numbers for the Audiophile 32562306a36Sopenharmony_ciUSB, you need some very basic understanding of binary computation. However, 32662306a36Sopenharmony_cithis is not required to use the parameter and you may skip this section. 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ciThe device_setup is one byte long and its structure is the following: 32962306a36Sopenharmony_ci:: 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ci +---+---+---+---+---+---+---+---+ 33262306a36Sopenharmony_ci | b7| b6| b5| b4| b3| b2| b1| b0| 33362306a36Sopenharmony_ci +---+---+---+---+---+---+---+---+ 33462306a36Sopenharmony_ci | 0 | 0 | 0 | Di|24B|96K|DTS|SET| 33562306a36Sopenharmony_ci +---+---+---+---+---+---+---+---+ 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_ciWhere: 33862306a36Sopenharmony_ci 33962306a36Sopenharmony_ci * b0 is the ``SET`` bit 34062306a36Sopenharmony_ci 34162306a36Sopenharmony_ci - it MUST be set if device_setup is initialized 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci * b1 is the ``DTS`` bit 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci - it is set only for Digital output with DTS/AC3 34662306a36Sopenharmony_ci - this setup is not tested 34762306a36Sopenharmony_ci 34862306a36Sopenharmony_ci * b2 is the Rate selection flag 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ci - When set to ``1`` the rate range is 48.1-96kHz 35162306a36Sopenharmony_ci - Otherwise the sample rate range is 8-48kHz 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci * b3 is the bit depth selection flag 35462306a36Sopenharmony_ci 35562306a36Sopenharmony_ci - When set to ``1`` samples are 24bits long 35662306a36Sopenharmony_ci - Otherwise they are 16bits long 35762306a36Sopenharmony_ci - Note that b2 implies b3 as the 96kHz mode is only supported for 24 bits 35862306a36Sopenharmony_ci samples 35962306a36Sopenharmony_ci 36062306a36Sopenharmony_ci * b4 is the Digital input flag 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci - When set to ``1`` the device assumes that an active digital source is 36362306a36Sopenharmony_ci connected 36462306a36Sopenharmony_ci - You shouldn't enable Di if no source is seen on the port (this leads to 36562306a36Sopenharmony_ci synchronization issues) 36662306a36Sopenharmony_ci - b4 is implied by b2 (since only one port is enabled at a time no synch 36762306a36Sopenharmony_ci error can occur) 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci * b5 to b7 are reserved for future uses, and must be set to ``0`` 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci - might become Ao, Do, Ai, for b7, b6, b4 respectively 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ciCaution: 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci * there is no check on the value you will give to device_setup 37662306a36Sopenharmony_ci 37762306a36Sopenharmony_ci - for instance choosing 0x05 (16bits 96kHz) will fail back to 0x09 since 37862306a36Sopenharmony_ci b2 implies b3. But _there_will_be_no_warning_ in /var/log/messages 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_ci * Hardware constraints due to the USB bus limitation aren't checked 38162306a36Sopenharmony_ci 38262306a36Sopenharmony_ci - choosing b2 will prepare all interfaces for 24bits/96kHz but you'll 38362306a36Sopenharmony_ci only be able to use one at the same time 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ciUSB implementation details for this device 38662306a36Sopenharmony_ci~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ciYou may safely skip this section if you're not interested in driver 38962306a36Sopenharmony_cihacking. 39062306a36Sopenharmony_ci 39162306a36Sopenharmony_ciThis section describes some internal aspects of the device and summarizes the 39262306a36Sopenharmony_cidata I got by usb-snooping the windows and Linux drivers. 39362306a36Sopenharmony_ci 39462306a36Sopenharmony_ciThe M-Audio Audiophile USB has 7 USB Interfaces: 39562306a36Sopenharmony_cia "USB interface": 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci * USB Interface nb.0 39862306a36Sopenharmony_ci * USB Interface nb.1 39962306a36Sopenharmony_ci 40062306a36Sopenharmony_ci - Audio Control function 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci * USB Interface nb.2 40362306a36Sopenharmony_ci 40462306a36Sopenharmony_ci - Analog Output 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_ci * USB Interface nb.3 40762306a36Sopenharmony_ci 40862306a36Sopenharmony_ci - Digital Output 40962306a36Sopenharmony_ci 41062306a36Sopenharmony_ci * USB Interface nb.4 41162306a36Sopenharmony_ci 41262306a36Sopenharmony_ci - Analog Input 41362306a36Sopenharmony_ci 41462306a36Sopenharmony_ci * USB Interface nb.5 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci - Digital Input 41762306a36Sopenharmony_ci 41862306a36Sopenharmony_ci * USB Interface nb.6 41962306a36Sopenharmony_ci 42062306a36Sopenharmony_ci - MIDI interface compliant with the MIDIMAN quirk 42162306a36Sopenharmony_ci 42262306a36Sopenharmony_ciEach interface has 5 altsettings (AltSet 1,2,3,4,5) except: 42362306a36Sopenharmony_ci 42462306a36Sopenharmony_ci * Interface 3 (Digital Out) has an extra Alset nb.6 42562306a36Sopenharmony_ci * Interface 5 (Digital In) does not have Alset nb.3 and 5 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ciHere is a short description of the AltSettings capabilities: 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci* AltSettings 1 corresponds to 43062306a36Sopenharmony_ci 43162306a36Sopenharmony_ci - 24-bit depth, 48.1-96kHz sample mode 43262306a36Sopenharmony_ci - Adaptive playback (Ao and Do), Synch capture (Ai), or Asynch capture (Di) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci* AltSettings 2 corresponds to 43562306a36Sopenharmony_ci 43662306a36Sopenharmony_ci - 24-bit depth, 8-48kHz sample mode 43762306a36Sopenharmony_ci - Asynch capture and playback (Ao,Ai,Do,Di) 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci* AltSettings 3 corresponds to 44062306a36Sopenharmony_ci 44162306a36Sopenharmony_ci - 24-bit depth, 8-48kHz sample mode 44262306a36Sopenharmony_ci - Synch capture (Ai) and Adaptive playback (Ao,Do) 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci* AltSettings 4 corresponds to 44562306a36Sopenharmony_ci 44662306a36Sopenharmony_ci - 16-bit depth, 8-48kHz sample mode 44762306a36Sopenharmony_ci - Asynch capture and playback (Ao,Ai,Do,Di) 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci* AltSettings 5 corresponds to 45062306a36Sopenharmony_ci 45162306a36Sopenharmony_ci - 16-bit depth, 8-48kHz sample mode 45262306a36Sopenharmony_ci - Synch capture (Ai) and Adaptive playback (Ao,Do) 45362306a36Sopenharmony_ci 45462306a36Sopenharmony_ci* AltSettings 6 corresponds to 45562306a36Sopenharmony_ci 45662306a36Sopenharmony_ci - 16-bit depth, 8-48kHz sample mode 45762306a36Sopenharmony_ci - Synch playback (Do), audio format type III IEC1937_AC-3 45862306a36Sopenharmony_ci 45962306a36Sopenharmony_ciIn order to ensure a correct initialization of the device, the driver 46062306a36Sopenharmony_ci*must* *know* how the device will be used: 46162306a36Sopenharmony_ci 46262306a36Sopenharmony_ci * if DTS is chosen, only Interface 2 with AltSet nb.6 must be 46362306a36Sopenharmony_ci registered 46462306a36Sopenharmony_ci * if 96KHz only AltSets nb.1 of each interface must be selected 46562306a36Sopenharmony_ci * if samples are using 24bits/48KHz then AltSet 2 must me used if 46662306a36Sopenharmony_ci Digital input is connected, and only AltSet nb.3 if Digital input 46762306a36Sopenharmony_ci is not connected 46862306a36Sopenharmony_ci * if samples are using 16bits/48KHz then AltSet 4 must me used if 46962306a36Sopenharmony_ci Digital input is connected, and only AltSet nb.5 if Digital input 47062306a36Sopenharmony_ci is not connected 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_ciWhen device_setup is given as a parameter to the snd-usb-audio module, the 47362306a36Sopenharmony_ciparse_audio_endpoints function uses a quirk called 47462306a36Sopenharmony_ci``audiophile_skip_setting_quirk`` in order to prevent AltSettings not 47562306a36Sopenharmony_cicorresponding to device_setup from being registered in the driver. 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_ciAudiophile USB and Jack support 47862306a36Sopenharmony_ci=============================== 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_ciThis section deals with support of the Audiophile USB device in Jack. 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_ciThere are 2 main potential issues when using Jackd with the device: 48362306a36Sopenharmony_ci 48462306a36Sopenharmony_ci* support for Big-Endian devices in 24-bit modes 48562306a36Sopenharmony_ci* support for 4-in / 4-out channels 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_ciDirect support in Jackd 48862306a36Sopenharmony_ci----------------------- 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ciJack supports big endian devices only in recent versions (thanks to 49162306a36Sopenharmony_ciAndreas Steinmetz for his first big-endian patch). I can't remember 49262306a36Sopenharmony_ciexactly when this support was released into jackd, let's just say that 49362306a36Sopenharmony_ciwith jackd version 0.103.0 it's almost ok (just a small bug is affecting 49462306a36Sopenharmony_ci16bits Big-Endian devices, but since you've read carefully the above 49562306a36Sopenharmony_ciparagraphs, you're now using kernel >= 2.6.23 and your 16bits devices 49662306a36Sopenharmony_ciare now Little Endians ;-) ). 49762306a36Sopenharmony_ci 49862306a36Sopenharmony_ciYou can run jackd with the following command for playback with Ao and 49962306a36Sopenharmony_cirecord with Ai: 50062306a36Sopenharmony_ci:: 50162306a36Sopenharmony_ci 50262306a36Sopenharmony_ci % jackd -R -dalsa -Phw:1,0 -r48000 -p128 -n2 -D -Chw:1,1 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_ciUsing Alsa plughw 50562306a36Sopenharmony_ci----------------- 50662306a36Sopenharmony_ci 50762306a36Sopenharmony_ciIf you don't have a recent Jackd installed, you can downgrade to using 50862306a36Sopenharmony_cithe Alsa ``plug`` converter. 50962306a36Sopenharmony_ci 51062306a36Sopenharmony_ciFor instance here is one way to run Jack with 2 playback channels on Ao and 2 51162306a36Sopenharmony_cicapture channels from Ai: 51262306a36Sopenharmony_ci:: 51362306a36Sopenharmony_ci 51462306a36Sopenharmony_ci % jackd -R -dalsa -dplughw:1 -r48000 -p256 -n2 -D -Cplughw:1,1 51562306a36Sopenharmony_ci 51662306a36Sopenharmony_ciHowever you may see the following warning message: 51762306a36Sopenharmony_ci You appear to be using the ALSA software "plug" layer, probably a result of 51862306a36Sopenharmony_ci using the "default" ALSA device. This is less efficient than it could be. 51962306a36Sopenharmony_ci Consider using a hardware device instead rather than using the plug layer. 52062306a36Sopenharmony_ci 52162306a36Sopenharmony_ciGetting 2 input and/or output interfaces in Jack 52262306a36Sopenharmony_ci------------------------------------------------ 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ciAs you can see, starting the Jack server this way will only enable 1 stereo 52562306a36Sopenharmony_ciinput (Di or Ai) and 1 stereo output (Ao or Do). 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_ciThis is due to the following restrictions: 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci* Jack can only open one capture device and one playback device at a time 53062306a36Sopenharmony_ci* The Audiophile USB is seen as 2 (or three) Alsa devices: hw:1,0, hw:1,1 53162306a36Sopenharmony_ci (and optionally hw:1,2) 53262306a36Sopenharmony_ci 53362306a36Sopenharmony_ciIf you want to get Ai+Di and/or Ao+Do support with Jack, you would need to 53462306a36Sopenharmony_cicombine the Alsa devices into one logical "complex" device. 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_ciIf you want to give it a try, I recommend reading the information from 53762306a36Sopenharmony_cithis page: http://www.sound-man.co.uk/linuxaudio/ice1712multi.html 53862306a36Sopenharmony_ciIt is related to another device (ice1712) but can be adapted to suit 53962306a36Sopenharmony_cithe Audiophile USB. 54062306a36Sopenharmony_ci 54162306a36Sopenharmony_ciEnabling multiple Audiophile USB interfaces for Jackd will certainly require: 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci* Making sure your Jackd version has the MMAP_COMPLEX patch (see the ice1712 page) 54462306a36Sopenharmony_ci* (maybe) patching the alsa-lib/src/pcm/pcm_multi.c file (see the ice1712 page) 54562306a36Sopenharmony_ci* define a multi device (combination of hw:1,0 and hw:1,1) in your .asoundrc 54662306a36Sopenharmony_ci file 54762306a36Sopenharmony_ci* start jackd with this device 54862306a36Sopenharmony_ci 54962306a36Sopenharmony_ciI had no success in testing this for now, if you have any success with this kind 55062306a36Sopenharmony_ciof setup, please drop me an email. 551