I've implemented a simplistic bit_removal noise shaping function, enabled with the -shaping parameter. As yet, I haven't re-calculated the reference_threshold values nor have I included any dithering - need advice from someone with more of a clue than myself. Going to re-read the wikipedia article and a PDF I found.
lossyWAV beta v0.5.6 attached. Superseded.
[!--sizeo:1--][span style=\"font-size:8pt;line-height:100%\"][!--/sizeo--]lossyWAV beta v0.5.6 : WAV file bit depth reduction method by 2Bdecided.
Delphi implementation by Nick.C from a Matlab script, www.hydrogenaudio.org
Usage : lossyWAV <input wav file> <options>
Example : lossyWAV musicfile.wav
Quality 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=off
Codec Specific Options:
-wmalsl optimise internal settings for WMA Lossless codec; default=off
Advanced / 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.
[/size]Please have a listen to this and let me know......