https://wiki.hydrogenaud.io/api.php?action=feedcontributions&user=Nick.C&feedformat=atomHydrogenaudio Knowledgebase - User contributions [en]2024-03-29T14:37:07ZUser contributionsMediaWiki 1.22.7https://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2012-10-10T20:12:38Z<p>Nick.C: /* External links */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.3.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 1.3.0 release thread]<br />[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 1.3.0 development thread]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of (blocks of) samples which will then allow the FLAC lossless encoder to make use of its wasted bits feature. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. The added noise is adaptively shaped by default, however the user can select parameters to make the added noise fixed shaped or simply [[Wikipedia:white noise|white noise]]. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--high<br />
!--standard<br />
!--economic<br />
!--portable<br />
!--extraportable<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 548 kbit/s<br />
| 477 kbit/s<br />
| 442 kbit/s<br />
| 407 kbit/s<br />
| 353 kbit/s<br />
| 311 kbit/s<br />
|-<br />
!Nick.C's Full Collection<br />
| FLAC<br />
| 882 kbit/s<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| 307 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--quality insane: (-q I or -q 10) Highest quality preset, generally considered to be excessive;<br />
*--quality extreme: (-q E or -q 7.5) Higher quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--quality high: (-q H or -q 5.0) High quality preset, midway between extreme and standard;<br />
*--quality standard: (-q S or -q 2.5) Default preset, generally accepted to be transparent;<br />
*--quality economic: (-q C or -q 0.0) Intermediate preset midway between standard and portable;<br />
*--quality portable: (-q P or -q -2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
*--quality extraportable: (-q X or -q -5.0) Lowest quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning for version 1.0.0 was performed on quality preset --standard with higher presets being more conservative. For versions 1.1.0, 1.2.0 and 1.3.0, tuning effort has been focused on the lowest quality preset in an effort to achieve an effective compromise between resultant bitrate and perceived quality. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The upper frequency limit used in the calculation of minimum signal power varies, dependent on quality preset, in the range 15.159kHz to 16.682kHz<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.3.0, Copyright (C) 2007-2011 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Process Description:<br />
<br />
lossyWAV is a near lossless audio processor which dynamically reduces the <br />
bitdepth of the signal on a block-by-block basis. Bitdepth reduction adds noise<br />
to the processed output. The amount of permissible added noise is based on<br />
analysis of the signal levels in the default frequency range 20Hz to 16kHz.<br />
<br />
If signals above the upper limiting frequency are at an even lower level, they<br />
can be swamped by the added noise. This is usually inaudible, but the behaviour<br />
can be changed by specifying a different --limit (in the range 10kHz to 20kHz).<br />
<br />
For many audio signals there is little content at very high frequencies and<br />
forcing lossyWAV to keep the added noise level lower than the content at these<br />
frequencies can increase the bitrate dramatically for no perceptible benefit.<br />
<br />
The noise added by the process is shaped using an adaptive method provided by<br />
Sebastian Gesemann. This method, as implemented in lossyWAV, aims to use the<br />
signal itself as the basis of the filter used for noise shaping. Adaptive noise<br />
shaping is enabled by default.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <t> where t is one of the following (default = standard):<br />
I, insane highest quality output, suitable for transcoding;<br />
E, extreme higher quality output, suitable for transcoding;<br />
H, high high quality output, suitable for transcoding;<br />
S, standard default quality output, considered to be transparent;<br />
C, economic intermediate quality output, likely to be transparent;<br />
P, portable good quality output for DAP use, may not be transparent;<br />
X, extraportable lowest quality output, not fully transparent.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Advanced Options:<br />
<br />
- take WAV input from STDIN.<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-q, --quality <n> quality preset (-5.0<=n<=10.0); (-5=lowest, 10=highest;<br />
default=2.5; I=10; E=7.5; H=5; S=2.5; C=0; P=-2.5; X=-5).<br />
--, --stdout write WAV output to STDOUT.<br />
--stdinname <t> pseudo filename to use when input from STDIN.<br />
<br />
Advanced Quality Options:<br />
<br />
-A, --adaptive <n/t> modify settings for Sebastian Gesemann's adaptive noise<br />
shaping method. takes a parameter to set the order of the<br />
FIR filter, (32<=n<=96; default=64; multiple of 8 only);<br />
"OFF" to disable adaptive shaping; "NOWARP" to disable <br />
default frequency warping;<br />
-a, --analyses <n> set number of FFT analysis lengths, (2<=n<=6; default=3,<br />
i.e. 32, 64 & 1024 samples. n=2, remove 32 sample FFT;<br />
n>3 add 512; n>4, add 256; n>6, add 128) nb. FFT lengths.<br />
stated are for 44.1/48kHz audio, higher sample rates will<br />
automatically increase all FFT lengths as required.<br />
-l, --limit <n> set upper frequency limit to be used in analyses to n Hz;<br />
(10000<=n<=20000; default=16000).<br />
--linkchannels revert to original single bits-to-remove value for all<br />
channels rather than channel dependent bits-to-remove.<br />
--maxclips <n> set max. number of acceptable clips per channel per block;<br />
(0<=n<=16; default=3,3,3,3,3,2,2,2,2,2,1,1,1,0,0,0).<br />
-m, --midside analyse 2 channel audio for mid/side content.<br />
--nodccorrect disable DC correction of audio data prior to FFT analysis,<br />
default=on; (DC offset calculated per FFT data set).<br />
--scale <n> factor to scale audio by; (0.0625<n<=8.0; default=1).<br />
-s, --shaping [n] enable fixed noise shaping, takes optional parameter [n]<br />
to allow user defined shaping proportion (0.0<=n<=1.0),<br />
otherwise default to quality setting dependent value.<br />
Disables adaptive noise shaping.<br />
--static <n> set minimum-bits-to-keep-static to n bits (default=6;<br />
7<=n<=28, limited to bits-per-sample - 4).<br />
-U, --underlap <n> enable underlap mode to increase number of FFT analyses<br />
performed at each FFT length, (n = 2, 4 or 8, default=2).<br />
<br />
Output Options:<br />
<br />
--bitdist show distrubution of bits to remove.<br />
--blockdist show distribution of lowest / highest significant bit of<br />
input codec-blocks and bit-removed codec-blocks.<br />
-d, --detail enable per block per channel bits-to-remove data display.<br />
-F, --freqdist enable frequency analysis display of input data.<br />
-H, --histogram show sample value histogram (input, lossy and correction).<br />
--longdist show long frequency distribution data (input/lossy/lwcdf).<br />
--perchannel show selected distribution data per channel.<br />
-p, --postanalyse enable frequency analysis display of output and<br />
correction data in addition to input data.<br />
--sampledist show distribution of lowest / highest significant bit of<br />
input samples and bit-removed samples.<br />
--spread [full] show detailed [more detailed] results from the spreading/<br />
averaging algorithm.<br />
-W, --width <n> select width of output options (79<=n<=255).<br />
<br />
System Options:<br />
<br />
-B, --below set process priority to below normal.<br />
--low set process priority to low.<br />
-N, --nowarnings suppress lossyWAV warnings.<br />
-Q, --quiet significantly reduce screen output.<br />
-S, --silent no screen output.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the adaptive noise shaping method and the amount of<br />
help received in implementing it and also for the basis of<br />
the fixed noise shaping method.<br />
<br />
Matteo Frigo and for libfftw3-3.dll contained in the FFTW distribution<br />
Steven G Johnson (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV and WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===lossyWAV and [[foobar2000]]===<br />
Example [[foobar2000]] converter settings:<br />
<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWMALSL* settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wma<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --quality standard --silent --stdout|<br />
c:\"program files"\bin\wmaencode - %d --codec lsl --ignorelength<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
lossyWMALSL conversion uses WMAEncode.exe by lvqcl found [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=90519&view=findpost&p=767754 here].<br />
<br />
===lossyWAV and EAC===<br />
:''For example settings, see [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=96635 lossyWAV 1.3.1 Delphi to C++ translation thread]<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 lossyWAV 1.3.0 release thread] - Release of version 1.3.0 on 06 August 2011<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2011-09-23T21:14:39Z<p>Nick.C: /* Quality presets */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.3.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 1.3.0 release thread]<br />[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 1.3.0 development thread]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of (blocks of) samples which will then allow the FLAC lossless encoder to make use of its wasted bits feature. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. The added noise is adaptively shaped by default, however the user can select parameters to make the added noise fixed shaped or simply [[Wikipedia:white noise|white noise]]. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--high<br />
!--standard<br />
!--economic<br />
!--portable<br />
!--extraportable<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 548 kbit/s<br />
| 477 kbit/s<br />
| 442 kbit/s<br />
| 407 kbit/s<br />
| 353 kbit/s<br />
| 311 kbit/s<br />
|-<br />
!Nick.C's Full Collection<br />
| FLAC<br />
| 882 kbit/s<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| 307 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--quality insane: (-q I or -q 10) Highest quality preset, generally considered to be excessive;<br />
*--quality extreme: (-q E or -q 7.5) Higher quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--quality high: (-q H or -q 5.0) High quality preset, midway between extreme and standard;<br />
*--quality standard: (-q S or -q 2.5) Default preset, generally accepted to be transparent;<br />
*--quality economic: (-q C or -q 0.0) Intermediate preset midway between standard and portable;<br />
*--quality portable: (-q P or -q -2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
*--quality extraportable: (-q X or -q -5.0) Lowest quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning for version 1.0.0 was performed on quality preset --standard with higher presets being more conservative. For versions 1.1.0, 1.2.0 and 1.3.0, tuning effort has been focused on the lowest quality preset in an effort to achieve an effective compromise between resultant bitrate and perceived quality. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The upper frequency limit used in the calculation of minimum signal power varies, dependent on quality preset, in the range 15.159kHz to 16.682kHz<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.3.0, Copyright (C) 2007-2011 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Process Description:<br />
<br />
lossyWAV is a near lossless audio processor which dynamically reduces the <br />
bitdepth of the signal on a block-by-block basis. Bitdepth reduction adds noise<br />
to the processed output. The amount of permissible added noise is based on<br />
analysis of the signal levels in the default frequency range 20Hz to 16kHz.<br />
<br />
If signals above the upper limiting frequency are at an even lower level, they<br />
can be swamped by the added noise. This is usually inaudible, but the behaviour<br />
can be changed by specifying a different --limit (in the range 10kHz to 20kHz).<br />
<br />
For many audio signals there is little content at very high frequencies and<br />
forcing lossyWAV to keep the added noise level lower than the content at these<br />
frequencies can increase the bitrate dramatically for no perceptible benefit.<br />
<br />
The noise added by the process is shaped using an adaptive method provided by<br />
Sebastian Gesemann. This method, as implemented in lossyWAV, aims to use the<br />
signal itself as the basis of the filter used for noise shaping. Adaptive noise<br />
shaping is enabled by default.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <t> where t is one of the following (default = standard):<br />
I, insane highest quality output, suitable for transcoding;<br />
E, extreme higher quality output, suitable for transcoding;<br />
H, high high quality output, suitable for transcoding;<br />
S, standard default quality output, considered to be transparent;<br />
C, economic intermediate quality output, likely to be transparent;<br />
P, portable good quality output for DAP use, may not be transparent;<br />
X, extraportable lowest quality output, not fully transparent.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Advanced Options:<br />
<br />
- take WAV input from STDIN.<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-q, --quality <n> quality preset (-5.0<=n<=10.0); (-5=lowest, 10=highest;<br />
default=2.5; I=10; E=7.5; H=5; S=2.5; C=0; P=-2.5; X=-5).<br />
--, --stdout write WAV output to STDOUT.<br />
--stdinname <t> pseudo filename to use when input from STDIN.<br />
<br />
Advanced Quality Options:<br />
<br />
-A, --adaptive <n/t> modify settings for Sebastian Gesemann's adaptive noise<br />
shaping method. takes a parameter to set the order of the<br />
FIR filter, (32<=n<=96; default=64; multiple of 8 only);<br />
"OFF" to disable adaptive shaping; "NOWARP" to disable <br />
default frequency warping;<br />
-a, --analyses <n> set number of FFT analysis lengths, (2<=n<=6; default=3,<br />
i.e. 32, 64 & 1024 samples. n=2, remove 32 sample FFT;<br />
n>3 add 512; n>4, add 256; n>6, add 128) nb. FFT lengths.<br />
stated are for 44.1/48kHz audio, higher sample rates will<br />
automatically increase all FFT lengths as required.<br />
-l, --limit <n> set upper frequency limit to be used in analyses to n Hz;<br />
(10000<=n<=20000; default=16000).<br />
--linkchannels revert to original single bits-to-remove value for all<br />
channels rather than channel dependent bits-to-remove.<br />
--maxclips <n> set max. number of acceptable clips per channel per block;<br />
(0<=n<=16; default=3,3,3,3,3,2,2,2,2,2,1,1,1,0,0,0).<br />
-m, --midside analyse 2 channel audio for mid/side content.<br />
--nodccorrect disable DC correction of audio data prior to FFT analysis,<br />
default=on; (DC offset calculated per FFT data set).<br />
--scale <n> factor to scale audio by; (0.0625<n<=8.0; default=1).<br />
-s, --shaping [n] enable fixed noise shaping, takes optional parameter [n]<br />
to allow user defined shaping proportion (0.0<=n<=1.0),<br />
otherwise default to quality setting dependent value.<br />
Disables adaptive noise shaping.<br />
--static <n> set minimum-bits-to-keep-static to n bits (default=6;<br />
7<=n<=28, limited to bits-per-sample - 4).<br />
-U, --underlap <n> enable underlap mode to increase number of FFT analyses<br />
performed at each FFT length, (n = 2, 4 or 8, default=2).<br />
<br />
Output Options:<br />
<br />
--bitdist show distrubution of bits to remove.<br />
--blockdist show distribution of lowest / highest significant bit of<br />
input codec-blocks and bit-removed codec-blocks.<br />
-d, --detail enable per block per channel bits-to-remove data display.<br />
-F, --freqdist enable frequency analysis display of input data.<br />
-H, --histogram show sample value histogram (input, lossy and correction).<br />
--longdist show long frequency distribution data (input/lossy/lwcdf).<br />
--perchannel show selected distribution data per channel.<br />
-p, --postanalyse enable frequency analysis display of output and<br />
correction data in addition to input data.<br />
--sampledist show distribution of lowest / highest significant bit of<br />
input samples and bit-removed samples.<br />
--spread [full] show detailed [more detailed] results from the spreading/<br />
averaging algorithm.<br />
-W, --width <n> select width of output options (79<=n<=255).<br />
<br />
System Options:<br />
<br />
-B, --below set process priority to below normal.<br />
--low set process priority to low.<br />
-N, --nowarnings suppress lossyWAV warnings.<br />
-Q, --quiet significantly reduce screen output.<br />
-S, --silent no screen output.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the adaptive noise shaping method and the amount of<br />
help received in implementing it and also for the basis of<br />
the fixed noise shaping method.<br />
<br />
Matteo Frigo and for libfftw3-3.dll contained in the FFTW distribution<br />
Steven G Johnson (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV and WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===lossyWAV and [[foobar2000]]===<br />
Example [[foobar2000]] converter settings:<br />
<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWMALSL* settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wma<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --quality standard --silent --stdout|<br />
c:\"program files"\bin\wmaencode - %d --codec lsl --ignorelength<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
lossyWMALSL conversion uses WMAEncode.exe by lvqcl found [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=90519&view=findpost&p=767754 here].<br />
<br />
===lossyWAV and EAC===<br />
:''For example settings, see [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 lossyWAV 1.3.0 release thread] - Release of version 1.3.0 on 06 August 2011<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2011-09-19T19:24:47Z<p>Nick.C: /* lossyWAV and foobar2000 */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.3.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 1.3.0 release thread]<br />[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 1.3.0 development thread]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of (blocks of) samples which will then allow the FLAC lossless encoder to make use of its wasted bits feature. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. The added noise is adaptively shaped by default, however the user can select parameters to make the added noise fixed shaped or simply [[Wikipedia:white noise|white noise]]. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--high<br />
!--standard<br />
!--economic<br />
!--portable<br />
!--extraportable<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 548 kbit/s<br />
| 477 kbit/s<br />
| 442 kbit/s<br />
| 407 kbit/s<br />
| 353 kbit/s<br />
| 311 kbit/s<br />
|-<br />
!Nick.C's Full Collection<br />
| FLAC<br />
| 882 kbit/s<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| 307 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--quality insane: (-q I or -q 10) Highest quality preset, generally considered to be excessive;<br />
*--quality extreme: (-q E or -q 7.5) Higher quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--quality high: (-q H or -q 5.0) High quality preset, midway between extreme and standard;<br />
*--quality standard: (-q S or -q 2.5) Default preset, generally accepted to be transparent;<br />
*--quality economic: (-q C or -q 0.0) Intermediate preset midway between standard and portable;<br />
*--quality portable: (-q P or -q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
*--quality extraportable: (-q X or -q 5.0) Lowest quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The upper frequency limit used in the calculation of minimum signal power varies, dependent on quality preset, in the range 15.159kHz to 16.682kHz<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.3.0, Copyright (C) 2007-2011 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Process Description:<br />
<br />
lossyWAV is a near lossless audio processor which dynamically reduces the <br />
bitdepth of the signal on a block-by-block basis. Bitdepth reduction adds noise<br />
to the processed output. The amount of permissible added noise is based on<br />
analysis of the signal levels in the default frequency range 20Hz to 16kHz.<br />
<br />
If signals above the upper limiting frequency are at an even lower level, they<br />
can be swamped by the added noise. This is usually inaudible, but the behaviour<br />
can be changed by specifying a different --limit (in the range 10kHz to 20kHz).<br />
<br />
For many audio signals there is little content at very high frequencies and<br />
forcing lossyWAV to keep the added noise level lower than the content at these<br />
frequencies can increase the bitrate dramatically for no perceptible benefit.<br />
<br />
The noise added by the process is shaped using an adaptive method provided by<br />
Sebastian Gesemann. This method, as implemented in lossyWAV, aims to use the<br />
signal itself as the basis of the filter used for noise shaping. Adaptive noise<br />
shaping is enabled by default.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <t> where t is one of the following (default = standard):<br />
I, insane highest quality output, suitable for transcoding;<br />
E, extreme higher quality output, suitable for transcoding;<br />
H, high high quality output, suitable for transcoding;<br />
S, standard default quality output, considered to be transparent;<br />
C, economic intermediate quality output, likely to be transparent;<br />
P, portable good quality output for DAP use, may not be transparent;<br />
X, extraportable lowest quality output, not fully transparent.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Advanced Options:<br />
<br />
- take WAV input from STDIN.<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-q, --quality <n> quality preset (-5.0<=n<=10.0); (-5=lowest, 10=highest;<br />
default=2.5; I=10; E=7.5; H=5; S=2.5; C=0; P=-2.5; X=-5).<br />
--, --stdout write WAV output to STDOUT.<br />
--stdinname <t> pseudo filename to use when input from STDIN.<br />
<br />
Advanced Quality Options:<br />
<br />
-A, --adaptive <n/t> modify settings for Sebastian Gesemann's adaptive noise<br />
shaping method. takes a parameter to set the order of the<br />
FIR filter, (32<=n<=96; default=64; multiple of 8 only);<br />
"OFF" to disable adaptive shaping; "NOWARP" to disable <br />
default frequency warping;<br />
-a, --analyses <n> set number of FFT analysis lengths, (2<=n<=6; default=3,<br />
i.e. 32, 64 & 1024 samples. n=2, remove 32 sample FFT;<br />
n>3 add 512; n>4, add 256; n>6, add 128) nb. FFT lengths.<br />
stated are for 44.1/48kHz audio, higher sample rates will<br />
automatically increase all FFT lengths as required.<br />
-l, --limit <n> set upper frequency limit to be used in analyses to n Hz;<br />
(10000<=n<=20000; default=16000).<br />
--linkchannels revert to original single bits-to-remove value for all<br />
channels rather than channel dependent bits-to-remove.<br />
--maxclips <n> set max. number of acceptable clips per channel per block;<br />
(0<=n<=16; default=3,3,3,3,3,2,2,2,2,2,1,1,1,0,0,0).<br />
-m, --midside analyse 2 channel audio for mid/side content.<br />
--nodccorrect disable DC correction of audio data prior to FFT analysis,<br />
default=on; (DC offset calculated per FFT data set).<br />
--scale <n> factor to scale audio by; (0.0625<n<=8.0; default=1).<br />
-s, --shaping [n] enable fixed noise shaping, takes optional parameter [n]<br />
to allow user defined shaping proportion (0.0<=n<=1.0),<br />
otherwise default to quality setting dependent value.<br />
Disables adaptive noise shaping.<br />
--static <n> set minimum-bits-to-keep-static to n bits (default=6;<br />
7<=n<=28, limited to bits-per-sample - 4).<br />
-U, --underlap <n> enable underlap mode to increase number of FFT analyses<br />
performed at each FFT length, (n = 2, 4 or 8, default=2).<br />
<br />
Output Options:<br />
<br />
--bitdist show distrubution of bits to remove.<br />
--blockdist show distribution of lowest / highest significant bit of<br />
input codec-blocks and bit-removed codec-blocks.<br />
-d, --detail enable per block per channel bits-to-remove data display.<br />
-F, --freqdist enable frequency analysis display of input data.<br />
-H, --histogram show sample value histogram (input, lossy and correction).<br />
--longdist show long frequency distribution data (input/lossy/lwcdf).<br />
--perchannel show selected distribution data per channel.<br />
-p, --postanalyse enable frequency analysis display of output and<br />
correction data in addition to input data.<br />
--sampledist show distribution of lowest / highest significant bit of<br />
input samples and bit-removed samples.<br />
--spread [full] show detailed [more detailed] results from the spreading/<br />
averaging algorithm.<br />
-W, --width <n> select width of output options (79<=n<=255).<br />
<br />
System Options:<br />
<br />
-B, --below set process priority to below normal.<br />
--low set process priority to low.<br />
-N, --nowarnings suppress lossyWAV warnings.<br />
-Q, --quiet significantly reduce screen output.<br />
-S, --silent no screen output.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the adaptive noise shaping method and the amount of<br />
help received in implementing it and also for the basis of<br />
the fixed noise shaping method.<br />
<br />
Matteo Frigo and for libfftw3-3.dll contained in the FFTW distribution<br />
Steven G Johnson (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV and WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===lossyWAV and [[foobar2000]]===<br />
Example [[foobar2000]] converter settings:<br />
<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWMALSL* settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wma<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --quality standard --silent --stdout|<br />
c:\"program files"\bin\wmaencode - %d --codec lsl --ignorelength<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
lossyWMALSL conversion uses WMAEncode.exe by lvqcl found [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=90519&view=findpost&p=767754 here].<br />
<br />
===lossyWAV and EAC===<br />
:''For example settings, see [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 lossyWAV 1.3.0 release thread] - Release of version 1.3.0 on 06 August 2011<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2011-09-19T19:18:47Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.3.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 1.3.0 release thread]<br />[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 1.3.0 development thread]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of (blocks of) samples which will then allow the FLAC lossless encoder to make use of its wasted bits feature. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. The added noise is adaptively shaped by default, however the user can select parameters to make the added noise fixed shaped or simply [[Wikipedia:white noise|white noise]]. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--high<br />
!--standard<br />
!--economic<br />
!--portable<br />
!--extraportable<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 548 kbit/s<br />
| 477 kbit/s<br />
| 442 kbit/s<br />
| 407 kbit/s<br />
| 353 kbit/s<br />
| 311 kbit/s<br />
|-<br />
!Nick.C's Full Collection<br />
| FLAC<br />
| 882 kbit/s<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| -<br />
| 307 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--quality insane: (-q I or -q 10) Highest quality preset, generally considered to be excessive;<br />
*--quality extreme: (-q E or -q 7.5) Higher quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--quality high: (-q H or -q 5.0) High quality preset, midway between extreme and standard;<br />
*--quality standard: (-q S or -q 2.5) Default preset, generally accepted to be transparent;<br />
*--quality economic: (-q C or -q 0.0) Intermediate preset midway between standard and portable;<br />
*--quality portable: (-q P or -q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
*--quality extraportable: (-q X or -q 5.0) Lowest quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The upper frequency limit used in the calculation of minimum signal power varies, dependent on quality preset, in the range 15.159kHz to 16.682kHz<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.3.0, Copyright (C) 2007-2011 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Process Description:<br />
<br />
lossyWAV is a near lossless audio processor which dynamically reduces the <br />
bitdepth of the signal on a block-by-block basis. Bitdepth reduction adds noise<br />
to the processed output. The amount of permissible added noise is based on<br />
analysis of the signal levels in the default frequency range 20Hz to 16kHz.<br />
<br />
If signals above the upper limiting frequency are at an even lower level, they<br />
can be swamped by the added noise. This is usually inaudible, but the behaviour<br />
can be changed by specifying a different --limit (in the range 10kHz to 20kHz).<br />
<br />
For many audio signals there is little content at very high frequencies and<br />
forcing lossyWAV to keep the added noise level lower than the content at these<br />
frequencies can increase the bitrate dramatically for no perceptible benefit.<br />
<br />
The noise added by the process is shaped using an adaptive method provided by<br />
Sebastian Gesemann. This method, as implemented in lossyWAV, aims to use the<br />
signal itself as the basis of the filter used for noise shaping. Adaptive noise<br />
shaping is enabled by default.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <t> where t is one of the following (default = standard):<br />
I, insane highest quality output, suitable for transcoding;<br />
E, extreme higher quality output, suitable for transcoding;<br />
H, high high quality output, suitable for transcoding;<br />
S, standard default quality output, considered to be transparent;<br />
C, economic intermediate quality output, likely to be transparent;<br />
P, portable good quality output for DAP use, may not be transparent;<br />
X, extraportable lowest quality output, not fully transparent.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Advanced Options:<br />
<br />
- take WAV input from STDIN.<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-q, --quality <n> quality preset (-5.0<=n<=10.0); (-5=lowest, 10=highest;<br />
default=2.5; I=10; E=7.5; H=5; S=2.5; C=0; P=-2.5; X=-5).<br />
--, --stdout write WAV output to STDOUT.<br />
--stdinname <t> pseudo filename to use when input from STDIN.<br />
<br />
Advanced Quality Options:<br />
<br />
-A, --adaptive <n/t> modify settings for Sebastian Gesemann's adaptive noise<br />
shaping method. takes a parameter to set the order of the<br />
FIR filter, (32<=n<=96; default=64; multiple of 8 only);<br />
"OFF" to disable adaptive shaping; "NOWARP" to disable <br />
default frequency warping;<br />
-a, --analyses <n> set number of FFT analysis lengths, (2<=n<=6; default=3,<br />
i.e. 32, 64 & 1024 samples. n=2, remove 32 sample FFT;<br />
n>3 add 512; n>4, add 256; n>6, add 128) nb. FFT lengths.<br />
stated are for 44.1/48kHz audio, higher sample rates will<br />
automatically increase all FFT lengths as required.<br />
-l, --limit <n> set upper frequency limit to be used in analyses to n Hz;<br />
(10000<=n<=20000; default=16000).<br />
--linkchannels revert to original single bits-to-remove value for all<br />
channels rather than channel dependent bits-to-remove.<br />
--maxclips <n> set max. number of acceptable clips per channel per block;<br />
(0<=n<=16; default=3,3,3,3,3,2,2,2,2,2,1,1,1,0,0,0).<br />
-m, --midside analyse 2 channel audio for mid/side content.<br />
--nodccorrect disable DC correction of audio data prior to FFT analysis,<br />
default=on; (DC offset calculated per FFT data set).<br />
--scale <n> factor to scale audio by; (0.0625<n<=8.0; default=1).<br />
-s, --shaping [n] enable fixed noise shaping, takes optional parameter [n]<br />
to allow user defined shaping proportion (0.0<=n<=1.0),<br />
otherwise default to quality setting dependent value.<br />
Disables adaptive noise shaping.<br />
--static <n> set minimum-bits-to-keep-static to n bits (default=6;<br />
7<=n<=28, limited to bits-per-sample - 4).<br />
-U, --underlap <n> enable underlap mode to increase number of FFT analyses<br />
performed at each FFT length, (n = 2, 4 or 8, default=2).<br />
<br />
Output Options:<br />
<br />
--bitdist show distrubution of bits to remove.<br />
--blockdist show distribution of lowest / highest significant bit of<br />
input codec-blocks and bit-removed codec-blocks.<br />
-d, --detail enable per block per channel bits-to-remove data display.<br />
-F, --freqdist enable frequency analysis display of input data.<br />
-H, --histogram show sample value histogram (input, lossy and correction).<br />
--longdist show long frequency distribution data (input/lossy/lwcdf).<br />
--perchannel show selected distribution data per channel.<br />
-p, --postanalyse enable frequency analysis display of output and<br />
correction data in addition to input data.<br />
--sampledist show distribution of lowest / highest significant bit of<br />
input samples and bit-removed samples.<br />
--spread [full] show detailed [more detailed] results from the spreading/<br />
averaging algorithm.<br />
-W, --width <n> select width of output options (79<=n<=255).<br />
<br />
System Options:<br />
<br />
-B, --below set process priority to below normal.<br />
--low set process priority to low.<br />
-N, --nowarnings suppress lossyWAV warnings.<br />
-Q, --quiet significantly reduce screen output.<br />
-S, --silent no screen output.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the adaptive noise shaping method and the amount of<br />
help received in implementing it and also for the basis of<br />
the fixed noise shaping method.<br />
<br />
Matteo Frigo and for libfftw3-3.dll contained in the FFTW distribution<br />
Steven G Johnson (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV and WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===lossyWAV and [[foobar2000]]===<br />
Example [[foobar2000]] converter settings:<br />
<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===lossyWAV and EAC===<br />
:''For example settings, see [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 lossyWAV 1.3.0 release thread] - Release of version 1.3.0 on 06 August 2011<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2011-08-09T18:21:59Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.3.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of (blocks of) samples which will then allow the FLAC lossless encoder to make use of its wasted bits feature. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. The added noise is adaptively shaped by default, however the user can select parameters to make the added noise fixed shaped or simply [[Wikipedia:white noise|white noise]]. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--quality insane: (-q I or -q 10) Highest quality preset, generally considered to be excessive;<br />
*--quality extreme: (-q E or -q 7.5) Higher quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--quality high: (-q H or -q 5.0) High quality preset, midway between extreme and standard;<br />
*--quality standard: (-q S or -q 2.5) Default preset, generally accepted to be transparent;<br />
*--quality economic: (-q C or -q 0.0) Intermediate preset midway between standard and portable;<br />
*--quality portable: (-q P or -q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
*--quality extraportable: (-q X or -q 5.0) Lowest quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The upper frequency limit used in the calculation of minimum signal power varies, dependent on quality preset, in the range 15.159kHz to 16.682kHz<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.3.0, Copyright (C) 2007-2011 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Process Description:<br />
<br />
lossyWAV is a near lossless audio processor which dynamically reduces the <br />
bitdepth of the signal on a block-by-block basis. Bitdepth reduction adds noise<br />
to the processed output. The amount of permissible added noise is based on<br />
analysis of the signal levels in the default frequency range 20Hz to 16kHz.<br />
<br />
If signals above the upper limiting frequency are at an even lower level, they<br />
can be swamped by the added noise. This is usually inaudible, but the behaviour<br />
can be changed by specifying a different --limit (in the range 10kHz to 20kHz).<br />
<br />
For many audio signals there is little content at very high frequencies and<br />
forcing lossyWAV to keep the added noise level lower than the content at these<br />
frequencies can increase the bitrate dramatically for no perceptible benefit.<br />
<br />
The noise added by the process is shaped using an adaptive method provided by<br />
Sebastian Gesemann. This method, as implemented in lossyWAV, aims to use the<br />
signal itself as the basis of the filter used for noise shaping. Adaptive noise<br />
shaping is enabled by default.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <t> where t is one of the following (default = standard):<br />
I, insane highest quality output, suitable for transcoding;<br />
E, extreme higher quality output, suitable for transcoding;<br />
H, high high quality output, suitable for transcoding;<br />
S, standard default quality output, considered to be transparent;<br />
C, economic intermediate quality output, likely to be transparent;<br />
P, portable good quality output for DAP use, may not be transparent;<br />
X, extraportable lowest quality output, not fully transparent.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Advanced Options:<br />
<br />
- take WAV input from STDIN.<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-q, --quality <n> quality preset (-5.0<=n<=10.0); (-5=lowest, 10=highest;<br />
default=2.5; I=10; E=7.5; H=5; S=2.5; C=0; P=-2.5; X=-5).<br />
--, --stdout write WAV output to STDOUT.<br />
--stdinname <t> pseudo filename to use when input from STDIN.<br />
<br />
Advanced Quality Options:<br />
<br />
-A, --adaptive <n/t> modify settings for Sebastian Gesemann's adaptive noise<br />
shaping method. takes a parameter to set the order of the<br />
FIR filter, (32<=n<=96; default=64; multiple of 8 only);<br />
"OFF" to disable adaptive shaping; "NOWARP" to disable <br />
default frequency warping;<br />
-a, --analyses <n> set number of FFT analysis lengths, (2<=n<=6; default=3,<br />
i.e. 32, 64 & 1024 samples. n=2, remove 32 sample FFT;<br />
n>3 add 512; n>4, add 256; n>6, add 128) nb. FFT lengths.<br />
stated are for 44.1/48kHz audio, higher sample rates will<br />
automatically increase all FFT lengths as required.<br />
-l, --limit <n> set upper frequency limit to be used in analyses to n Hz;<br />
(10000<=n<=20000; default=16000).<br />
--linkchannels revert to original single bits-to-remove value for all<br />
channels rather than channel dependent bits-to-remove.<br />
--maxclips <n> set max. number of acceptable clips per channel per block;<br />
(0<=n<=16; default=3,3,3,3,3,2,2,2,2,2,1,1,1,0,0,0).<br />
-m, --midside analyse 2 channel audio for mid/side content.<br />
--nodccorrect disable DC correction of audio data prior to FFT analysis,<br />
default=on; (DC offset calculated per FFT data set).<br />
--scale <n> factor to scale audio by; (0.0625<n<=8.0; default=1).<br />
-s, --shaping [n] enable fixed noise shaping, takes optional parameter [n]<br />
to allow user defined shaping proportion (0.0<=n<=1.0),<br />
otherwise default to quality setting dependent value.<br />
Disables adaptive noise shaping.<br />
--static <n> set minimum-bits-to-keep-static to n bits (default=6;<br />
7<=n<=28, limited to bits-per-sample - 4).<br />
-U, --underlap <n> enable underlap mode to increase number of FFT analyses<br />
performed at each FFT length, (n = 2, 4 or 8, default=2).<br />
<br />
Output Options:<br />
<br />
--bitdist show distrubution of bits to remove.<br />
--blockdist show distribution of lowest / highest significant bit of<br />
input codec-blocks and bit-removed codec-blocks.<br />
-d, --detail enable per block per channel bits-to-remove data display.<br />
-F, --freqdist enable frequency analysis display of input data.<br />
-H, --histogram show sample value histogram (input, lossy and correction).<br />
--longdist show long frequency distribution data (input/lossy/lwcdf).<br />
--perchannel show selected distribution data per channel.<br />
-p, --postanalyse enable frequency analysis display of output and<br />
correction data in addition to input data.<br />
--sampledist show distribution of lowest / highest significant bit of<br />
input samples and bit-removed samples.<br />
--spread [full] show detailed [more detailed] results from the spreading/<br />
averaging algorithm.<br />
-W, --width <n> select width of output options (79<=n<=255).<br />
<br />
System Options:<br />
<br />
-B, --below set process priority to below normal.<br />
--low set process priority to low.<br />
-N, --nowarnings suppress lossyWAV warnings.<br />
-Q, --quiet significantly reduce screen output.<br />
-S, --silent no screen output.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the adaptive noise shaping method and the amount of<br />
help received in implementing it and also for the basis of<br />
the fixed noise shaping method.<br />
<br />
Matteo Frigo and for libfftw3-3.dll contained in the FFTW distribution<br />
Steven G Johnson (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV and WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===lossyWAV and [[foobar2000]]===<br />
Example [[foobar2000]] converter settings:<br />
<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --quality standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===lossyWAV and EAC===<br />
:''For example settings, see [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=90104 lossyWAV 1.3.0 release thread] - Release of version 1.3.0 on 06 August 2011<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2011-05-18T06:53:00Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV and WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===lossyWAV and [[foobar2000]]===<br />
Example [[foobar2000]] converter settings:<br />
<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===lossyWAV and EAC===<br />
:''For example settings, see [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2011-04-12T21:11:36Z<p>Nick.C: Added 1.3.0 development thread link.</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV with WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=81002 lossyWAV 1.3.0 development thread]<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2010-08-21T12:39:41Z<p>Nick.C: Put inverted commas around filename in case it contains spaces.</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist "%1" flac -d "%1" --stdout --silent|lossywav - --stdout --standard --stdinname "%1"|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile "%1" "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV with WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2010-08-21T11:46:09Z<p>Nick.C: .... and WV and TaK. Both already had -i and -ihs specified already to ignore data chunk size in WAV header output from lossyWAV.</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV with WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2010-08-21T11:40:19Z<p>Nick.C: Revert to piped input for lossyWAV / FLAC - use --ignore-chunk-sizes parameter in FLAC to avoid max length indicated output.</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| logo =<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV with WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d --ignore-chunk-sizes<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav %s --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav %s --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
Enclose the element of the path containing spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name. This is a Windows limitation.<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008<br />
<br />
[[Category:Software]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2010-01-18T20:25:31Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV and FFTW===<br />
Since version 1.2.0, lossyWAV has been compatible with [[Wikipedia:FFTW|FFTW]] although not dependent on it. Should the user wish to take advantage of the increased processing speed available when using FFTW (from superior FFT implementations), libfftw3-3.dll should be placed in a directory on the host computer which features on the path.<br />
<br />
===lossyWAV with WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. E.g. a lossless file you receive could be transcoded from [[MP3]] without your knowledge. To distinguish a lossyWAV file from lossless files it is recommended to use the extension .lossy.EXT where EXT is the original extension e.g. .lossy.flac<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2009-12-21T08:30:53Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.2.0<br />
| preview_release = <none><br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!--zero<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 627 kbit/s<br />
| 544 kbit/s<br />
| 460 kbit/s<br />
| 376 kbit/s<br />
| 288 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
| ??? kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The --check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]].[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
The --altpreset parameter was introduced at 1.2.0 which creates a second quality range using modified internal presets and extends the quality range from -4 to 10 (--quality -4 --altpreset is equivalent to --quality 0 --limit 15159 in the default quality quality range).<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.2.0, Copyright (C) 2007,2008,2009 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use, not fully transparent.<br />
-Z, --zero lowest quality preset, probably contains artifacts.<br />
<br />
Standard Options:<br />
<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
-w, --writetolog create (or add to) lossyWAV.log in the output directory.<br />
<br />
Special thanks go to:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement his method as lossyWAV.<br />
<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
<br />
Matteo Frigo and for the excellent libfftw3-3.dll contained in the FFTW<br />
Steven G Johnson distribution (v3.2.1 or v3.2.2).<br />
<br />
Mark G Beckett for the Delphi unit that provides an interface to the<br />
(Univ. of Edinburgh) relevant fftw routines in libfftw3-3.dll.<br />
<br />
Don Cross for the Complex-FFT algorithm originally used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===lossyWAV with WINE===<br />
The cause of lossyWAV's WINE incompatibility was found and removed during the development of 1.2.0 and retrospectively amended for 1.1.0b in a maintenance release (1.1.0c).<br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to [[MP3]] and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=77042 lossyWAV 1.2.0 release thread] - Release of version 1.2.0 on 16 December 2009<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2009-10-18T19:25:16Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0c<br />
| preview_release = 1.1.4n<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0c, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to [[MP3]] and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 Development Thread] - Latest release candidate and beta version in the first post<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2009-05-07T19:17:01Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.1.4a<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a [[Wikipedia:Free software|free]], [[lossy]] pre-processor for [[PCM]] audio contained in the [[RIFF_WAVE|WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression.<br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits ([[Wikipedia:Least_significant_bit|lsb]]'s) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al. is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
<br />
===Example drag 'n' drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example [[foobar2000]] converter settings===<br />
lossyFLAC settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: C:\Windows\System32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c C:\"Program Files"\bin\lossywav - --standard --silent --stdout|<br />
C:\"Program Files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWMALSL settings:<pre>Encoder: C:\Program Files\Windows Media Components\Encoder\WMCmd.vbs<br />
Extension : lossy.wma<br />
Parameters: -input %s -output %d -a_codec WMA9LSL -a_mode 0 -a_setting Q100_44_2_16<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. C:\"Program Files"\directory_where_executable_is\executable_name<br />
<br />
===Example EAC settings===<br />
:''See [[EAC and LossyWAV]].''<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to [[MP3]] and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact]]s<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 Development Thread] - Latest release candidate and beta version in the first post<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008<br />
----<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original MATLAB script to Delphi and evolution of the method<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-12-28T21:06:37Z<p>Nick.C: /* Example Foobar2000 converter settings */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.1.1e<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64666&view=findpost&p=577042 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWMALSL settings:<pre>Encoder: c:\program files\windows media components\encoder\WMCmd.vbs<br />
Extension : lossy.wma<br />
Parameters: -input %s -output %d -a_codec WMA9LSL -a_mode 0 -a_setting Q100_44_2_16<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
<br />
===Example EAC settings===<br />
Please see [[EAC and LossyWAV]].<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 Development Thread] - Latest release candidate and beta version in the first post;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-12-12T11:24:36Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.1.1e<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. Proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson], it reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
<br />
===Example EAC settings===<br />
Please see [[EAC and LossyWAV]].<br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 Development Thread] - Latest release candidate and beta version in the first post;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-08-30T13:26:55Z<p>Nick.C: /* Codec compatibility */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 Development Thread] - Latest release candidate and beta version in the first post;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-08-28T12:18:11Z<p>Nick.C: /* External links */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=65499 lossyWAV 1.2.0 Development Thread] - Latest release candidate and beta version in the first post;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 lossyWAV 1.1.0 development thread]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=64617 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-08-28T12:14:23Z<p>Nick.C: /* External links */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-08-08T12:24:50Z<p>Nick.C: /* Example drag'n'drop batch file */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file, placing the output lossyFLAC file in the same directory as the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
<br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-08-08T12:23:19Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0b<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example drag'n'drop batch file===<br />
Simply drag the FLAC files onto this batch file and it will process, recode in FLAC and copy ALL of the tags from the input FLAC file. Requires flac.exe and [http://www.synthetic-soul.co.uk/tag/ tag.exe] to be somewhere on the path. <br />
<pre>@echo off<br />
:repeat<br />
if %1.==. goto end<br />
if exist %1 flac -d %1 --stdout --silent|lossywav - --stdout --standard --stdinname %1|flac - -b 512 -o "%~dpn1.lossy.flac" --silent && tag --fromfile %1 "%~dpn1.lossy.flac"<br />
shift<br />
goto repeat<br />
:end</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-27T20:58:15Z<p>Nick.C: /* Codec compatibility */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
* Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name.<br />
<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-27T20:53:11Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set (16 bit / 44.1kHz)<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-27T20:52:25Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure variable bit-depth pre-processor in that the overall sample size remains the same after processing but the number of significant bits used for the samples in a codec-block can change on a block-by-block basis. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-19T19:33:50Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!10 Album Test Set<br />
| TAK<br />
| 820 kbit/s<br />
| 615 kbit/s<br />
| 532 kbit/s<br />
| 447 kbit/s<br />
| 359 kbit/s<br />
| 266 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| Wavpack<br />
| 852 kbit/s<br />
| 641 kbit/s<br />
| 563 kbit/s<br />
| 481 kbit/s<br />
| 390 kbit/s<br />
| 296 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-15T07:44:29Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Codec<br />
!lossless<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| FLAC<br />
| 787 kbit/s<br />
| 654 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!55 sample "problem" set<br />
| TAK<br />
| 749 kbit/s<br />
| 634 kbit/s<br />
| 564 kbit/s<br />
| 488 kbit/s<br />
| 405 kbit/s<br />
| 299 kbit/s<br />
|-<br />
!55 sample "problem" set<br />
| Wavpack<br />
| 772 kbit/s<br />
| 661 kbit/s<br />
| 599 kbit/s<br />
| 529 kbit/s<br />
| 444 kbit/s<br />
| 342 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| FLAC<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 12 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-14T21:15:53Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.1.0<br />
| 781 kbit/s<br />
| 654 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| 1.1.0<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 13 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-14T07:30:36Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.1.0<br />
| preview_release = 1.0.1x RC4<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (lsb's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.1.0<br />
| 781 kbit/s<br />
| 654 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 Album Test Set<br />
| 1.1.0<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 463 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset --standard with higher presets being more conservative. Quality preset --standard is generally accepted to be (and from testing so far is) transparent. If you find a track which --standard fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.1.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-I, --insane highest quality output, suitable for transcoding;<br />
-E, --extreme high quality output, also suitable for transcoding;<br />
-S, --standard default quality output, considered to be transparent;<br />
-P, --portable good quality output for DAP use. Not considered to be fully<br />
transparent, but considered fit for its intended purpose.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-o, --outdir <t> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the publication of his lossyFLAC method, guidance, and<br />
the motivation to implement the method as lossyWAV.<br />
Horst Albrecht for ABX testing, valuable support in tuning the internal<br />
presets, constructive criticism and all the feedback.<br />
Sebastian Gesemann for the noise shaping coefficients and help in using them<br />
in the lossyWAV noise shaping implementation.<br />
Don Cross for the Complex-FFT algorithm used.</pre><br />
===Example Foobar2000 converter settings===<br />
lossyFLAC settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.flac<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\flac - -b 512 -5 -f -o%d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24 </pre><br />
<br />
lossyTAK settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.tak<br />
Parameters : /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\takc -e -p2m -fsl512 -ihs - %d<br />
Format is: lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
lossyWV settings:<pre>Encoder: c:\windows\system32\cmd.exe<br />
Extension : lossy.wv<br />
Parameters: /d /c c:\"program files"\bin\lossywav - --standard --silent --stdout|<br />
c:\"program files"\bin\wavpack -hm --blocksize=512 --merge-blocks -i - %d<br />
Format is : lossless or hybrid<br />
Highest BPS mode supported: 24</pre><br />
<br />
There is a known problem within foobar2000 (although more likely to do with cmd.exe itself) when running an executable within the cmd.exe command line from a path which includes spaces. The suggested fix for this is to enclose the element of the path which contains spaces within double quotation marks ("), e.g. c:\"program files"\directory_where_executable_is\executable_name<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] - Introduction of the concept by David Robinson (Replay Gain developer) and initial development;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 lossyWAV Development thread] - Conversion of the original Matlab script to Delphi and evolution of the method;<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63225 lossyWAV 1.0.0 release thread] - Release of version 1.0.0b on 13 May 2008;<br />
<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?act=ST&f=32&t=63254 lossyWAV 1.1.0 development thread] - Latest release candidate and beta version in the first post;<br />
*[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=64617&view=findpost&p=576670 lossyWAV 1.1.0 release thread] - Release of version 1.1.0 on 12 July 2008;<br />
<br />
<br />
*[http://wiki.hydrogenaudio.org/index.php?title=LossyWAV lossyWAV wiki entry at hydrogenaudio.org]<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-07-04T11:51:54Z<p>Nick.C: /* History */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1u RC1<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Albrecht] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1t<br />
| 780 kbit/s<br />
| 656 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 album test set<br />
| 1.0.1t<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 462 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-23T20:16:33Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1u RC1<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Alb] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1t<br />
| 780 kbit/s<br />
| 656 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 album test set<br />
| 1.0.1t<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 462 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-20T12:49:41Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1t<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyWAV is based on the lossyFLAC idea proposed by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 David Robinson] at Hydrogenaudio, which is a method of carefully reducing the bitdepth of samples, therefore utilising the wasted bits feature of the FLAC lossless codec. The aim is to transparently reduce audio bit depth (by making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick Currie] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 Horst Alb] at Hydrogenaudio. Although the current lossyWAV implementation has built on David's original method, the method itself still very much belongs to its author.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1t<br />
| 780 kbit/s<br />
| 656 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 album test set<br />
| 1.0.1t<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 462 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artifacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-14T21:20:04Z<p>Nick.C: /* Frequently asked questions */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1t<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1t<br />
| 780 kbit/s<br />
| 656 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 album test set<br />
| 1.0.1t<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 462 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' At preset --standard, almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-14T21:05:42Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1t<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1t<br />
| 780 kbit/s<br />
| 656 kbit/s<br />
| 583 kbit/s<br />
| 508 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|-<br />
!10 album test set<br />
| 1.0.1t<br />
| 854 kbit/s<br />
| 632 kbit/s<br />
| 548 kbit/s<br />
| 462 kbit/s<br />
| 376 kbit/s<br />
| 285 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Why is the ".wav" file extension used?<br />
*'''Answer:''' The ".wav" file extension is used because lossyWAV is a digital signal processor and not a codec. No decoding is required for any program to play a WAV file which has been processed with lossyWAV as it remains compliant with the RIFF WAVE format.<br />
<br />
*'''Question:''' Why create a processor which means that I cannot be sure that a lossless file is truly lossless?<br />
*'''Answer:''' Unless one creates the lossless file personally, one can '''never''' be completely sure that the file is indeed lossless. e.g. If a WAV file is encoded to mp3 and then transcoded to a lossless codec, how can this pre-processing be easily determined?<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No, you do not - lossyWAV output is totally portable between lossless codecs.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-11T07:33:20Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1t<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1q<br />
| 784 kbit/s<br />
| 656 kbit/s<br />
| 585 kbit/s<br />
| 509 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the --merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length 'fact' chunk into the WAV file immediately after the 'fmt ' chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV 'fact' chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| '''Yes'''<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| '''Yes'''<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| '''Yes'''<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| '''Yes'''<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| '''Yes'''<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| '''Yes'''<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is the lossy.wav output file still a wav compliant file?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No, you do not - lossyWAV output is totally portable between lossless codecs.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-10T08:40:23Z<p>Nick.C: /* Frequently asked questions */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1s<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1q<br />
| 784 kbit/s<br />
| 656 kbit/s<br />
| 585 kbit/s<br />
| 509 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is the lossy.wav file still a wav file?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No, you do not - lossyWAV output is totally portable between lossless codecs.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-09T12:27:15Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1s<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1q<br />
| 784 kbit/s<br />
| 656 kbit/s<br />
| 585 kbit/s<br />
| 509 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Do I need to re-process to change lossless codecs?<br />
*'''Short answer:''' No, you do not - lossyWAV output is totally portable between lossless codecs.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-06-01T21:10:12Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1q<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[Wikipedia:variable bitrate|variable bitrate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[Wikipedia:fast Fourier transform|fast Fourier Transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 32, 64 & 1024 [[Wikipedia:Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds [[Wikipedia:white noise|white noise]] to the output, however the level of the added noise associated with the removal of a number of bits has been pre-calculated and the number of bits to remove will depend on the level of the noise floor of the codec-block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1q<br />
| 784 kbit/s<br />
| 656 kbit/s<br />
| 585 kbit/s<br />
| 509 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
===Important note===<br />
'''NB: when encoding using a lossless codec, please ensure that the block size of the lossless codec matches that of lossyWAV (default = 512 samples). If this is not done then the lossless encoding of the processed WAV file will (almost certainly) be larger than it would otherwise have been. This is achieved by adding the "Encoder Parameters" in the table above to the command line of the lossless codec in question.'''<br />
===Bonus feature===<br />
Another, possibly not obvious, feature of lossyWAV is that the processed output can be "transcoded" from one lossless codec to another lossless codec with absolutely no loss of quality whatsoever. This is solely due to the fact that lossyWAV output is designed to be losslessly encoded - something that lossless codecs do very well indeed.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-30T09:58:41Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1q<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1q<br />
| 784 kbit/s<br />
| 656 kbit/s<br />
| 585 kbit/s<br />
| 509 kbit/s<br />
| 425 kbit/s<br />
| 321 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10) Highest quality preset, generally considered to be excessive;<br />
*--extreme: (-q 7.5) High quality preset, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*--standard: (-q 5) Default preset, generally accepted to be transparent;<br />
*--portable: (-q 2.5) DAP quality preset for use on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316]<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-29T19:31:36Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1o<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!--insane<br />
!--extreme<br />
!--standard<br />
!--portable<br />
!-q 0<br />
|-<br />
!55 sample "problem" set<br />
| 1.0.1o<br />
| 784 kbit/s<br />
| 652 kbit/s<br />
| 580 kbit/s<br />
| 504 kbit/s<br />
| 421 kbit/s<br />
| 321 kbit/s<br />
|}<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
New quality preset synonyms introduced at 1.0.1j/k (and -q <n> quality parameter moved to advanced settings):<br />
*--insane: (-q 10)<br />
*--extreme: (-q 7.5)<br />
*--standard: (-q 5)<br />
*--portable: (-q 2.5)<br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-19T08:18:37Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1d<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784 kbit/s<br />
| 654 kbit/s<br />
| 626 kbit/s<br />
| 596 kbit/s<br />
| 565 kbit/s<br />
| 534 kbit/s<br />
| 501 kbit/s<br />
| 470 kbit/s<br />
| 447 kbit/s<br />
| 408 kbit/s<br />
| 366 kbit/s<br />
| 329 kbit/s<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.1d<br />
| 784 kbit/s<br />
| 637 kbit/s<br />
| 607 kbit/s<br />
| 577 kbit/s<br />
| 545 kbit/s<br />
| 513 kbit/s<br />
| 480 kbit/s<br />
| 449 kbit/s<br />
| 427 kbit/s<br />
| 390 kbit/s<br />
| 349 kbit/s<br />
| 306 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-19T08:17:59Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = 1.0.1d<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0b<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.1d<br />
| 784 kbit/s<br />
| 637 kbit/s<br />
| 607 kbit/s<br />
| 577 kbit/s<br />
| 545 kbit/s<br />
| 513 kbit/s<br />
| 480 kbit/s<br />
| 449 kbit/s<br />
| 427 kbit/s<br />
| 390 kbit/s<br />
| 349 kbit/s<br />
| 306 kbit/s<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63254 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Original development thread up to 1.0.0b release]<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-13T22:23:25Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0b<br />
| preview_release = <br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0b, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0b release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-13T07:24:11Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0<br />
| preview_release = <br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| 1.0.0<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV x.y.z @ dd/mm/yyyy hh:mm:ss, -q 5</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections, considered to be suitable for transcoding to other lossy codecs;<br />
*-q 7 to -q 6: High quality presets, disc space-saving alternative to lossless archiving for large audio collections;<br />
*-q 5: Default preset, generally accepted to be transparent;<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; 1 to 8 channels; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-12T21:13:52Z<p>Nick.C: /* Example flossy3.bat file called from Foobar2000 */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0<br />
| preview_release = <br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| beta 1.0.0<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
From beta v0.5.9, lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV beta vx.y.z @ dd/mm/yyyy hh:mm:ss, -q 5 -analyses 2 -clips 1</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections.<br />
*-q 5: Default preset, generally accepted to be transparent.<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-12T21:13:14Z<p>Nick.C: /* Example flossy3.bat file called from Foobar2000 */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0<br />
| preview_release = <br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| beta 1.0.0<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
From beta v0.5.9, lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV beta vx.y.z @ dd/mm/yyyy hh:mm:ss, -q 5 -analyses 2 -clips 1</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections.<br />
*-q 5: Default preset, generally accepted to be transparent.<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy3.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 --below --nowarnings --quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=File:LossyWAV_fb2k_CLI_Settings.PNGFile:LossyWAV fb2k CLI Settings.PNG2008-05-12T21:05:48Z<p>Nick.C: lossyWAV 1.0.0 CLI converter settings in foobar2000</p>
<hr />
<div>lossyWAV 1.0.0 CLI converter settings in foobar2000</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-12T20:55:15Z<p>Nick.C: /* Example Foobar2000 converter settings */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0<br />
| preview_release = <br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| beta 1.0.0<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
From beta v0.5.9, lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV beta vx.y.z @ dd/mm/yyyy hh:mm:ss, -q 5 -analyses 2 -clips 1</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections.<br />
*-q 5: Default preset, generally accepted to be transparent.<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:lossyWAV_fb2k_CLI_Settings.PNG]]<br />
<br />
===Example flossy3.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 -below -nowarnings -quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=File:LossyWAV_FB2K_CLI_Settings.PNGFile:LossyWAV FB2K CLI Settings.PNG2008-05-12T20:52:43Z<p>Nick.C: foobar2000 converter settings for lossyWAV 1.0.0 -q 3</p>
<hr />
<div>foobar2000 converter settings for lossyWAV 1.0.0 -q 3</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-12T20:48:52Z<p>Nick.C: </p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = 1.0.0<br />
| preview_release = <br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU General Public License|GNU GPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| beta 1.0.0<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
The --correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
From beta v0.5.9, lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV beta vx.y.z @ dd/mm/yyyy hh:mm:ss, -q 5 -analyses 2 -clips 1</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections.<br />
*-q 5: Default preset, generally accepted to be transparent.<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV 1.0.0, Copyright (C) 2007,2008 Nick Currie. Copyleft.<br />
This program is free software: you can redistribute it and/or modify it under<br />
the terms of the GNU General Public License as published by the Free Software<br />
Foundation, either version 3 of the License, or (at your option) any later<br />
version.<br />
<br />
This program is distributed in the hope that it will be useful,but WITHOUT ANY<br />
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A<br />
PARTICULAR PURPOSE. See the GNU General Public License for more details.<br />
<br />
You should have received a copy of the GNU General Public License along with<br />
this program. If not, see <http://www.gnu.org/licenses/>.<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q, --quality <n> quality preset (10=highest quality, 0=lowest bitrate;<br />
-q 5 is generally accepted to be transparent)<br />
default=-q 5.<br />
<br />
Standard Options:<br />
<br />
-c, --check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-C, --correction write correction file for processed WAV file; default=off.<br />
-f, --force forcibly over-write output file if it exists; default=off.<br />
-h, --help display help.<br />
-L, --longhelp display extended help.<br />
-M, --merge merge existing lossy.wav and lwcdf.wav files.<br />
-N, --noclips set allowable number of clips / channel / codec block to 0;<br />
default=3,3,3,3,2,1,0,0,0,0,0 (-q 0 to -q 10)<br />
-o, --outdir <dir> destination directory for the output file(s).<br />
-v, --version display the lossyWAV version number.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the Complex-FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:Foobar2000_Converter_Settings.PNG]]<br />
<br />
===Example flossy3.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 -below -nowarnings -quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=63225 lossyWAV 1.0.0 release thread]<br />
<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-09T12:10:33Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = v0.9.2 RC3<br />
| preview_release = beta v0.9.8d<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU Lesser General Public License|GNU LGPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!FLAC -8<br />
!Version<br />
!lossyWAV -1<br />
!lossyWAV -2<br />
!lossyWAV -3<br />
!lossyWAV -4<br />
!lossyWAV -5<br />
!lossyWAV -6<br />
!lossyWAV -7<br />
|-<br />
!10 Album Test Average<br />
| 850kbps<br />
| v0.9.2 RC3<br />
| 479kbps<br />
| 425kbps<br />
| 375kbps<br />
| 352kbps<br />
| 334kbps<br />
| 318kbps<br />
| 306kbps<br />
|-<br />
!53 sample "problem" set <br />
| 784kbps <br />
| v0.9.2 RC3<br />
| 543kbps <br />
| 494kbps <br />
| 433kbps<br />
| 408kbps<br />
| 385kbps<br />
| 365kbps<br />
| 348kbps<br />
|}<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| beta v0.9.8d<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
From beta v0.6.1, the -correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
From beta v0.5.9, lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV beta vx.y.z @ dd/mm/yyyy hh:mm:ss, -q 5 -analyses 2 -clips 1</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections.<br />
*-q 5: Default preset, generally accepted to be transparent.<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV v0.9.2 RC3, Copyright (C) 2007,2008 Nick Currie.<br />
lossyWAV is issued with NO WARRANTY WHATSOEVER and is free software.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-1/1a/1b quality preset 1, circa 480kbps for 44.1khz, 2ch;<br />
-2/2a/2b/2c quality preset 2, circa 425kbps for 44.1khz, 2ch [default];<br />
-3/3a/3b/3c quality preset 3, circa 375kbps for 44.1khz, 2ch;<br />
-4/4a/4b/4c quality preset 4, circa 350kbps for 44.1khz, 2ch;<br />
-5/5a/5b/5c quality preset 5, circa 335kbps for 44.1khz, 2ch;<br />
-6/6a/6b/6c quality preset 6, circa 320kbps for 44.1khz, 2ch;<br />
-7/7a/7b/7c quality preset 7, circa 305kbps for 44.1khz, 2ch;<br />
[a/b/c = 1/2/3 extra FFT analyses; default=3,2,2,2,2,2,2(max=5)]<br />
<br />
Standard Options:<br />
<br />
-o <folder> destination folder for the output file(s).<br />
-nts <n> set noise_threshold_shift to n dB (-48.0dB<=n<=+36.0dB);<br />
(-ve values reduce bits to remove, +ve values increase).<br />
-snr <n> set minimum average signal to added noise ratio to n dB;<br />
(0.0dB<=n<=48.0dB) Increasing value reduces bits to remove.<br />
-force forcibly over-write output file if it exists; default=off.<br />
-check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-noclips set allowable number of clips per channel per codec block to 0;<br />
default= -1=0,-2=1,-3=2,-4=3,-5=4,-6=5,-7=6.<br />
-correction write correction file while processing WAV file; default=off.<br />
-merge merge existing lossy.wav and lwcdf.wav files.<br />
-scale <n> scaling factor from WaveGain / etc; default = 1.000000.<br />
<br />
System Options:<br />
<br />
-quiet significantly reduce screen output.<br />
-nowarn suppress lossyWAV warnings.<br />
-detail enable detailed output mode<br />
<br />
-below set process priority to below normal.<br />
-low set process priority to low.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the original Pascal source for the FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Current beta version settings===<br />
<pre><br />
lossyWAV beta v0.9.8d, Copyright (C) 2007,2008 Nick Currie.<br />
lossyWAV is issued with NO WARRANTY WHATSOEVER and is free software.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q <n> quality preset (10 = highest quality, 0 = lowest bitrate;<br />
-q 5 is generally accepted to be transparent) default = -q 5.<br />
<br />
Standard Options:<br />
<br />
-check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-correction write correction file while processing WAV file; default=off.<br />
-force forcibly over-write output file if it exists; default=off.<br />
-help display help.<br />
-longhelp display extended help.<br />
-merge merge existing lossy.wav and lwcdf.wav files.<br />
-o <folder> destination folder for the output file(s).<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the original Pascal source for the FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:Foobar2000_Converter_Settings.PNG]]<br />
<br />
===Example flossy3.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 -below -nowarn -quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.Chttps://wiki.hydrogenaud.io/index.php?title=LossyWAVLossyWAV2008-05-09T12:10:02Z<p>Nick.C: /* Indicative bitrate reduction */</p>
<hr />
<div>{{Software Infobox<br />
| name = lossyWAV<br />
| screenshot = <br />
| caption = <br />
| maintainer = [http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C]<br />
| stable_release = v0.9.2 RC3<br />
| preview_release = beta v0.9.8d<br />
| operating_system = [[Wikipedia:Microsoft Windows|Windows]]<br />
| use = [[Wikipedia:Digital signal processing|Digital signal processing]]<br />
| license = [[Wikipedia:GNU Lesser General Public License|GNU LGPL]]<br />
| website = [http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Hydrogenaudio]<br />
}}<br />
lossyWAV is a new free lossy pre-processor for [[PCM]] audio contained in the [[WAV]] file format. It reduces [[Wikipedia:Audio bit depth|bit depth]] of the input signal, which, when used in conjunction with certain lossless codecs, reduces the bitrate of the encoded file significantly compared to unpreprocessed compression. <br />
lossyWAV's primary goal is to maintain [[transparency]] with a high degree of confidence when processing any audio data.<br />
<br />
==History==<br />
lossyFLAC is an idea started by [http://www.hydrogenaudio.org/forums/index.php?showuser=409 2Bdecided] at Hydrogenaudio, utilising the wasted bits feature of the FLAC lossless codec with the aim of transparently reducing audio bit depth (making some lower significant bits (LSB's) zero), consequently taking advantage of FLAC's detection of consistently-zeroed lower significant bits within each single frame and significantly increasing coding efficiency.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498179] In this way the user can enjoy audio encoded using the same codec (which may be all important from a hardware compatibility perspective) at a reduced bitrate compared to the lossless version.<br />
<br />
[http://www.hydrogenaudio.org/forums/index.php?showuser=42400 Nick.C] ported the original [[Wikipedia:MATLAB|MATLAB]] implementation to [[Wikipedia:Borland Delphi|Delphi]] (Many thanks [[Wikipedia:CodeGear|CodeGear]] for Turbo Explorer!!) with a liberal sprinkling of [[Wikipedia:IA-32|IA-32]] and [[Wikipedia:x87|x87]] Assembly Language for speed.<br />
<br />
Subsequently, lossyFLAC proved itself to work with other lossless codecs, so the application name was changed to lossyWAV. <br />
<br />
Since then, Nick.C has heavily developed and built upon lossyWAV, with valuable tuning performed by [http://www.hydrogenaudio.org/forums/index.php?showuser=25015 halb27] at Hydrogenaudio.<br />
<br />
==Indicative bitrate reduction==<br />
It must be stressed that lossyWAV is a pure [[variable bit rate]] pre-processor. Bits-to-remove from the audio data are calculated on a block-by-block basis (codec-block length = 512 samples, 11.6msec @ 44.1kHz) using overlapping [[fast Fourier transform]] (FFT) analyses of at least two lengths (default quality preset (-q 5) = 64 & 1024 [[Sampling %28signal processing%29|samples]]). After some manipulation, the results of each FFT analysis for a specific codec-block are then grouped and the minimum value used to determine bits-to-remove for the whole codec-block. Bit removal adds noise to the output, however the added noise has been pre-calculated and its level will be at or below the noise floor of the codec_block in question. Each sample in the codec-block is then rounded such that the first <bits-to-remove> lsb's are zero. In this way the wasted bits feature of [[FLAC]] et al is exploited.<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!FLAC -8<br />
!Version<br />
!lossyWAV -1<br />
!lossyWAV -2<br />
!lossyWAV -3<br />
!lossyWAV -4<br />
!lossyWAV -5<br />
!lossyWAV -6<br />
!lossyWAV -7<br />
|-<br />
!10 Album Test Average<br />
| 850kbps<br />
| v0.9.2 RC3<br />
| 479kbps<br />
| 425kbps<br />
| 375kbps<br />
| 352kbps<br />
| 334kbps<br />
| 318kbps<br />
| 306kbps<br />
|-<br />
!53 sample "problem" set <br />
| 784kbps <br />
| v0.9.2 RC3<br />
| 543kbps <br />
| 494kbps <br />
| 433kbps<br />
| 408kbps<br />
| 385kbps<br />
| 365kbps<br />
| 348kbps<br />
|}<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!lossyWAV Test Set<br />
!Version<br />
!FLAC -8<br />
!-q 10<br />
!-q 9<br />
!-q 8<br />
!-q 7<br />
!-q 6<br />
!-q 5<br />
!-q 4<br />
!-q 3<br />
!-q 2<br />
!-q 1<br />
!-q 0<br />
|-<br />
!53 sample "problem" set<br />
| beta v0.9.8e<br />
| 784kbps<br />
| 654kbps<br />
| 626kbps<br />
| 596kbps<br />
| 565kbps<br />
| 534kbps<br />
| 501kbps<br />
| 470kbps<br />
| 447kbps<br />
| 408kbps<br />
| 366kbps<br />
| 329kbps<br />
|}<br />
<br />
==File identification==<br />
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.[http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=55522&view=findpost&p=498559]<br />
<br />
From beta v0.6.1, the -correction parameter is used when processing to create a correction file which is named with the .lwcdf.wav double filename extension. When "added" to the corresponding .lossy.wav, using the -merge parameter, the original file will be reconstituted.<br />
<br />
Combinations of lossyWAV with each specific encoder are referred to as lossy'''X''', where '''X''' is an abbreviation of the lossless codec name. Combination names are listed in the "[[LossyWAV#Known supported codecs|known supported codecs]]" section below.<br />
<br />
From beta v0.5.9, lossyWAV inserts a variable-length FACT chunk into the WAV file immediately after the FMT chunk. This takes the form:<pre>fact/<size>/lossyWAV beta vx.y.z @ dd/mm/yyyy hh:mm:ss, -q 5 -analyses 2 -clips 1</pre>Where the version, date & time and user settings are copied. Additionally, if a lossyWAV FACT chunk is found in a file, the processing will be halted (exit code = 16) to prevent re-processing of an already processed file.<br />
<br />
The -check parameter can be used to determine whether a file has previously been processed without trying to process it, exit code = 16 if already processed; exit code = 0 if not.<br />
<br />
==Quality presets==<br />
*-q 10 to -q 8: Highest quality presets, disc space-saving alternative to lossless archiving for large audio collections.<br />
*-q 5: Default preset, generally accepted to be transparent.<br />
*-q 4 to -q 0: DAP quality presets of reducing bitrate with reducing quality preset number, for usage on a compatible [[Wikipedia:Digital audio player|DAP]]. [http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=56129&view=findpost&p=531316] <br />
<br />
All tuning has been performed on quality preset -q 5 with higher presets being more conservative. Quality preset -q 5 is generally accepted to be (and from testing so far is) transparent. If you find a track which -q 5 fails to achieve transparency after processing, please post a sample (no more than 30 seconds) in the development thread.<br />
<br />
==Supported input formats==<br />
*[[WAV]]: 9-bit to 32-bit integer; sample rate &ge; 32kHz [[Pulse Code Modulation|PCM]]. Very high sample rates (&gt;48kHz) have not been extensively tested. Tunings have been focussed on 16-bit, 44.1kHz samples (i.e. [[Wikipedia:Red Book (audio CD standard)|CD]] PCM).<br />
<br />
==Codec compatibility==<br />
{| class="wikitable" style="text-align:center"<br />
|-<br />
!Codec<br />
!Supported<br />
!Encoder parameters<br />
!Combination name<br />
|-<br />
! [[Apple Lossless]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Free Lossless Audio Codec|FLAC]]<br />
| Yes<br />
| -'''5''' -'''b''' 512 --'''keep-foreign-metadata'''<br />
| lossy'''FLAC'''<br />
|-<br />
! [[Lossless Audio|LA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Lossless Predictive Audio Compression|LPAC]]<br />
| Yes<br />
| -'''b'''512<br />
| lossy'''LPAC'''<br />
|-<br />
! [[Monkey's Audio]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[Wikipedia:Audio Lossless Coding|MPEG-4 ALS]]<br />
| Yes<br />
| -'''l''' -'''n'''512<br />
| lossy'''ALS'''<br />
|-<br />
! [[OptimFROG]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[TAK]]<br />
| Yes<br />
| -'''fsl'''512<br />
| lossy'''TAK'''<br />
|-<br />
! [[Wikipedia:TTA (codec)|TTA]]<br />
| No<br />
| &mdash;<br />
| &mdash;<br />
|-<br />
! [[WavPack]]<br />
| Yes<br />
| --'''blocksize'''=512<br />
| lossy'''WV'''<br />
|-<br />
! [[Windows Media Audio#Windows Media Audio Lossless|WMA Lossless]]<br />
| Yes<br />
| &mdash;<br />
| lossy'''WMALSL'''<br />
|}<br />
<br />
There is also [http://www.hometheaterhifi.com/volume_8_4/dvd-benchmark-part-6-dvd-audio-11-2001.html#Meridian%20Lossless%20Packing%20(MLP)%20in%20a%20Nutshell evidence] &mdash; so-called "Bit Shifting" &mdash; to suggest that lossyWAV may work with [[Wikipedia:Meridian Lossless Packing|MLP]], but this remains untested due to prohibitive prices of encoders.<br />
<br />
A comparison of portable media players is [[Wikipedia:Comparison of portable media players#Audio Formats|here]], which shows FLAC and WMA Lossless compatibility among listed players.<br />
Any player supported by [http://www.rockbox.org Rockbox] can use FLAC or WavPack files after installing Rockbox.<br />
<br />
==Using lossyWAV==<br />
===Application settings===<br />
<pre><br />
lossyWAV v0.9.2 RC3, Copyright (C) 2007,2008 Nick Currie.<br />
lossyWAV is issued with NO WARRANTY WHATSOEVER and is free software.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-1/1a/1b quality preset 1, circa 480kbps for 44.1khz, 2ch;<br />
-2/2a/2b/2c quality preset 2, circa 425kbps for 44.1khz, 2ch [default];<br />
-3/3a/3b/3c quality preset 3, circa 375kbps for 44.1khz, 2ch;<br />
-4/4a/4b/4c quality preset 4, circa 350kbps for 44.1khz, 2ch;<br />
-5/5a/5b/5c quality preset 5, circa 335kbps for 44.1khz, 2ch;<br />
-6/6a/6b/6c quality preset 6, circa 320kbps for 44.1khz, 2ch;<br />
-7/7a/7b/7c quality preset 7, circa 305kbps for 44.1khz, 2ch;<br />
[a/b/c = 1/2/3 extra FFT analyses; default=3,2,2,2,2,2,2(max=5)]<br />
<br />
Standard Options:<br />
<br />
-o <folder> destination folder for the output file(s).<br />
-nts <n> set noise_threshold_shift to n dB (-48.0dB<=n<=+36.0dB);<br />
(-ve values reduce bits to remove, +ve values increase).<br />
-snr <n> set minimum average signal to added noise ratio to n dB;<br />
(0.0dB<=n<=48.0dB) Increasing value reduces bits to remove.<br />
-force forcibly over-write output file if it exists; default=off.<br />
-check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-noclips set allowable number of clips per channel per codec block to 0;<br />
default= -1=0,-2=1,-3=2,-4=3,-5=4,-6=5,-7=6.<br />
-correction write correction file while processing WAV file; default=off.<br />
-merge merge existing lossy.wav and lwcdf.wav files.<br />
-scale <n> scaling factor from WaveGain / etc; default = 1.000000.<br />
<br />
System Options:<br />
<br />
-quiet significantly reduce screen output.<br />
-nowarn suppress lossyWAV warnings.<br />
-detail enable detailed output mode<br />
<br />
-below set process priority to below normal.<br />
-low set process priority to low.<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the original Pascal source for the FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Current beta version settings===<br />
<pre><br />
lossyWAV beta v0.9.8d, Copyright (C) 2007,2008 Nick Currie.<br />
lossyWAV is issued with NO WARRANTY WHATSOEVER and is free software.<br />
<br />
Usage : lossyWAV <input wav file> <options><br />
<br />
Example : lossyWAV musicfile.wav<br />
<br />
Quality Options:<br />
<br />
-q <n> quality preset (10 = highest quality, 0 = lowest bitrate;<br />
-q 5 is generally accepted to be transparent) default = -q 5.<br />
<br />
Standard Options:<br />
<br />
-check check if WAV file has already been processed; default=off.<br />
errorlevel=16 if already processed, 0 if not.<br />
-correction write correction file while processing WAV file; default=off.<br />
-force forcibly over-write output file if it exists; default=off.<br />
-help display help.<br />
-longhelp display extended help.<br />
-merge merge existing lossy.wav and lwcdf.wav files.<br />
-o <folder> destination folder for the output file(s).<br />
<br />
Special thanks:<br />
<br />
David Robinson for the method itself and motivation to implement it.<br />
Don Cross for the original Pascal source for the FFT algorithm used.<br />
Horst Albrecht for valuable tuning input and feedback.</pre><br />
===Example Foobar2000 converter settings===<br />
[[Image:Foobar2000_Converter_Settings.PNG]]<br />
<br />
===Example flossy3.bat file called from Foobar2000===<br />
<pre><br />
@echo off<br />
z:\bin\lossyWAV %1 %3 %4 %5 %6 %7 %8 %9 -below -nowarn -quiet<br />
z:\bin\flac.exe -5 -f -b 512 "%~N1.lossy.wav" -o"%~N2.flac" <br />
del "%~N1.lossy.wav"<br />
</pre><br />
<br />
==Frequently asked questions==<br />
*'''Question:''' Is it [[Variable Bitrate|VBR]]?<br />
*'''Short answer:''' Yes.<br />
<br />
*'''Question:''' Is it [[transparency|transparent]]?<br />
*'''Short answer:''' Almost certainly.<br />
<br />
*'''Question:''' Is it [[lossless]]?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Will it ever have a [[Constant Bitrate|CBR]] mode?<br />
*'''Short answer:''' No.<br />
<br />
*'''Question:''' Why should I use this?<br />
*'''Answer:'''<br />
:*high quality<br />
:*extremely low chance of audible [[artifact|artefacts]]<br />
:*reasonable [[bitrate]]s<br />
:*usable with unmodified, established lossless formats.<br />
<br />
==External links==<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=56129 Current development thread] You will find the latest release candidate and latest beta version in post #1 of this thread.<br />
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=55522&st=0 Original lossyFLAC thread] Where David Robinson (Replay Gain developer) introduces the method and a MATLAB implementation.<br />
<br />
[[Category:Software]]<br />
[[Category:Encoder/Decoder]]<br />
[[Category:Lossy]]</div>Nick.C