HydrogenAudio

Lossless Audio Compression => Lossless / Other Codecs => Topic started by: agentt on 2017-03-31 07:29:55

Title: quastion about resampling and quality of recoded file
Post by: agentt on 2017-03-31 07:29:55
source - flac16/44.1  i want to resample to flac16/48
it can seems that there is no question or problem - just recode with dsp(resampling) to 48000
but i have question - may be if recode to 24/48 then quality of result-file will be better then 16/44 ?
as i know foobar do resampling with pcm24/44 to pcm24/48  so may be if target file will be 24/48 - then result quality of resampling will be better (then save to 16/48) ?
i did this for example (sox resampling only)
flac24/96 (resamp) to wav24/48  = file1
flac24/96 (resamp) to wav32/48 to (without_resamp) to wav24/48  = file2
file1 (match to every byte) file2
so can we say quality of recoded to wav32/48 and to wav24/48 is the same and there is no need to up bits per sample if i want max quality resampling to write in target file ?
Title: Re: quastion about resampling and quality of recoded file
Post by: Case on 2017-03-31 08:48:27
The best quality file is your source file without resampling. It is also the smallest in size. If you absolutely must resample to 48 kHz for some special purpose the higher the bitdepth you keep the less quantization noise you introduce. If the audio is very quiet and only uses the lowest bits the noise could become audible. If it's normalized to only use the few upper bits there will be no practical difference.
Title: Re: quastion about resampling and quality of recoded file
Post by: agentt on 2017-03-31 09:20:18
sorry but i dont know anything in theory, so if i just recode (with foobar) wav16/44 to(with resamp) wav24/48  and then to wav16/48 do i lost any bits of data ? or this 8 bits is just  void of nulls?
Title: Re: quastion about resampling and quality of recoded file
Post by: Case on 2017-03-31 09:42:47
You introduce a tiny bit of noise on both conversions. If your final target is 16-bits you should go to 16-bits directly to minimize the error.

Resampling itself will alter the signal a bit, there will probably be a change in frequency response for the highest frequencies. And you can't represent the target samples perfectly when the ratio of the samplerates isn't an integer. For example a sample value of 7 in the original file could turn out to be 8.6 after resampling and you can't store that in a 16 or 24 bit PCM file. It will be stored either as 8 or 9 and both are wrong. Every time you resample again you introduce another round of rounding errors. Possibly also extra dither noise.
Title: Re: quastion about resampling and quality of recoded file
Post by: agentt on 2017-03-31 10:04:46
got it, thanks. but i wonder how foobar downbits perfectly. try to explain
flac24/96 (resamp) to wav24/48 ==match to every bit== flac24/96 (resamp) to wav32/48 to (without_resamp) to wav24/48
so it turns off that wav32/48 to (without_resamp) to wav24/48   is exact copy of direct resamp to wav24/48
does this mean that  foobar downbits perfectly ? why this happens? ) theory says that downbits cant be absolutly perfect.
Title: Re: quastion about resampling and quality of recoded file
Post by: Case on 2017-03-31 10:47:34
The 32-bit output from foobar2000 is floating point. It allows storing 25 bits worth of integers losslessly and it doesn't force you to round numbers to integers. So converting between 24-bit PCM and 32-bit float is lossless.