xmos-native-dsd icon indicating copy to clipboard operation
xmos-native-dsd copied to clipboard

Amanero card now supporting DSD native

Open olm52 opened this issue 8 years ago • 567 comments

ref.: http://www.amanero.com/drivers/nativeDSD.txt It seems that with new firmware Amanero Card is supporting DSD native in linux. These are the data given by Amanero:

OEM Combo384 default VID=0x16d0 PID=0x71A

To enable/disable native DSD on Combo384 an USB Control request must be sent to endpoint 0. This procedure is supported on all firmware versions. On firmware_1099rc1 an USB alternate settings "2" with a native DSD endpoint is supported.

The control request is of type Vendor to the Device.

bmRequestType=0x40, bRequest=0xB1, wLength=sizeof( struct VAD_DATA ), Data is a variable of type struct VAD_DATA

struct VAD_DATA {

unsigned int command;
unsigned int length;
unsigned int buffer[64];

};

To enable native DSD command=0x8000
length=0 buffer=undefined values

To disable native DSD command=0x10000 length=0
buffer=undefined values

olm52 avatar Mar 03 '16 09:03 olm52

I have looked into this before. It seems the newer firmware version is not available through their website (yet). The new firmware supporting an additional alt setting sounds promising.

lintweaker avatar Mar 03 '16 17:03 lintweaker

Pardon me, I am just interested in this issue and try to understand. Is there a problem with Amanero's code? It applies to all firmwares. Would you like Amanero to make firmware 1099rc1 public? How relevant is that to you? If that is an issue, I can ask Amanero directly to make it public.

bibo01 avatar Mar 03 '16 23:03 bibo01

The method used in firmware 1099rc1 is preferable as it means only a very small patch to add support for it in Linux. So yes, public availability of the (final) version of that firmware would be great.

lintweaker avatar Mar 04 '16 08:03 lintweaker

I spoke to "Amanero" and that firmware is already public by using the tool to update the firmware. However, he will make it visible on the web site too today.

bibo01 avatar Mar 04 '16 09:03 bibo01

Thanks, 1099rc1 is now available through oemtool117. I flashed my Amanero Combo384 with it. Alt setting 2 is available: `Amanero Technologies Combo384 Amanero at usb-0000:00:14.0-14.1, high speed : USB Audio

Playback: Status: Stop Interface 2 Altset 1 Format: S32_LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 32000, 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us Interface 2 Altset 2 Format: S32_LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 32000, 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us`

I can now create a patch for it. Can you test? I have nothing connected to my Combo384 atm.

lintweaker avatar Mar 04 '16 13:03 lintweaker

Sure - either me or hifi25nl can test it

bibo01 avatar Mar 04 '16 13:03 bibo01

Patch is up (against current alsa-sound git). Uses default USB VID/PID. Firmware 1099rc1 required.

lintweaker avatar Mar 04 '16 16:03 lintweaker

When I have time I will test (maybe tomorrow)

olm52 avatar Mar 04 '16 18:03 olm52

Are need add at quirks.c and rebuilt kernel?

norrest avatar Mar 05 '16 07:03 norrest

I have made a new realtime kernel with this patch for Archlinux (and audiolinux) here: http://www.tophifi.it/ftp/packages/Amanero/

olm52 avatar Mar 05 '16 08:03 olm52

command lsusb show 0x16d0, 0x071a ?

norrest avatar Mar 05 '16 08:03 norrest

My audio status script is showing this: card1 USB Audio card usb3 --> 16d0:071a Amanero Technologies Combo384

olm52 avatar Mar 05 '16 09:03 olm52

its ok!

norrest avatar Mar 05 '16 09:03 norrest

I have made a first test. I am sure that now I have the new firmware, since HQplayer is showing SMD option when not set to DoP

  1. with old not patched kernel --> distorted sound (I can hear the song playing) on only one channel. the other is muted.
  2. with new patched kernel --> distorted sound with both channels
  3. with DoP option all is OK

P. S. I checked also with MPD, same result

olm52 avatar Mar 05 '16 10:03 olm52

Alsa is giving this playing a DSD64 file without upsampling

access: RW_INTERLEAVED format: DSD_U32_BE subformat: STD channels: 2 rate: 88200 (88200/1) period_size: 22050 buffer_size: 44100

olm52 avatar Mar 05 '16 10:03 olm52

Some more information from /proc/asound/card1

Amanero Technologies Combo384 Amanero at usb-0000:00:1d.0-1.4.2, high speed : USB Audio

Playback: Status: Running Interface = 2 Altset = 2 Packet Size = 118 Momentary freq = 88195 Hz (0xb.0640) Feedback Format = 16.16 Interface 2 Altset 1 Format: S32_LE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 32000, 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us Interface 2 Altset 2 Format: S32_LE DSD_U32_BE Channels: 2 Endpoint: 5 OUT (ASYNC) Rates: 32000, 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000 Data packet interval: 125 us

olm52 avatar Mar 05 '16 11:03 olm52

Thanks for the report. The issue could with the sample format (not clear which format is supported by the Amanero) or a firmware issue. When you play native DSD does the distorted sound resemble the music you are playing or complete noise? You could try to swap out the sample format from DSD_U32_BE to DSD_U32_LE and change the player settings accordingly.

lintweaker avatar Mar 05 '16 11:03 lintweaker

do you try dsd mode =0 and 2 ? what version alsa-lib/tools

norrest avatar Mar 05 '16 11:03 norrest

When you play native DSD does the distorted sound resemble the music you are playing or complete noise? You could try to swap out the sample format from DSD_U32_BE to DSD_U32_LE and change the player settings accordingly.

Yes, there is sound but distorted (some high frequency added maybe)

In mpd-dsd I have changed to dsd_native_type "3" (with 0 only one channel distorted, with 2...2 channels distorted) but how "swap out the sample format from DSD_U32_BE to DSD_U32_LE"?

Note: alsa-lib is version 1.1.0

olm52 avatar Mar 05 '16 11:03 olm52

May be ?

  /* XMOS based USB DACs */
    switch (chip->usb_id) {
    case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */
    case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */
    case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */
        if (fp->altsetting == 2)
            return SNDRV_PCM_FMTBIT_DSD_U32_BE;
        break;
    case USB_ID(0x16d0, 0x071a): /* Amanero Combo384 */
    case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
    case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
    case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
    case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */
    case USB_ID(0x2616, 0x0106): /* PS Audio NuWave DAC */
            if (fp->altsetting == 3)
            return SNDRV_PCM_FMTBIT_DSD_U32_BE;
        break;
    default:
        break;
    }

norrest avatar Mar 05 '16 12:03 norrest

I have tried dsd_native_type "2", "0" and "3" in mpd-dsd. Only setting 2 give me sound on both channels.

About altsetting, I think it must be 2, as said by manufacturer "On firmware_1099rc1 an USB alternate settings "2" with a native DSD endpoint is supported."

Maybe this is right?

 /* XMOS based USB DACs */
switch (chip->usb_id) {
case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */
case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */
case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */
    if (fp->altsetting == 2)
        return SNDRV_PCM_FMTBIT_DSD_U32_BE;
    break;
case USB_ID(0x16d0, 0x071a): /* Amanero Combo384 */
    if (fp->altsetting == 2)
        return SNDRV_PCM_FMTBIT_DSD_U32_LE;
    break;
case USB_ID(0x20b1, 0x000a): /* Gustard DAC-X20U */
case USB_ID(0x20b1, 0x2009): /* DIYINHK DSD DXD 384kHz USB to I2S/DSD */
case USB_ID(0x20b1, 0x2023): /* JLsounds I2SoverUSB */
case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */
case USB_ID(0x2616, 0x0106): /* PS Audio NuWave DAC */
        if (fp->altsetting == 3)
        return SNDRV_PCM_FMTBIT_DSD_U32_BE;
    break;
default:
    break;
}

olm52 avatar Mar 05 '16 13:03 olm52

I have used the patch compiled by hifi25nl as reported above.

Like him, with new patched kernel I get distorted sound on both channels. (like a tinny distorted sound)

Furthermore, I noticed that my DAC recognizes the incoming DSD signal always at a higher frequency. That is, if I am outputting DSD64 (with no resampling), the DAC sees it as DSD128; if I am sending DSD128, the DAC sees it as DSD256: and so on.

bibo01 avatar Mar 06 '16 01:03 bibo01

Managed to get a test setup going, the sound is indeed recognizable but tinny. Switching between BE and LE sample formats does not seem to matter/improve things. BTW word of warning: my version of MPD 0.19 lost its ability to use the 32-bit LE DSD sampleformat (compared to the MPD 0.18 version).

lintweaker avatar Mar 06 '16 11:03 lintweaker

@ Lintweaker,

hifi25nl was telling me about a discrepancy between how DSD itself specifies samples in bit, while DOP and ALSA handle them as bytes. Hence, a factor of 8 or 16 has to be applied for the sample rate configuration, according to the following table:

configured hardware 352.8kHz 705.6KHz 1411.2KHz <---- sample rate

8-bit 2.8MHz 5.6MHz 11.2MHz 16-bit 5.6MHz 11.2MHz

`-----------------------------------' actual DSD sample rates

This would match my results of playback at a higher family - DSD128 instead of DSD64 and so on. Did you get similar results? Above all, is it possible to adjust for it in the patch itself?

bibo01 avatar Mar 06 '16 13:03 bibo01

@bibo01 the player side has to set the correct sample rate. Nothing new here. For 32-bit DSD samples (contains 4x 8-bit DSD sample) the rate should be 88.2k for DSD64. That is half the rate using DoP (176.4k). For 8-bit DSD samples its 352.8k.

So far 32-bit DSD samples @ 88.2k (DSD64) works for XMOS based and other DACs.

We probably should ask Amanero what sample size, byte order etc they use. Maybe the use a different order for left right samples.

lintweaker avatar Mar 06 '16 14:03 lintweaker

Amanero is modifying the firmware just now.

olm52 avatar Mar 06 '16 16:03 olm52

Okay, thanks. I was about to sent them an e-mail. I'll wait for the updated firmware.

lintweaker avatar Mar 06 '16 18:03 lintweaker

Great! It should be ready by tomorrow.

bibo01 avatar Mar 07 '16 02:03 bibo01

bibo01 wake up!!!!!!!!

norrest avatar Mar 11 '16 15:03 norrest

I spoke to Amanero a couple of days ago and I was expecting his firmware anytime, but it seems that it is not the case yet. Hopefully soon...

bibo01 avatar Mar 11 '16 22:03 bibo01