Having listened to the comments on noise shaping, I had a look on wikipedia and found the basic principles.... I have some of a noise shaping algorithm already in place.The coefficients have so far eluded me. One simple possibility that springs to mind is to start with zero at the codec block / channel start and then add the first difference then divide by two. Then add the next difference and divide by two. And so on.We'll see how it sounds.
Quote from: Nick.C on 05 December, 2007, 05:29:10 PMHaving listened to the comments on noise shaping, I had a look on wikipedia and found the basic principles.... I have some of a noise shaping algorithm already in place.The coefficients have so far eluded me. One simple possibility that springs to mind is to start with zero at the codec block / channel start and then add the first difference then divide by two. Then add the next difference and divide by two. And so on.We'll see how it sounds.You're moving on fast. Wonderful!When considering noise shaping: into what frequency range do yo want to put the noise?
lossyWAV beta v0.5.6 : WAV file bit depth reduction method by 2Bdecided.Delphi implementation by Nick.C from a Matlab script, www.hydrogenaudio.orgUsage : lossyWAV <input wav file> <options>Example : lossyWAV musicfile.wavQuality Options:-1 extreme settings [4xFFT] (-cbs 512 -nts -2.0 -skew 36 -snr 21 -spf 22224-22225-11235-11246-12358 -fft 11011)-2 default settings [3xFFT] (-cbs 512 -nts +1.5 -skew 36 -snr 21 -spf 22224-22235-22346-12347-12358 -fft 10101)-3 compact settings [2xFFT] (-cbs 512 -nts +6.0 -skew 36 -snr 21 -spf 22235-22236-22347-22358-2246C -fft 10001)Standard Options:-o <folder> destination folder for the output file-nts <n> set noise_threshold_shift to n dB (-48.0dB<=n<=+48.0dB) (-ve values reduce bits to remove, +ve values increase)-force forcibly over-write output file if it exists; default=offCodec Specific Options:-wmalsl optimise internal settings for WMA Lossless codec; default=offAdvanced / System Options:-shaping enable fixed shaping using bit_removal difference of previous samples [value = brd(-1)/(2^1)+brd(-2)/(2^2)+...+brd(-n)/(2^n)]; default=off-snr <n> set minimum average signal to added noise ratio to n dB; (-215.0dB<=n<=48.0dB) Increasing value reduces bits to remove.-skew <n> skew fft analysis results by n dB (0.0db<=n<=48.0db) in the frequency range 20Hz to 3.45kHz-spf <5x5hex> manually input the 5 spreading functions as 5 x 5 characters; These correspond to FFTs of 64, 128, 256, 512 & 1024 samples; e.g. 22235-22236-22347-22358-2246C (Characters must be one of 1 to 9 and A to F (zero excluded).-fft <5xbin> select fft lengths to use in analysis, using binary switching, from 64, 128, 256, 512 & 1024 samples, e.g. 01001 = 128,1024-cbs <n> set codec block size to n samples (512<=n<=4608, n mod 32=0)-quiet significantly reduce screen output-nowarn suppress lossyWAV warnings-detail enable detailled output mode-below set process priority to below normal.-low set process priority to low.Special thanks:David Robinson for the method itself and motivation to implement it in Delphi.Dr. Jean Debord for the use of TPMAT036 uFFT & uTypes units for FFT analysis.Halb27 @ www.hydrogenaudio.org for donation and maintenance of the wavIO unit.
Quote from: halb27 on 06 December, 2007, 03:17:27 AM...When considering noise shaping: into what frequency range do yo want to put the noise?Ah, that's the problem - I don't yet know how to determine that.
...When considering noise shaping: into what frequency range do yo want to put the noise?
Anyway as you provided already details like snr and a positive nts value which have shown up to be very advantageous I have full confidence you will arrive at a good result.
I tried -3 -shaping -snr 18 -nts 15 and got 31.28MB / 352.9kbps for my 53 sample set - quite reasonable on my DAP.
AC/DC - Dirty Deeds Done Dirt Cheap / 781kbps / 398kbps / 331kbps / 332kbps / 294kbpsB52's - Good Stuff / 993kbps / 408kbps / 361kbps / 362kbps / 329kbpsDavid Byrne - Uh-Oh / 937kbps / 398kbps / 344kbps / 345kbps / 315kbpsFish - Songs From The Mirror / 854kbps / 384kbps / 336kbps / 336kbps / 306kbpsGerry Rafferty - City To City / 802kbps / 400kbps / 338kbps / 338kbps / 300kbpsIron Maiden - Can I Play With Madness / 784kbps / 422kbps / 371kbps / 372kbps / 334kbpsJean Michel Jarre - Oxygene / 773kbps / 454kbps / 372kbps / 377kbps / 316kbpsMarillion - The Thieving Magpie / 790kbps / 404kbps / 344kbps / 344kbps / 307kbpsMike Oldfield - Tr3s Lunas / 848kbps / 421kbps / 365kbps / 366kbps / 322kbpsScorpions - Best Of Rockers N' Ballads / 922kbps / 421kbps / 354kbps / 354kbps / 318kbps
Sounds very interesting, but I'd really like to know a bit about where the noise goes.I also have a problem about the target and how it fits into what we have so far. So far we have the quality targets -3, -2, and -1 which should all be transparent (-1 in an overkill sense, -2 in a sense with a certain but not overkill safety margin, -3 with only a minor safety margin).What's the target when using noise-shaping?Most important:Do we still want transparency with a certain though small safety margin (equivalent to: should we use it as -3 with the current meaning of -3)?Or do we want to have something like -4 which should transparent nearly any time but is allowed to be not transparent though only in an acceptable way on rare occassion?Or should we use the meaning I just described for a potential -4 for our final -3, and readjust the internal details of -2 and -1 so that the new -2 is somewhere between the current -3 and -2, and the new -1 is somewhere between the current -2 and -1?
@halb27:Would you mind testing out lossyWAV -3 -nts 48 (without noise shaping) on your test set? Casually listening, I've found that I can't hear any difference between files processed with this setting and the originals. Nick also found that he couldn't hear the difference. The -snr 21 default setting seems to be preventing audible distortion, even with the maximum nts value.
@halb27:Would you mind testing out lossyWAV -3 -nts 48 (without noise shaping) on your test set? Casually listening ...
Quote from: Mitch 1 2 on 07 December, 2007, 05:03:53 AM@halb27:Would you mind testing out lossyWAV -3 -nts 48 (without noise shaping) on your test set? Casually listening ...OOPs, I didn't read carefully: didnt read 'without noise shaping'.Anyway I did listen carefully to my regular sample set using -3 -nts 48, and to me too quality is ok. I even did some abxing on several spot and couldn't find a difference.But: it's different with spots that are hard to encode. I proved that already for -nts 30 and -nts 20. And my regular set yielded 320 kbps with -3 -nts 48.When allowing for really bad results though on rare occasion we're better off using vorbis, aac, mpc, and mp3 in the 200- kbps range.Anyway I'll test the -shaping version.
I tried -shaping -snr 18 -nts 15.My regular sample set was encoded with an average bitrate of 308 kbps, and for my problem sample essence it was 425 kbps.With the problem sample set I can easily abx keys_1644ds (9/10). I have also the suspicionthat furious and utb aren't totally transparent, but I'm not the one who can prove it.So far not so bad.Then I decided to listen to some regular music, and it was with the very first track (Blackbird, Yesterday from The Beatles: Love, sec. 31.2-34.4) that didn't sound fine to me. I tried to abx it and got at 7/7, then 8/10.It's an inaccuracy with the voice, so I don't think noise shaping moves noise into the high frequency range.
My results for v0.5.7 -snr 18 -nts 15 -shaping:My regular sample set gets at a very good 293 kbps.The Blackbird, Yesterday problem has gone for me, and I don't have a suspicion on furious any more.However I abxed utb 7/8 (and ended up 7/10), eig 7/10, and bruhns 9/10. There's a rather strong inaccuracy with bruhns at ~sec. 7.Other than that I agree with you, Nick, that we should have only 3 quality parameters, and -3 should be transparent from the best of our experience when we go final. In case we should really get at a final average bitrate of ~300 kbps for -3 I personally don't have the demand for talking about a security margin with -3.In case we should really arrive at that bitrate for -3 we should readjust -2 and -1 IMO: -2 being near current -3 but a little more demanding, and -1 being more where -2 is now (but definitely with nts <= 0).Just an idea: you do a static noise shaping right now, and the noise shaping machinery is supposed to be simple, that is shifts noise up or down in frequency. In case of shifting up: wouldn't it be more or less equivalent (or may be at least a clearer approach) to allow for a weakened noise threshold tn the 12+ kHz range?
Okay, back to the drawing board with -shaping then.... I'll need to research fixed shaping coefficients. Thanks for the listening time.
Quote from: Nick.C on 07 December, 2007, 04:21:10 PMOkay, back to the drawing board with -shaping then.... I'll need to research fixed shaping coefficients. Thanks for the listening time.Ok, I see there's an increased interest in using noise shaping. I'm not sure whether I understand what you are trying to do and why -- and please forgive me for not following the discussion to closely. To be honest, it looks a bit like groping in the dark. In case you have an idea of what "noise shaping" is actually supposed to do in your case I might be able to help you show how it could be implemented. In case you don't you might wanna try my very first suggestion (see the first page of 2B's lossy flac thread).Cheers!SG
We have a problem.I tried v0.5.7 -snr 21 -nts 15 -shaping according to your proposal, Nick. It yields 318 kbps with my regular set and 444 kbps with my problem essence set.I listened to the beginning of Blackbird, Yesterday, and quality was very fine to me.I started to try to abx the problems from my last test, and used eig as the first example. abx result was 9/10.For a comparison I also tried to abx plain -3. Now used to the kind of problem (smearing, kind of an echo) I was able to abx plain -3 9/10 as well, though to me quality is better.I think we should fix this before continuing the noise shaping way.I am not very sensitive to temporal resolution problems, so it would be very kind if somebody could help testing lossyWAV on samples known to be pre-echo prone to mp3 etc.
I still haven't worked out how to change the default console icon in Delphi though......
Nick.C,QuoteI still haven't worked out how to change the default console icon in Delphi though......In Delphi 7 it's "Project | Options | Application" to apply a custom symbol. Hope you'll find it since this is from a German version of Delphi 7..sundance.