Author Topic: Direct Stream Digital (DSD) add-on  (Read 27889 times)

3delite

  • Posts: 895
Re: Direct Stream Digital (DSD) add-on
« Reply #50 on: 28 Dec '14 - 21:50 »
Yes the .apk does contain the libbass.so file in the folder where specified in the deployment.

Googleing for this "PREBUILT_SHARED_LIBRARY option" and for .so usage with statically linking for Delphi didn't reveal anything, so I am unsure how to use this option.

Oleg N

  • Posts: 86
Re: Direct Stream Digital (DSD) add-on
« Reply #51 on: 12 Feb '15 - 12:50 »
Is there any way to enable DoP on OSX?

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #52 on: 12 Feb '15 - 17:07 »
That should be possible, so long as the device's output is set to 24-bit and matches the DSD stream's format (available from BASS_ChannelGetInfo), ie. same sample rate and channel count. You can use the "Audio MIDI Setup" app to check/set the device's format. There should also be no DSP applied, including volume adjustment. Of course, the BASS_DSD_DOP flag should also be used when creating the DSD stream.

Oleg N

  • Posts: 86
Re: Direct Stream Digital (DSD) add-on
« Reply #53 on: 5 Mar '15 - 11:47 »
Ok, but are there any plans building DSD add-on for iOS, at least, in PCM mode?

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #54 on: 5 Mar '15 - 17:14 »
An iOS version of the BASSDSD add-on is now up in the iOS thread...

   www.un4seen.com/forum/?topic=10910

Oleg N

  • Posts: 86
Re: Direct Stream Digital (DSD) add-on
« Reply #55 on: 6 Mar '15 - 17:09 »
Is it added inside a main bass lib? (ok, I got it, it's in topmost bass.zip archive)
« Last Edit: 6 Mar '15 - 17:51 by Oleg N »

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #56 on: 19 Jun '15 - 21:27 »
Hello Ian,

In the first post you mention the steps to get DSD RAW or DSD DoP working in a Windows environment using Asio or exclusive wasapi.
What are the possibilities on linux (arm) to get the DSD RAW or DSD DoP working on an USB audio DAC with DSD (native) support?

Thanks in advance for you reply.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #57 on: 22 Jun '15 - 12:38 »
DSD-over-PCM should be supported by the ARM Linux (hardfp) version of the BASSDSD add-on. Have you tried it and found it to not be working? There was a bug in DSD-over-PCM playback of DSF files found recently, so if you downloaded it a while ago (over a week ago), you should re-download to get the latest BASSDSD version (2.4.0.1).

Note that when using DSD-over-PCM playback, the data needs to reach the DAC unmodified, which means that the output device's rate (set in BASS_Init) needs to match the DSD-over-PCM stream's rate. That will probably be 176400 Hz, but you can use BASS_ChannelGetInfo to check (see the "freq" value).

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #58 on: 23 Jun '15 - 10:03 »
Thanks.
Untill now I have only used the "convert to PCM" option and would like to use DoP or RAW DSD. I will download the latest DSD lib version and will do some tests. I understand the path needs to be bit perfect. In case of DoP: Can I still use the Bass mixer option when the right sample rate is used and no volume changes are performed?


 

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #59 on: 23 Jun '15 - 17:02 »
Yes, if the mixer has the same sample format as the DSD-over-PCM stream, then the data should go through it unmodified.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #60 on: 24 Jun '15 - 15:43 »
Thank you.
In the mean time I have setup a test environment under linux 64 bit and used the following "tools" for getting the DSD data to the DAC:
Software:
Code: [Select]
private static void init(int deviceno,int freq=44100)
        {

            Bass.BASS_Free();
            Console.Write("Init attempt");
             Console.Write(Bass.BASS_GetVersion().ToString());
            if (!Bass.BASS_Init(deviceno,
                                freq,
                                BASSInit.BASS_DEVICE_DEFAULT,
                               System.IntPtr.Zero))
            {

                Console.Write("BASS init reported: " + Bass.BASS_ErrorGetCode() + Environment.NewLine);
                return;
            }
            else
            {
                Console.Write("Init successful");
            }
            Console.Write("setting config...");
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_BUFFER, 500);
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_UPDATEPERIOD, 20);
            Console.Write("config set....");

        }

        private static void playDSD(bool useDop=false,bool useRaW=false)
        {
            Console.WriteLine("Attempting to start DSD file..");
           
            var flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_UNICODE | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_SAMPLE_FLOAT;
            if (useDop)
            {
                flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_DSD_DOP | BASSFlag.BASS_UNICODE | BASSFlag.BASS_SAMPLE_SOFTWARE;
               
           
            }
            if (useRaW)
            {
                flags = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_UNICODE | BASSFlag.BASS_SAMPLE_SOFTWARE | BASSFlag.BASS_DSD_RAW;

            }
            var pathplusfile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "dsdfile.dsf");
            Console.Write(string.Format("We are looking for {0} {1}", pathplusfile, Environment.NewLine));
           
            init(deviceno, 176400); //change this to read the rate from the stream
            int stream = 0;
            if ((useDop) | useRaW)
            {
                Console.WriteLine("usedop: " + useDop);
                Console.WriteLine("useraw: " + useRaW);
                stream = BassDsd.BASS_DSD_StreamCreateFile(pathplusfile, 0, 0, flags, 0);
            }
            else
            {
                Console.WriteLine("convert to pcm selected");
                stream = BassDsd.BASS_DSD_StreamCreateFile(pathplusfile, 0, 0, flags, 88200);
           
            }
         
            Console.Write(" came passed stream creation." + Environment.NewLine);
            var mixerflags = BASSFlag.BASS_STREAM_AUTOFREE | BASSFlag.BASS_MIXER_NORAMPIN;
            if (stream == 0)
            {
                Console.WriteLine("We could not create stream due to: " + Bass.BASS_ErrorGetCode());
            }


            BASS_CHANNELINFO ci = new BASS_CHANNELINFO();
            Bass.BASS_ChannelGetInfo(stream, ci); // get the sample format
           
            Console.Write(" came passed channel queryinfo." + Environment.NewLine);
           
           
            var mixerHandle = BassMix.BASS_Mixer_StreamCreate(ci.freq,
                                                                  ci.chans,
                                                                    BASSFlag.BASS_MIXER_END); // create mixer
            Console.Write(" came passed mixerstream creation." + Environment.NewLine);
            Console.Write(string.Format("channel freq:{0} channel amount: {1}", ci.freq, ci.chans));
            if (mixerHandle == 0)
            {
                Console.Write("mixer handle failure");
            }
            var _mixerStallSync = new SYNCPROC(OnMixerStall); //attach the handler
            Bass.BASS_ChannelSetSync(mixerHandle,
                                     BASSSync.BASS_SYNC_END | BASSSync.BASS_SYNC_MIXTIME,
                                     0L,
                                     _mixerStallSync,
                                    System.IntPtr.Zero);
            BassMix.BASS_Mixer_StreamAddChannel(mixerHandle,
                                                    stream,
                                                    mixerflags);


           


            if (Bass.BASS_ChannelPlay(mixerHandle, false))
            {
                //        LatestErrorCode += " " + DateTime.Now.ToString() + " " + "could not start BASS_ChannelPLay " + Environment.NewLine;
                Console.Write("Started playing" + Environment.NewLine);
                Console.WriteLine("Press button to stop playing");

            }
            else
            {
                Console.Write("Could not start playback");
                Console.Write("error: " + Bass.BASS_ErrorGetCode());

            }


           
        }


OS: Open Suse 13.1 64 bit running in a vmware virtual machine.

HW: HifiMeDIY DAC with a Savitech 9227 receiver and a ESS Sabre 9018 DAC.

Basically I just created a DSD stream with sample format rate 176400, added the necessary flags to support DSD over PCM: sample float, DOP flag. And a decode flag because we add the stream to a mixer.

Then I use the mixer stream in the ChannelPlay method to actually start playing the file.

Result: A lot of noise but also music at a very low sound level.

I also bypassed the mixer by adding the stream directly to the channelplay method and removed the stream decode flag.
Same result. My initial thoughts are that my DAC does not like the way I offer the DSD stream or it simply does not support DSD over PCM (without additional drivers), but the manufacturer says otherwise.

Perhaps there is some setting I might have overlooked? If I look at the ASIO approach in this forum I noticed options to change LSB first or MSB first. Is this applicable here, too or does it just apply to RAW DSD streaming when using ASIO?

Thanks in advance for your reply.


Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #61 on: 24 Jun '15 - 17:15 »
What device are you using in the BASS_Init call? It should probably be an "hw" device rather than the "default" device to avoid any processing that may modify the data. Also, if you call BASS_GetInfo after BASS_Init, does it confirm that the sample rate is as was requested in the BASS_Init call?

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #62 on: 24 Jun '15 - 21:48 »
I query the list of devices first using BASS_GetDeviceInfos(). The number corresponding to the USB DAC is then entered as deviceno, knowing 0 is no sound and 1 = default I selected device 4.
I added BASS_GetInfo right after BASS_Init() and watched the freq parameter. 176400 was returned.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #63 on: 25 Jun '15 - 17:46 »
OK. To help narrow down where the problem is, are you able to successfully use DSD-over-PCM playback with the same DAC in other software and/or is it working on other platforms, eg. Windows or OSX?

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #64 on: 25 Jun '15 - 18:00 »
I have tested it on a windows 7 machine using the same testprogram but only replacing the bass so's with the windows equivalents.I had to install a driver in order to get the dac recognized under windows. The result is the same. Noise with a low music sound level. I am about to test it using foobar just to see if the device is capable of handling dsd dop or raw at all. To be continued.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #65 on: 29 Jun '15 - 08:36 »
Here are the results of my DSD tests using the BRAVO HD USB DAC.
I used the following programs on a windows 7 64 bit environment:
1) Foobar with SACD plugin and Asio proxy installed.
2) JRiver Media Center.

1) No support for WASAPI DSD playback.
    DoP Playback through ASIO: noise and music at a low soundlevel.
Native DSD through ASIO OK.

2) DoP playback through WASAPI excl. event style: OK. Dop Playback through ASIO: OK. Native DSD through ASIO OK.

So the DAC is capable of handling both DoP and RAW. The DAC is capable of playing every DSD mode J River offers.
I wonder if there are more parameters I could tweak in order to get this DAC working with the bassdsd library?

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #66 on: 29 Jun '15 - 16:03 »
Ian, Do you think it is possible to expose more parameters from bassdsd library for me to tweak, given the above test results?

I am pretty sure it's a matter of finding the right settings to get my DAC working with the bass and dsd library, preferably on a Linux (armhf) environment. I am thinking about the abillity to:
change LSB and MSB settings.
The type of marker in case of DoP.
The amount of consecutive markers sent before the DAC recognizes the type of stream.
Anything else that would help getting this cheap but great DAC playing DSD using nothing but Bass!

Thank you.

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #67 on: 29 Jun '15 - 16:44 »
It may be that the device expects a different DoP marker than what BASSDSD is using. Does JRiver Media Center have that option, and if so what setting do you use to get it working?

Cronus

  • Posts: 2
Re: Direct Stream Digital (DSD) add-on
« Reply #68 on: 29 Jun '15 - 19:58 »
Some hardware may use 0XAA marker, known as dCS marker.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #69 on: 30 Jun '15 - 13:29 »
True, according to Savitech's SA9227 USB receiver datasheet (http://download.esm-cn.com/ATTACHMENTS_201408_101635_20140829860_pdf/SA9227-v1.3a.pdf)
, both DoP 1.0 (0x05/0xFA) and dCS (0xAA) markers are supported.
This chip is used in the USB DAC that reports itself as being a BRAVO HD when connected (brand: HifimeDIY Async DAC).

Now regarding JRiver media: I could not select the type of marker used for DoP transfers, although the JRiver wiki stated otherwise.
I downloaded the latest trial (full working) version of JR Media Center and fiddled with the DSD settings. In case of DoP I can only assume 0x05/0xFA is used. This is confirmed by their documents about how DSD DoP is supposed to be implemented. I guess they were in the design team.

Now I did a retest using Foobar using DoP ASIO again. This time I was also able to get DoP working. The reason why it didn't work was I forgot to select the option "use 64 bit asio" .... Foobar lets me choose between three types of markers: 0x05/0xFA, dCS and exD.
Both 0x05/0xFA and 0xAA are working fine (as they are supposed to according tho Savitech's datasheet). eXD produces only noise.

This probably means there's something else causing DSD DoP playback to fail using the bass dsd lib on windows WASAPI/ linux ALSA.

Ian: Are there any more parameters worth exposing for me to tweak a little more in order to get this DAC working?
This may be a cheap DAC, but the DAC's receiver chip is also used in more expensive DAC's that might have the same problem.

Another question: Can I still use BASS_ChannelPlay()  to play DSD DoP?? (see my earlier posted code example)

Thanks...

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #70 on: 30 Jun '15 - 14:52 »
BASSDSD uses the 0x05/0xFA marker, so it sounds like it should be working with your DAC, but I will add support for the 0xAA marker anyway. When trying BASSDSD on Windows, what output system are you using, eg. exclusive-mode WASAPI or ASIO? If you're using normal BASS playback (eg. BASS_ChannelPlay), that is unlikely to reach the DAC unmodified; it might do if the correct sample format and volume levels have been set in the Sound control panel. I posted some example code for exclusive-mode WASAPI and ASIO output earlier in this thread that you could try:

   www.un4seen.com/forum/?topic=16145.msg112463#msg112463

You could also give the DSDTEST example included in the BASSASIO package a try.

Cronus

  • Posts: 2
Re: Direct Stream Digital (DSD) add-on
« Reply #71 on: 30 Jun '15 - 15:10 »
When using BASS_ChannelPlay on Windows, output samplerate must be set to 176400 and 24bit in the menu advanced standardformat, volume level 100 and drop BASS_Mixer_StreamCreate.

The best way to DSD playback is using WASAPI excl. event style or ASIO.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #72 on: 30 Jun '15 - 15:21 »
HI Ian,

Thanks for your reply.
I used WASAPI exclusive on the windows test program, but used the "normal" bass route via BASS_ChannelPlay on the linux Alsa platform and made sure the correct samplerate was set from bassinit until stream creation and further. I also made sure no volume changes were made. The alsamixer only shows one level control for this device and it does sound level control at a hardware level, not software. I noticed this because the Savitech receiver has only 8 stages of soundlevel control at a hardwarelevel. So this should not influence the bit perfect path. Is there a better way to do this on linux besides using BASS_ChannelPlay, if so could you post a code example on how to do this on linux alsa? For me this is the preferred platform to play DSD DoP (or RAW if possible).

Cronus: Thanks for the advise. I know WASAPI exl or ASIO is the best way, but my goal is to get this running on a linux platform eventually, any advise on that?

Ian @ un4seen

  • Administrator
  • Posts: 20396
Re: Direct Stream Digital (DSD) add-on
« Reply #73 on: 30 Jun '15 - 15:38 »
DoP should be fine with normal BASS playback on Linux so long as you use a "hw" device, which is equivalent to exclusive-mode WASAPI on Windows. Did you try BASSASIO's DSDTEST example? If not, please do so; there's a pre-compiled version in the C\BIN folder.

djagab

  • Posts: 35
Re: Direct Stream Digital (DSD) add-on
« Reply #74 on: 30 Jun '15 - 16:39 »
Thanks for the reply. I just tried the DSDTEST example using the latest bass, bassasio and bassdsd.dll . As input I used a 2 channel DSD64 file.
I have 3 ASIO devices installed. 0 Asio4All (emulator) 1 BRAVO-HD and 2 foo_dsd_asio (foobar proxy).
Only the Asio4All version starts playing in DoP mode with no sound on the output. The other two try playback at DSD native but the dsdtest application crashes right at the start. The BRAVO-HD control panel shows the dsdtest.exe is trying to start DSD64 in native mode (88200 32 bit) Sorry, I was not able to use dsdtest.exe successfully. No bass.log output either.