uzyura / bitspersampleconv2

Automatically exported from code.google.com/p/bitspersampleconv2
0 stars 1 forks source link

Strange noise shaping #135

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I was checking dithering 24->16 and here is what I've got.

That's original 24-bit sine with -80dB amplitude, resulted 16-bit signal after 
playback through i16v16 with noise shaping on, and the third is with NS off.

Actually I don't see dithering here, only strange additional noise.

Version 4.0.62 x64

Original issue reported on code.google.com by ps...@mail.ru on 27 Aug 2013 at 11:50

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for reporting!

I think this is bug of PlayPcmWin :)

If it worked correctly, simple 1st order noise shaping is performed and
quantization noise must be gathered to higher frequency range.

Original comment by yamamoto2002@gmail.com on 29 Aug 2013 at 12:18

GoogleCodeExporter commented 8 years ago
Tested PlayPcmWin 4.0.62 version.
It seems noise shaping function works correctly.
See graphs below. (Last image is comparison of waveforms of DAC analog output)

I think the problem exists somewhere in your measurement setup.
For this kind of measurement, my recommendation is using WaveGene 1.50 for 
signal generator and WaveSpectra 1.51 for spectrum analyzer. Both free.

Original comment by yamamoto2002@gmail.com on 31 Aug 2013 at 5:22

Attachments:

GoogleCodeExporter commented 8 years ago
BTW, PPW uses very simple 1st order noise shaping to create 16-bit PCM data 
from 24-bit PCM data.
Often dithering is used in noise shaping system but PPW does not use dither in 
this case.

Current implementation of PPW's noise shaping is depicted in Fig.1.

On Fig.1, Input sample is 24-bit depth and output sample is 16-bit.
"Reduce bit-depth From 24 to 16" means lower bit truncation.

Other pictures attached describes transfer function of simple 1st order and 
simple 2nd order noise shaping system.

Hope this helps

Original comment by yamamoto2002@gmail.com on 31 Aug 2013 at 10:08

Attachments:

GoogleCodeExporter commented 8 years ago
Actually we've got the same results (spectrums are the same). But for ears 
16-bit gotten after truncation sounds even more agreeably than 1st order noise 
shaping in PPW (as I understand it is only noise shaping, not dithering+noise 
shaping), not to mention foobar2000's dithering+NS. 

Below are truncated 16 bit / 16 bit from PPW NS on / 16-bit from foobar2000 
dithering on. And spectrum of the last sample.

Why don't you implement such nice dithering+NS like this one in foobar2000? 
It's very strange for me to see that such Audiophile-oriented player doesn't 
have a good bit depth reduction algorithm.

Original comment by ps...@mail.ru on 31 Aug 2013 at 12:39

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

From the graph you provided, it seems foobar uses 1st order noise 
shaping(6dB/oct) and adds dither in noise shaping process and as a result, 
noise floor is raised across the all frequency range.
PPW does not add dither in noise shaping and quantization noise only appears to 
specific frequency and there is no noise floor that is appeared in foobar 
spectrum.

There is a trade-off on designing noise shaping digital filter - if dither is 
added, noise signal peak is decreased but noise floor is raised across the all 
frequency range. you must choose noise peak or noise floor. It is impossible 
which is better than another. each method has pros and cons

I choose this design (without dither in noise shaping) because music signal 
recorded using microphone always contains some noise and this noise effectively 
work as dither and in this case, there is no need to add artificial dither. 
When input PCM data is computer-generated signal, dither-added noise shaping 
produces better result.

Original comment by yamamoto2002@gmail.com on 31 Aug 2013 at 1:34

GoogleCodeExporter commented 8 years ago
Hi,

I added dithered noise shaping function for computer generated PCM on 
PlayPcmWin 4.0.63.

Dithered noise shaping: -108dB RPDF dither is added and then 1st-order noise 
shaping is performed.

Add dither: triangular probability density dither that spans two quantization 
levels is added.

Original comment by yamamoto2002@gmail.com on 15 Sep 2013 at 2:58

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks! It looks and sounds nice.

But anyway foobar's NS is still better. 

Sorry for misleading, don't now how I've got that picture with "1st order noise 
shaping (6dB/oct)" (as you said), but foobar2000 NS always looked like on the 
attached picture, and resuling noise is much lower for hearing as for 
dithering+NS used in PPW.

But anyway thanks for such useful improvement of your application.

Original comment by ps...@mail.ru on 15 Sep 2013 at 7:43

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,

I measured foobar NS myself and its spectrum looks like your #7 post not #4 
post.
It looks like higher order noise shaping method.
I suppose foobar NS really shines when used with 88.2kHz or more sample rate 
music source (or with 2x upsampled 44.1kHz music source) because most 
quantization noise goes beyond 20kHz.

Original comment by yamamoto2002@gmail.com on 15 Sep 2013 at 10:08

GoogleCodeExporter commented 8 years ago
Thank you for valuable suggestion. Bits per sample conversion code of PPW was 
one of the most messy code snippet before. Now program is well refactored and 
it looks much cleaner. 
http://code.google.com/p/bitspersampleconv2/source/browse/trunk/WasapiPcmUtil/Pc
mFormatConverter.cs

BTW your FFT measurement often looks like source sound data contains silence. 
When performing FFT of stationary signal, your PCM data must contain the 
stationary signal from the start to the end. 

Original comment by yamamoto2002@gmail.com on 15 Sep 2013 at 10:31