Difference between revisions of "LossyWAV"

From Hydrogenaudio Knowledgebase
Jump to: navigation, search
(Indicative Bitrate Reduction)
(lossyWAV application settings)
Line 88: Line 88:
 
==lossyWAV application settings==
 
==lossyWAV application settings==
 
<pre>
 
<pre>
lossyWAV beta v0.5.9 : WAV file bit depth reduction method by 2Bdecided.
+
lossyWAV beta v0.6.0 : WAV file bit depth reduction method by 2Bdecided.
 
Delphi implementation by Nick.C from a Matlab script, www.hydrogenaudio.org
 
Delphi implementation by Nick.C from a Matlab script, www.hydrogenaudio.org
  
Line 102: Line 102:
 
               -spf 22224-22235-22346-12347-12358 -fft 10101)
 
               -spf 22224-22235-22346-12347-12358 -fft 10101)
 
-3            compact settings [2xFFT] (-cbs 512 -nts +3.0 -skew 36 -snr 21
 
-3            compact settings [2xFFT] (-cbs 512 -nts +3.0 -skew 36 -snr 21
               -spf 22224-22236-22347-22358-2246C -fft 10001)
+
               -spf 22224-22235-22347-22358-2246C -fft 10001)
  
 
Standard Options:
 
Standard Options:
Line 110: Line 110:
 
               (-ve values reduce bits to remove, +ve values increase)
 
               (-ve values reduce bits to remove, +ve values increase)
 
-force        forcibly over-write output file if it exists; default=off
 
-force        forcibly over-write output file if it exists; default=off
 +
-check        check if WAV file has already been processed. default=off;
 +
              errorlevel=16 if already processed, 0 if not.
  
 
Codec Specific Options:
 
Codec Specific Options:

Revision as of 21:32, 25 December 2007

lossyWAV

lossyWAV is a lossy pre-processor for audio. It reduces bit depth of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate significantly compared to unpreprocessed compression. lossyWAV's primary goal is to maintain transparency with a high degree of confidence when processing any audio data.

History

lossyFLAC was an experiment started by 2Bdecided with the aim of transparently reducing audio bit depth (making some lower bits zero), thereby taking advantage of FLAC's detection of consistently zeroed lower sample bits within each single frame, increasing coding efficiency.[1]

Nick.C ported the original MATLAB implementation to Delphi, and lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. Since then, Nick.C has heavily developed and built upon lossyWAV, with tuning performed with the help of halb27.

Naming

lossyWAV-processed WAV files are named with a double filename extension, .lossy.wav, to make them instantly identifiable. e.g. ".lossy.flac" would indicate an audio file which was processed using lossyWAV, and subsequently encoded using FLAC.[2]

Combinations of lossyWAV with each specific encoder are referred to as lossyX, where X is an abbreviation of the lossless codec name. Combination names are listed in the "known supported codecs" section below.

Presets

  • -1: Highest quality preset, disc space-saving alternative to lossless archiving for large audio collections.
  • -2: Default preset; a compromise between -1 and -3.
  • -3: High quality preset for usage on a compatible DAP, approx. 370kbps for "normal" music. [3]

A comparison of portable media players is here, which shows FLAC and WMA Lossless compatibility among listed players. Presets are, of course, not limited to these example uses. Preset -3 has proven to be more than acceptable for people who have been closely involved with development.

It is up to the user to decide which preset to use for their own purposes.

Supported input formats

  • WAV: 16-bit, 24-bit; sample rate ≥ 32kHz PCM. Very high sample rates (>48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. CD PCM).

Known supported codecs

Recommended settings
Codec lossyWAV parameters Encoder parameters Combination name
FLAC -3 -m -e -r 2 -b 512 [4] lossyFLAC
LPAC -b512 lossyLPAC
MPEG-4 ALS -l -n512 lossyALS
TAK -fsl512 lossyTAK
WavPack --blocksize=512 lossyWV
WMA Lossless -wmalsl (same as -cbs 2048) lossyWMALSL

There is also evidence — so-called "Bit Shifting" — to suggest that lossyWAV may work with MLP, but this remains untested due to prohibitive prices of encoders.

Known unsupported codecs

lossyWAV application settings

lossyWAV beta v0.6.0 : 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 -3.0 -skew 36 -snr 21
              -spf 22224-22225-11235-11246-12358 -fft 11011)
-2            default settings [3xFFT] (-cbs 512 -nts  0.0 -skew 36 -snr 21
              -spf 22224-22235-22346-12347-12358 -fft 10101)
-3            compact settings [2xFFT] (-cbs 512 -nts +3.0 -skew 36 -snr 21
              -spf 22224-22235-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
-check        check if WAV file has already been processed. default=off;
              errorlevel=16 if already processed, 0 if not.

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)/4]; 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.

Indicative Bitrate Reduction

Conversion using lossyWAV beta v0.5.8, FLAC -8

 
|=======================================|=========|=========|=========|=========|
|Album                                  | FLAC -8 |  lW -1  |  lW -2  |  lW -3  |
|=======================================|=========|=========|=========|=========|
|AC/DC - Dirty Deeds Done Dirt Cheap    | 781kbps | 468kbps | 417kbps | 366kbps |
|B52's - Good Stuff                     | 993kbps | 476kbps | 421kbps | 376kbps |
|David Byrne - Uh-Oh                    | 937kbps | 464kbps | 413kbps | 363kbps |
|Fish - Songs From The Mirror           | 854kbps | 451kbps | 399kbps | 357kbps |
|Gerry Rafferty - City To City          | 802kbps | 468kbps | 416kbps | 366kbps |
|Iron Maiden - Can I Play With Madness  | 784kbps | 486kbps | 437kbps | 387kbps |
|Jean Michel Jarre - Oxygene            | 773kbps | 538kbps | 475kbps | 422kbps |
|Marillion - The Thieving Magpie        | 790kbps | 473kbps | 421kbps | 373kbps |
|Mike Oldfield - Tr3s Lunas             | 848kbps | 491kbps | 436kbps | 389kbps |
|Scorpions - Best Of Rockers N' Ballads | 922kbps | 492kbps | 437kbps | 378kbps |
|=======================================|=========|=========|=========|=========|
|Average                                | 850kbps | 480kbps | 426kbps | 376kbps |
|=======================================|=========|=========|=========|=========|
|53 sample "problem" set                | 784kbps | 543kbps | 491kbps | 434kbps |
|=======================================|=========|=========|=========|=========|

Large Batch Conversion: (lossyWAV -3; FLAC -3 -m -e -r 2 -b 512)

|=======================================|=========|=========|=========|=========|
|3283 Tracks; 258 Discs; 87.2GB>36.8GB  | 880kbps | ###kbps | ###kbps | 371kbps |
|=======================================|=========|=========|=========|=========|

Example Foobar2000 Converter Settings

Foobar2000 Converter Settings.PNG

Example flossy.bat file called from above converter settings.

@echo off
c:\data_nic\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 -below -nowarn -quiet
c:\data_nic\bin\flac.exe -8 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" 
del "%~N1.lossy.wav"

Frequently asked questions

  • Question: Is it VBR?
  • Short answer: Yes.
  • Question: Is it transparent?
  • Short answer: Almost certainly.
  • Question: Is it lossless?
  • Short answer: No.
  • Question: Why should I use this?
  • Answer:
  • high quality
  • extremely low chance of audible artefacts
  • reasonable bitrates
  • usable with unmodified, established lossless formats.

Current Test Settings

No current test settings

External links