HydrogenAudio

Lossy Audio Compression => Other Lossy Codecs => Topic started by: Eliteforce on 2010-04-21 10:44:34

Title: lossyWAV noise questions
Post by: Eliteforce on 2010-04-21 10:44:34
Hey guys,

I have some questions about lossyWAV and noise shaping:

Why is it white noise that is added, wouldn't it be less noticeably to use something more like pink noise?
All the noise shaping stuff I've seen tries to push noise into higher frequencies, does the opposite (lower freqs.) not make sense?

I'm mentioning this because I heard the noise with --portable, because the white noise just sticks out of the much "darker" music.
(I will provide ABX proof as soon as I'm at home..)

And, by dividing the music into blocks, I guess that the amount of noise depends on the loudness (-> noise floor?) of each block, but would it also be possible to shape the noise depending on the content of each block?
So if a hi-hat or cymbal was hit the noise would be shaped to be "hidden" behind the "crash" sound?

And my last question for now, does flac also compress most significant bits that are 0?

Thanks.
Title: lossyWAV noise questions
Post by: shadowking on 2010-04-21 14:45:54
LW v1.2 doesn't enable noise shaping. The default is flat white noise regulated by a VBR quality model as I understand.

If you can upload a sample it would be useful . Does it get better using higher setting like -q 3 or -P -t ? Does it get worse on -q 1 ?
Title: lossyWAV noise questions
Post by: pdq on 2010-04-21 17:08:42
And my last question for now, does flac also compress most significant bits that are 0?

I believe this is handled by the predictor.
Title: lossyWAV noise questions
Post by: SebastianG on 2010-04-21 18:30:39
Why is it white noise that is added, wouldn't it be less noticeably to use something more like pink noise?

It depends. Ideally, a psychoacoustic model would be able to determine the a desirable noise colour that gives you a both, high quality and low bitrates.

All the noise shaping stuff I've seen tries to push noise into higher frequencies, does the opposite (lower freqs.) not make sense?

It depends. It doesn't make sense for those applications where noise is usually pushed into higher frequencies. For example, if you reduce the word length of a 24bit mix to 16bit so you can burn it on a CD it doesn't matter whether the resulting signal compresses well or not. Using adaptive noise shaping for this is probably overkill, too. And pink noise will be more noticable in cases where there is no music but only silence.

In case of LossyWAV we're also interested in creating a WAV file that compresses well. Adding high frequency noise may lead to signal-to-noise ratios well below 0dB in some areas which is to be avoided since the bits we gained by adding this part of the noise are lost again during lossless compression as the signal's predictability gets worse. But in LossyWAV the power and color of the noise could be adjusted over time...

[...] but would it also be possible to shape the noise depending on the content of each block?
So if a hi-hat or cymbal was hit the noise would be shaped to be "hidden" behind the "crash" sound?

Yes. And I agree with you that this kind of noise shaping is very desirable.

And my last question for now, does flac also compress most significant bits that are 0?

Sort of.

Cheers,
SG
Title: lossyWAV noise questions
Post by: Eliteforce on 2010-04-21 19:47:28
Thanks for the answers!

Right now I fail to reproduce what I heard yesterday, either I mixed up encoder parameters yesterday or I'm going deaf. 
I'm sorry and will retry in the next days.

Anyway, I think that with a bit more tuning this could replace 320 kbit/s mp3s ... very cool work so far.
Title: lossyWAV noise questions
Post by: halb27 on 2010-04-21 20:43:59
With a former implementation there was a sample for which -P was considered non-transparent.
After that the --altpreset (aka -t) option was introduced which made things more defensive for qualtiy levels below -S as a tendency while keeping bitrate more or less the same.
I don't remember the exact details but some suspicion came up that -P -t isn't transparent too (which made me increase the quality level for productive purposes - paranoid me).
So if you have a sample you can ABX with -P -t it would be welcome to know (though we certainly prefer that there isn't such a thing).

A more intelligent noise shaping targeting at lower bitrate is a bit problematic. At the moment things are pretty much free of flaws - with the only open question whether or not exactly -q 2.5 -t can be considered transparent (we do know though that this is a very good setting quality-wise, and paranoid people like me can go just a bit higher - saving some kbps isn't so important any more nowadays). Targeting at 320 kbps or so probably means we have to give up confidence in quality. More or less the same like with mp3 etc. Look at wavPack lossy which is an alternative to lossyWAV in case you don't have problems playing it back. wavPack lossy has a more effecient noise shaping which together with its integration into just one procdure allows for very good quality usually at around 300 kbps. But it comes at the price that you can't be sure that noise shaping works sufficiently well. It usually does, but that's all. To me it's more consequent not to do noise shaping (or maybe a simple defensive noise shaping towards very high frequencies which however has disadvantages when transcoding to mp3 etc.). It's simply more fail-safe which matches the properties of lossyWAV. For practice moreover in case you are willing to spend more kbps than usually done witn mp3 etc. for the sake of quality, it's not so important nowadays whether it's 320 kbps or 380 kbps. The 60 kbps saving doesn't come for free.
Title: lossyWAV noise questions
Post by: chrizoo on 2010-06-21 23:19:51
Is the minimal deterioration of sound quality (in this case: only noise, right?) caused by lossyWAV considered just as negligible and virtually inaudible as the minimal(*) deterioration caused by normalization
OR
is it more considerable/noticeable/noteworthy ?

(*) as suggested here:
http://www.hydrogenaudio.org/forums/index....st&p=710077 (http://www.hydrogenaudio.org/forums/index.php?showtopic=81660&view=findpost&p=710077)
http://www.hydrogenaudio.org/forums/index....st&p=449552 (http://www.hydrogenaudio.org/forums/index.php?showtopic=50200&view=findpost&p=449552)
Title: lossyWAV noise questions
Post by: pdq on 2010-06-21 23:39:55
The amount of noise added by normalization should be well below audibility, but the amount of noise added by lossyWAV, if done correctly, should be just below, or slightly above, audibility.
Title: lossyWAV noise questions
Post by: chrizoo on 2010-06-21 23:51:49
Thank you. I have read a couple of knowledgeable postings by you and there is no doubt that I trust you, but are there any arguments or numbers/calculations that I could believe instead of my blind faith ?
Title: lossyWAV noise questions
Post by: [JAZ] on 2010-06-22 19:22:29
Any deterioration caused when normalizing (generally speaking, when using gain) is in the level of the smallest representative value, multiplied by the amount of gain applied.

The deterioration caused by lossywav is in the order of several bits (so, bigger than the smallest representative value), 2, 5.. 7bits...
So definitely, the harder that lossywav is pushed (like when used with the zero preset), the more the noise is pushed up and stands to get heard.

Title: lossyWAV noise questions
Post by: chrizoo on 2010-06-22 19:31:55
thank you, [JAZ].