lintweaker / xmos-native-dsd

native DSD playback support on Linux for USB DACs
GNU General Public License v2.0
84 stars 28 forks source link

Amanero card now supporting DSD native #12

Open olm52 opened 8 years ago

olm52 commented 8 years ago

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

amanero commented 8 years ago

hello norrest, i remarked lot of zeros before a start, try to send 0xaaaaaaaa as silence pattern for DSD

norrest commented 8 years ago

Hi! And it help? Add where?May be u can create patch for mpd? Or i some do not understand)

bibo01 commented 8 years ago

Where do I find firmware_1099rc2?

olm52 commented 8 years ago

You can fin it in oem tool 117 But the patch on this site must be changed or not? Now it is sending BE format for Amanero.

lintweaker commented 8 years ago

I have updated the patch to use the LE sampleformat. I did a few quick tests, the speed of the sound is now correct but I still get 'thinny' sound. I have tried a bunch of sample orders to no effect. It would be nice to hear from @amanero what sample format/data order is expected.

olm52 commented 8 years ago

I have made a kernel (realtime) for Archlinux already patched here: http://www.tophifi.it/ftp/packages/Amanero/ My results are strange. I tested with mpd-git and HQPlayer. HQPlayer is crashing. MPD is apparently working. Less noise but playing a DSD64 file the speed is completely wrong. It is very accelerated. Yes, I have checked that quirks.c was correctly patched. This is the alsa output: access: RW_INTERLEAVED format: DSD_U32_LE subformat: STD channels: 2 rate: 352800 (352800/1) period_size: 32768 buffer_size: 131072

hicaoc commented 8 years ago

I tested mpd-0.20 Play DSD64 also this phenomenon , rate: 352800 (352800/1), It is very accelerated. It should be 88200 . I use mpd-0.19.14 + native_dsd patch is normal.

lintweaker commented 8 years ago

As mentioned in this thread before. The current version of MPD 0.19 + native DSD patch does not support the LE sample format. You can use my version of MPD 0.18 to test.

@hicaoc regular mpd 0.19/0.20 does not support native DSD using 32-bit sampleformats.

hicaoc commented 8 years ago

@lintweaker

mpd 0.19.14 +"0001-Add-native-DSD-support-to-MPD-0.19.14.patch" on my QuattroII DAC(xmos) can use DSD_U32_BE format 。DSD64 Sample_rate is 88200 ,DSD plays correctly。

mpd 0.20 (https://github.com/MaxKellermann/MPD.git) mpd 0.20 does not require native DSD patch can support DSD_U32_BE, but the sampling rate problem , yesterday I have taken the DsdiffDecoderPlugin.cxx # L431: "if (! audio_format_init_checked (audio_format, metadata.sample_rate / 8 " to "if (! audio_format_init_checked (audio_format, metadata.sample_rate / 8 / 4," Later, sample rate playback DFF files to correct. The same method of repair over DsfDecoderPlugin.cxx file , DSF also play correctly . To prevent Dop errors, continue to modify the AlsaOutputPlugin.cxx # L698 : " dop_format.sample_rate / = 2;" as "dop_format.sample_rate * = 2;", tested DoP play also correct.

Later I will test DSD to PCM is correct.

lintweaker commented 8 years ago

@hicaoc you are using an XMOS based DAC, this thread is about the Amanero Combo384. There are no issues with XMOS based DACs.

hicaoc commented 8 years ago

@lintweaker
Yes,I see .I have also met before the sample rate due to incorrect playback speed problems, but also wanted to tell you about. Thanks

lintweaker commented 8 years ago

I can now confirm native DSD working using the rc2 firmware and the 32-bit LE sample format.

norrest commented 8 years ago

May be you can add settings in parameters? for more versatility dsd_mode = 1 (unused) Uncomfortable to use one version of the MPD for XMOS and the other for Amanero! beer Ps. Ask once again : Amanero have clic`s/pops when foward/switch tracks in DSD native mode?

olm52 commented 8 years ago

I am trying to test with mpd-dsd 18.23 with patched kernel, but with this configuration file (working with mpd 19 and mpd-git) I cannot see the database. dsd_native_type "3" is right?

music_directory "/home/audiolinux/Music/" playlist_directory "/home/audiolinux/.mpd/playlists" db_file "/home/audiolinux/.mpd/mpd.db" log_file "/home/audiolinux/.mpd/mpd.log" pid_file "/home/audiolinux/.mpd/mpd.pid" state_file "/home/audiolinux/.mpd/mpdstate"

user "audiolinux"

group "audio"

input { plugin "curl" }

audio_output { type "alsa" name "Amanero" device "hw:1,0" dsd_usb "no"

Enable native DSD playback

dsd_native "yes"

Select 32-bit DSD_U32_LE output format

dsd_native_type "3" auto_resample "no" mixer_type "disabled" }

filesystem_charset "UTF-8"

lintweaker commented 8 years ago

better use a separate DB for 0.18. AFAIK the DBs of 0.18 and 0.19 are not compatible.

olm52 commented 8 years ago

OK, it is working (with mpd 0.18.x). Checked with DSD64, DSD128 and DSD256. Sound is very good.

However, HQPlayer will play distorted in DirectSDM mode and will crash without it. Strange, becuase the author of the sofware is saying that ""Yes, both formats are supported. Only difference is that for BE format, one extra instruction is called to swap the byte order (since x86 architecture is LE, bytes need to be swapped for BE format)."

lintweaker commented 8 years ago

It seems there are still some issues with the rc2 firmware. Sometimes I still get distorted sound after successfully playing a native DSD file. Playing some PCM seems to fix the issue.

olm52 commented 8 years ago

Just now I had to disconnect the Amanero from USB for the same reason. After restarting mpd now all is fine. There is always a click switching from DSD64 song to DSD128.

olm52 commented 8 years ago

...tested DSD512 at 22579200! I have made a test with sox-dsd-git, command line sox in.flac out.dsf rate sdm -f -v 22579200 fast The resulting file is huge! > 1,3 GB People interested can download it from here http://www.tophifi.it/ftp/packages/Amanero/out.dsf

This is playing without distorsion, but speed is low (and also tone). I don't know if this is only a firmware limitation, but since Amanero can play DSD512 in Windows, why shouldn't play it in Linux?

lintweaker commented 8 years ago

@hifi25nl to whom is you question directed? I hope its @amanero they only know what their 1099rc2 firmware is supposed to support.

olm52 commented 8 years ago

Yes, I hope they are reading this.

amanero commented 8 years ago

hello, yep i m reading! Let me install last patch.

jlaako commented 8 years ago

@hifi25nl email me a HQPlayer.log of a playback attempt and I'll check if there are any hints of the issue there. I have bunch of Combo384 boards with stock firmware, I can try to update one with new firmware and try it on DSC1 DAC when I find time...

olm52 commented 8 years ago

@jlaako I have sent the log, but I think that it would be very nice if you test yourself with new firmware.

sonorejr commented 8 years ago

@amanero Are you going to update the driver to support the DSD_U32_BE format?

norrest commented 8 years ago

@amanero are u developer for Amanero?

iftuee commented 8 years ago

One question; How to configure Combo 384 to get the 48 KHz I2S out put? The default config with clock prescalar always gives 44.1 kHz output.. Appreciate your response..

norrest commented 8 years ago

@iftuee This topic not about I2S and PCM 48 KHz out! This topic about support native_dsd Sorry

olm52 commented 8 years ago

Release of new firmware from Amanero... should be imminent

amanero commented 8 years ago

hello online there is a new version rc3 with the optimization enabled. Let me know if it's ok. Otherwise let me know a link with a test DSD512 not properly running so i can test it.

olm52 commented 8 years ago

@amanero Output is always DSD_U32_LE or DSD_U32_BE?

norrest commented 8 years ago

@amanero For new version MPD we need DSD_U32_BE mode ONLY!

jlaako commented 8 years ago

@amanero Doesn't seem to work, behaves the same as rc2. When switched to DSD mode with altsetting, the interface becomes stuck and doesn't proceed. Just like it would be lacking a clock. PCM mode works fine though.

IOW, snd_pcm_wait() always returns 0 in DSD mode.

olm52 commented 8 years ago

Just tested. I can confirm. It doesn't even start.

amanero commented 8 years ago

hmm, to test it is there a linux image already patched i can download?

jlaako commented 8 years ago

@amanero I have a kernel package for Debian Stretch if that is suitable?

amanero commented 8 years ago

it's ok thank you!!!

jlaako commented 8 years ago

@amanero here's the kernel package: https://www.sonarnerd.net/tmp/linux-image-4.5.2-jl+_1_amd64.deb

michaelkhkan commented 8 years ago

I installed the correct Linux headers and patches, amanero' patch is updated and shows altset 2 is available, but how do I altset to 2? Currently mpd plays through altset 1. Thanks!

olm52 commented 8 years ago

It is a lot easier if you use HQPlayer for testing, the trial version will work 30 min. at a time

michaelkhkan commented 8 years ago

Thx for quick reply. Does HQplayer allow me to use altset 2?

olm52 commented 8 years ago

Yes, automatically, but the Amanero firmware is really not working yet (for native DSD)

michaelkhkan commented 8 years ago

Thanks, I hope to be able to choose altset 2 for mpd too

olm52 commented 8 years ago

See my post Apr 2

michaelkhkan commented 8 years ago

Apologies, I am not sure which post to look for to troubleshoot my issue

norrest commented 8 years ago

I want buy amanero board, but i must know, when they create new firmware for dsd native support! Also it must support new version of MPD with DSD_32. Someone can teell when it happen?

olm52 commented 8 years ago

@michaelkhkan you should use mpd-dsd 0.18.x

norrest commented 8 years ago

Why only amanero developers created firmware, who compatible only with old version of mpd? Shoked (

norrest commented 8 years ago

Can they confirm, about future support only old method and old version of mpd?

jlaako commented 8 years ago

@norrest It is fully compatible with the ALSA API, if mpd is not fully compatible with the ALSA API, then mpd should be fixed. Drivers are not supposed to be modified to match one certain application, firmware of a device even less so... Things go the other way, drivers adapt to the hardware/firmware, and applications adapt to the drivers. This is how these things work.

It is much more feasible and easy to change an application, than to modify hardware or firmware.