Author Topic: BASS_ATTRIB_VOL internals  (Read 413 times)

alerma

  • Posts: 12
BASS_ATTRIB_VOL internals
« on: 4 Jul '17 - 15:03 »
Friends,
As we know, BASS_ATTRIB_VOL applies software volume inside the BASS audio engine for a specified channel. Is it a high quality volume control? Is a signal processed by 32 or 64 bits algorithm? Does anyone can confirm?

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #1 on: 4 Jul '17 - 15:47 »
The BASS_ATTRIB_VOL settings are applied in 32-bit floating-point.

alerma

  • Posts: 12
Re: BASS_ATTRIB_VOL internals
« Reply #2 on: 4 Jul '17 - 16:13 »
Thanks for the clarification. 32 bit should be enough for a very good digital volume control. And to make it perfect it should be done with dither. How is it implemented in BASS?

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #3 on: 5 Jul '17 - 15:19 »
The BASS_ATTRIB_VOL setting is applied when the channel is added to the final mix, which is floating-point, so no dither is required then. Depending on the platform and/or output device, the BASS output may remain floating-point all the way, but dither could be useful in other cases where it's converted to 24-bit or 16-bit for the device. What platform are you using BASS on?

alerma

  • Posts: 12
Re: BASS_ATTRIB_VOL internals
« Reply #4 on: 5 Jul '17 - 18:23 »
I am on OSX at the moment, but would like to build a cross-platform app eventually. I am looking to implement something similar to 'Internal Volume' of JRiver MC (which is claimed to be a 64 bit algorithm, see https://wiki.jriver.com/index.php/Volume).

Not sure what is audible difference between 32 bit / 32 bit dithered / 64 bit volume controls (some seasoned audiophiles claim there is something, and I am not one of them). There are some discussions on Head-Fi claiming ITunes volume control (32 bit) is not that good compared to JRiver (64 bit). See https://www.head-fi.org/f/threads/effective-number-of-bits-or-why-you-have-to-keep-software-at-full-volume-is-nonsense.671220/#post-9593030

Sorry for the long post, possibly there is nothing to worry about. What do you think?

saga

  • Posts: 2148
Re: BASS_ATTRIB_VOL internals
« Reply #5 on: 5 Jul '17 - 23:38 »
The precision of the mixer has nothing to do with the precision of the volume control. A 64-bit mixer will still sound good even if your volume control has a lower resolution. The precision of the volume control only expressed how many different levels of setting the volume are, and even with a 32-bit volume control, there are already way more levels than a human ear can distinguish. Anyone trying to convince you of something different is talking audiophile nonsense.

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #6 on: 6 Jul '17 - 14:50 »
I am on OSX at the moment

That is one of the platforms where the output is always floating-point when it leaves BASS, so no need for dither there.

rv

  • Posts: 174
Re: BASS_ATTRIB_VOL internals
« Reply #7 on: 6 Jul '17 - 17:35 »
And what about ASIO and WASAPI Exclusive on Windows?

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #8 on: 7 Jul '17 - 16:27 »
They don't currently apply dither. I'll look into adding the option (or perhaps make it automatic).

rv

  • Posts: 174
Re: BASS_ATTRIB_VOL internals
« Reply #9 on: 7 Jul '17 - 16:47 »
Nice idea

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #10 on: 14 Jul '17 - 15:33 »
Here's a BASSWASAPI update that adds a dither option:

   www.un4seen.com/stuff/basswasapi.zip

A new BASS_WASAPI_DITHER flag can be used in BASS_WASAPI_Init calls to request dither. Dither is optional rather than automatic because it destroys bit-perfect output; you probably don't want to enable it unless you're applying DSP (including volume changes). Note it has no effect on shared mode because the sample data is still floating-point when it leaves BASSWASAPI then.

rv

  • Posts: 174
Re: BASS_ATTRIB_VOL internals
« Reply #11 on: 16 Jul '17 - 02:02 »
Thank you, I will try it.

What about ASIO ?

Is it possible for you to not apply the Dither even with the BASS_WASAPI_DITHER  flag, if the device output bit rate does not need it (floating point)
So I will let it always ON

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #12 on: 17 Jul '17 - 17:53 »
When the BASSWASAPI output is floating-point (eg. in shared mode), the BASS_WASAPI_DITHER flag will have no effect.

I will look into adding a dither option in BASSASIO too.

rv

  • Posts: 174
Re: BASS_ATTRIB_VOL internals
« Reply #13 on: 17 Jul '17 - 22:28 »
With a good headphones, I can hear the a bit improvements with this option
My laptop audio card is 24 bit

rv

  • Posts: 174
Re: BASS_ATTRIB_VOL internals
« Reply #14 on: 17 Jul '17 - 23:04 »
What type did you select for us ? :) Pow-r 3 ?
The sound seems more defined in the treble area and better stereo separation, but seems less perceived volume. It is probably as it should, as I hear a bit less harshness in the medium part and bass.
With my 5 ms buffer size, I can hear some clics when the computer is on battery, even if the cpu is 1% only

By the way, a nice addition.

Waiting for the ASIO :)

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #15 on: 18 Jul '17 - 18:01 »
What type did you select for us ? :) Pow-r 3 ?

Nope, plain TPDF dither with no noise shaping :)

It is very unlikely that anyone will be able to hear the effect of dither on 24-bit output. Dither only affects sound at/below the lowest bit's level, which is -138 dB in 24-bit.

If you would like to know more about dither, here's a nice site on the subject, including some videos:

   www.earlevel.com/main/category/digital-audio/dither-digital-audio/

With my 5 ms buffer size, I can hear some clics when the computer is on battery, even if the cpu is 1% only

That won't be related to dither. It could be due to buffer underruns, ie. the device not receiving data quickly enough at times. Does raising the buffer size stop the problem?

rv

  • Posts: 174
Re: BASS_ATTRIB_VOL internals
« Reply #16 on: 20 Jul '17 - 21:48 »
This is very strange as it seems to sound better to my ears with midifiles and bassmidi
It is not easy to do A / B test as I need to init again. But I listened to the same midifile 10 times, and
I can hear better separation between instruments, more pleasant sound when dither is applied...
Maybe this is because the midi stream is not playing at the highest available bits as a commercial MP3 files but are playing in the lower bits
Or maybe because it is a low cost internal laptop audio device that receive 24 bit audio data but then do other conversions inside?....
Maybe someone else can try? :)

I hope the dither is applied at the very final stage, after the dsp and recording insert points  :)

Next will be ASIO test and other audio cards :)

Ian @ un4seen

  • Administrator
  • Posts: 20152
Re: BASS_ATTRIB_VOL internals
« Reply #17 on: 21 Jul '17 - 17:35 »
I hope the dither is applied at the very final stage, after the dsp and recording insert points  :)

Yes, the dither is applied last thing, when the output is converted from floating-point to the device's sample format.

Next will be ASIO test and other audio cards :)

Here's a BASSASIO update with a dither option:

   www.un4seen.com/stuff/bassasio.zip

It adds a BASS_ASIO_FORMAT_DITHER flag to use in BASS_ASIO_ChannelSetFormat calls. For example, like this:

Code: [Select]
BASS_ASIO_ChannelSetFormat(FALSE, 0, BASS_ASIO_FORMAT_FLOAT|BASS_ASIO_FORMAT_DITHER);