Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: lossyWAV 1.2.0 released (Read 104878 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

lossyWAV 1.2.0 released

Reply #25
thanks for your help and program  now it works great (with your modified batch script)
I was using CueTools lossyFLAC feature for correction files, but now it's much easier for me

Maybe all this parameters thing can be simplified?

lossyWAV 1.2.0 released

Reply #26
now it works great (with your modified batch script)


+1. Thank you

lossyFLAC.bat:
Code: [Select]
C:\"Program Files"\foobar2000\encoders\lossyWAV.exe %1 %3 %4 %5 %6 %7 %8 %9 --below --silent
ren "%~N1.lwcdf.wav" "%~N2.lwcdf.wav"
C:\"Program Files"\foobar2000\encoders\flac.exe -b 512 -l 6 -e -m -r 2 -f --totally-silent "%~N1.lossy.wav" -o"%~N2.flac"
del "%~N1.lossy.wav"
C:\"Program Files"\foobar2000\encoders\flac.exe -b 512 -l 6 -e -m -r 2 -f --totally-silent "%~N2.lwcdf.wav" -o"%~N2.lwcdf.flac"
del "%~N2.lwcdf.wav"


foobar2000:

Encoder: C:\windows\system32\cmd.exe
Extension: lossy.flac
Parameters: C:\"Program Files"\foobar2000\encoders\lossyFLAC.bat %s %d --standard --correction
🇺🇦 Glory to Ukraine!

lossyWAV 1.2.0 released

Reply #27
@Steve Forte Rio
Thanks for the configuration and the batch file.
I'm trying to figure out how the batch file has to look, if I'll want to join the created files? (correction file+ loosy.flac file)

Any help would be appreciated.


lossyWAV 1.2.0 released

Reply #29
seems I posted wrong code
looking to it now, I'll post corrected later

lossyWAV 1.2.0 released

Reply #30
OK, nevermind the script, I'll post later as batch or if I can't as vbs, but the point was that merging input and correction files doesn't produce bit identical audio file
Why is that?

lossyWAV 1.2.0 released

Reply #31
if someone can delete above two post please do

Here is the script:

lossyFLACcorr.bat
Code: [Select]
if not exist "%~n2.lwcdf.flac" goto bye
c:\"Program Files"\encoders\flac.exe -d -s "%~n2.lwcdf.flac"
c:\"Program Files"\encoders\lossywav.exe "%1" & "%~n2.lwcdf.wav" -M -Q --below --silent && del "%~n2.lwcdf.wav"
c:\"Program Files"\encoders\flac.exe -s "%~n1.lossy.wav" -o "%~n2.fla" && del "%~n1.lossy.wav"
:bye
[font= \"Courier New\"]extension: fla
parameters: /d /c c:\"Program Files"\encoders\lossyFLACcorr.bat %s %d[/font]

problem with piping double extension destination file avoided with using .fla extension for merged file
the script is just illustrative, it's not for usage - why lossyWAV.exe passes merged file to command line (so launches associated program) I don't know, as I don't know how to interpred below results, but I hope it's just mis-usage from my side:

Code: [Select]
Differences found in 11 out of 11 track pairs.

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\01 - Foil.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\01 - Foil.lossy.fla"
Differences found: 22797065 sample(s), starting at 0.5340590 second(s), peak: 0.0116882 at 122.5063492 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\02 - Montreal.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\02 - Montreal.lossy.fla"
Differences found: 35326575 sample(s), starting at 0.2089796 second(s), peak: 0.0116882 at 101.9486621 second(s), 2ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\03 - Silverside.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\03 - Silverside.lossy.fla"
Differences found: 24584537 sample(s), starting at 0.7663039 second(s), peak: 0.0058289 at 101.6905215 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\04 - Slip.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\04 - Slip.lossy.fla"
Differences found: 27736629 sample(s), starting at 0.2089796 second(s), peak: 0.0116882 at 139.8723583 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\05 - Glitch.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\05 - Glitch.lossy.fla"
Differences found: 26116572 sample(s), starting at 0.1973696 second(s), peak: 0.0058289 at 73.9867347 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\06 - Piezo.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\06 - Piezo.lossy.fla"
Differences found: 38026252 sample(s), starting at 0.2438095 second(s), peak: 0.0116882 at 7.8182313 second(s), 2ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\07 - Nine.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\07 - Nine.lossy.fla"
Differences found: 11415531 sample(s), starting at 0.1973696 second(s), peak: 0.0007019 at 198.4041950 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\08 - Further.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\08 - Further.lossy.fla"
Differences found: 43881419 sample(s), starting at 5.8979365 second(s), peak: 0.0058289 at 50.2095692 second(s), 2ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\09 - Yulquen.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\09 - Yulquen.lossy.fla"
Differences found: 22402111 sample(s), starting at 0.2786848 second(s), peak: 0.0003357 at 85.8327211 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\10 - Nil.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\10 - Nil.lossy.fla"
Differences found: 34920537 sample(s), starting at 0.2205896 second(s), peak: 0.0234070 at 359.9393650 second(s), 1ch

Comparing:
"C:\Users\Dejan\Desktop\Autechre\Amber\11 - Teartear.flac"
"C:\Users\Dejan\Desktop\Autechre\Amber\11 - Teartear.lossy.fla"
Differences found: 31764609 sample(s), starting at 0.2322222 second(s), peak: 0.0116882 at 22.4264853 second(s), 1ch

lossyWAV 1.2.0 released

Reply #32
Using the command line:
Code: [Select]
lossywav ..\samples\eig.wav -C
produces two files: eig.lossy.wav and eig.lwcdf.wav in the current directory.

Using the command line:
Code: [Select]
lossywav eig.lossy.wav --merge
produces one file (if eig.lwcdf.wav is present in the same directory as eig.lossy.wav), i.e. eig.wav.

Using the command line:
Code: [Select]
comp ..\samples\eig.wav eig.wav
should result in "Files compare OK".
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

lossyWAV 1.2.0 released

Reply #33
So, what to do with FLAC?

If lossy.flac and lwcdf.flac are converted to corresponding wavs then run:
Code: [Select]
lossyWAV.exe lossy.wav -M
equals:
[font= "Courier New"]FACT Data missing (lossy.wav)[/font]

I even downloaded source files to look for the error:
Code: [Select]
if (btrdchunk.fact.header.size=0) then lossyWAVerror('FACT Data missing (lossy.wav).',$12);

Is there obligation for some wav header?

runing:
Code: [Select]
lossyWAV.exe lossy.wav & lwcdf.wav -M
produces desired file which isn't bit identical with the original file

lossyWAV 1.2.0 released

Reply #34
So, what to do with FLAC?

If you create the lossyFLAC file using piped output to FLAC then the FACT chunk goes missing because FLAC will not store it.

When creating FLAC from WAV, please remember to add "--keep-foreign-metadata" to the FLAC command line to preserve the FACT chunk. eg.:
Code: [Select]
@echo off
flac -d sample.lwcdf.flac --keep-foreign-metadata
flac -d sample.lossy.flac --keep-foreign-metadata
lossywav sample.lossy.wav -M --stdout|flac - -5 -osample.flac
del sample.lossy.wav
del sample.lwcdf.wav
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

lossyWAV 1.2.0 released

Reply #35
well, I used your batch script which includes that switch:

Code: [Select]
c:\programme\flac\lossyWAV.exe %1 %3 %4 %5 %6 %7 %8 %9 --below --silent
if exist "%~N1.lwcdf.wav" c:\programme\flac\flac.exe -b 512 -l 6 -e -m -r 2 -f --totally-silent --keep-foreign-metadata "%~N1.lwcdf.wav" -o"%~N2.lwcdf.flac"&&del %~N1.lwcdf.wav
c:\programme\flac\flac.exe -b 512 -l 6 -e -m -r 2 -f --totally-silent  --keep-foreign-metadata "%~N1.lossy.wav" -o"%~N2.flac"
del "%~N1.lossy.wav"


[edit] OK, you edited after I posted
It's working finally, thanks, but all this is too far from common user

lossyWAV 1.2.0 released

Reply #36
I finally got around to trying LossyWAV this weekend as my lossless FLAC music library is too big for my netbook's hard drive. I have to say that I am really impressed. I used the parameters in Nick's signature and I have not noticed a difference between the original lossless versions and the lossy ones (although I do have tin ears).

By the way, adding the libfftw3-3.dll library file to my LossyWAV directory produced an incredible speed up in LossyWAV processing. I would highly recommend it to anyone processing a lot of files.

lossyWAV 1.2.0 released

Reply #37
I got PMed about batch scripts, so I'm posting it here + to make life easier for others who want to try this and use foobar:

lossyFLAC.bat
Code: [Select]
goto %1
goto end
:correction
c:\"Program Files"\encoders\lossywav %2 %4 %5 %6 %7 %8 %9 --%1 --below --silent
c:\"Program Files"\encoders\flac -b 512 -l 6 -e -m -r 2 -f --totally-silent --keep-foreign-metadata "%~n2.lwcdf.wav" -o"%~n3.lwcdf.flac"
c:\"Program Files"\encoders\flac -b 512 -l 6 -e -m -r 2 -f --totally-silent --keep-foreign-metadata "%~n2.lossy.wav" -o"%~n3.flac" && del %~n2.lwcdf.wav %~n2.lossy.wav
goto end
:merge
if not exist "%~n3.lwcdf.flac" goto end
c:\"Program Files"\encoders\flac -s -d "%~n3.flac" "%~n3.lwcdf.flac" --keep-foreign-metadata && ren "%~n3.wav" "%~n3.lossy.wav"
c:\"Program Files"\encoders\lossywav "%~n3.lossy.wav" -M --below --silent && del "%~n3.lossy.wav" "%~n3.lwcdf.wav"
c:\"Program Files"\encoders\flac -s --ignore-chunk-sizes -5 "%~n3.wav" -o"%~n3.fla"
:end

correction part produces %filename%.lossy.flac and %filename%.lossy.lwcdf.flac:


merge part produces %filename%.lossy.fla file which is identical to original file:

Quote
All tracks decoded fine, no differences found.

notes:
- because flacs aren't decoded with foobar (nevertheless temp wav is created then delated) but with flac.exe, don't forget that destination has to end in %filename% or equivalent when using merge (output file name format in converter dialog)
- if this is done in foobar media library it's good to exclude *.lwcdf.flac file types from library
- flac parameters for merged files are default foobar parameters for flac encoder, so they can be changed as desired correcting the last significant line in script
- if it's not too obvious, first parameter passed to batch file tell the script what to do (correction, merge or nothing)

have fun

lossyWAV 1.2.0 released

Reply #38
By the way, adding the libfftw3-3.dll library file to my LossyWAV directory produced an incredible speed up in LossyWAV processing.


Really? As far as I know FFTW library works faster with floats (4 bytes, single precision) than doubles. If single precision is enough it should significantly speed up FFT calculation.

lossyWAV 1.2.0 released

Reply #39
lossyWAV uses data type double for FFT calculations - this was due to early differences between the Matlab output and the Delphi output which were traced back to the FFT calculations.
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

lossyWAV 1.2.0 released

Reply #40
I got PMed about batch scripts, so I'm posting it here + to make life easier for others who want to try this and use foobar


Many thanks! 
🇺🇦 Glory to Ukraine!

 

lossyWAV 1.2.0 released

Reply #41
I got PMed about batch scripts, so I'm posting it here + to make life easier for others who want to try this and use foobar

Thanks for your efforts from me too.

lossyWAV 1.2.0 released

Reply #42
.... and from me too. The --correction / --merge parameters were implemented quite some time ago but I have not given much thought to re-integration using foobar2000, for example. Thanks for your efforts and patience in creating / testing the batch file.
lossyWAV -q X -a 4 -s h -A --feedback 2 --limit 15848 --scale 0.5 | FLAC -5 -e -p -b 512 -P=4096 -S- (having set foobar to output 24-bit PCM; scaling by 0.5 gives the ANS headroom to work)

lossyWAV 1.2.0 released

Reply #43
I got PMed about batch scripts, so I'm posting it here + to make life easier for others who want to try this and use foobar:


Hi,

I tried your script and the "correction"-part works great. I get the "lossy.flac"- and the "lossy.lwcdf.flac"-files... all fine.

But when I try the "merge"-part I get the conversion-error (e.g.):

Quote
An error occured while finalizing the encoding process (Object not found) : "G:\Downloads\Alice In Chains - Black Gives Way To Blue\Alice In Chains - Black Gives Way To Blue  - 02 Check My Brain.fla"


This is my adjusted script:

Code: [Select]
goto %1
goto end
:correction
d:\Programme\foobar2000\Encoder\lossyWAV\lossyWAV %2 %4 %5 %6 %7 %8 %9 --%1 --below --silent
d:\Programme\foobar2000\Encoder\Flac\flac -b 512 -l 6 -e -m -r 2 -f --totally-silent --keep-foreign-metadata "%~n2.lwcdf.wav" -o"%~n3.lwcdf.flac"
d:\Programme\foobar2000\Encoder\Flac\flac -b 512 -l 6 -e -m -r 2 -f --totally-silent --keep-foreign-metadata "%~n2.lossy.wav" -o"%~n3.flac" && del %~n2.lwcdf.wav %~n2.lossy.wav
goto end
:merge
if not exist "%~n3.lwcdf.flac" goto end
d:\Programme\foobar2000\Encoder\Flac\flac -s -d "%~n3.flac" "%~n3.lwcdf.flac" --keep-foreign-metadata && ren "%~n3.wav" "%~n3.lossy.wav"
d:\Programme\foobar2000\Encoder\lossyWAV\lossyWAV "%~n3.lossy.wav" -M --below --silent && del "%~n3.lossy.wav" "%~n3.lwcdf.wav"
d:\Programme\foobar2000\Encoder\Flac\flac -s --ignore-chunk-sizes -5 "%~n3.wav" -o"%~n3.fla"
:end


And here the encoder settings:

Encoder:  C:\WINDOWS\system32\cmd.exe
Extension:  fla
Parameters:  /d /c d:\Programme\foobar2000\Encoder\lossyFLAC.bat merge %s %d

What could be the problem? And what do you mean exactly with "- ... don't forget that destination has to end in %filename% or equivalent when using merge (output file name format in converter dialog)"? Is here the point?

Thanks in advance.

lossyWAV 1.2.0 released

Reply #44
thanks to all for their feedback on the script, I redirect that to the program author and people involved in it 

while I doubted if I should post here (as it is Validated News forum) or open new thread, it seems that I should have opened new thread

@Bollerkopp: I guess you run merge on original file (%filename%.flac) and not the lossy one (%filename%.lossy.flac)

line:[font= "Courier New"] if not exist "%~n3.lwcdf.flac" goto end[/font] checks if "%filename%.lwcdf.flac" exists, and if it doesn't it ends the script
%~n3 is the name part of the destination file (%d in converter) that you enter here:


I modified my converter dialog, but you'll get the point

lossyWAV 1.2.0 released

Reply #45
Thanks for your answer.

But no, I used it on the lossy ones (.lossy.flac).

This is how I have done:

1. Convert an album from my Media Library (Monkey's Audio-files... Path: "F:\Musik\A-C\Alice In Chains - Black Gives Way To Blue") to ".lossy.flac" (and ".lossy.lwcdf.flac") - the correction-part.



2. Then I put all the ".lossy.flac"-files from this folder in a playlist and select the merge-part in the converter.


In the Converter-settings under "Output files" - "Convert each track to an individual file" it looks like this:

Code: [Select]
%artist% - %album%\$if2(%artist%,unknown artist) - $if2(%album%,unknown album) $if2('CD'%discnumber%,) - [%tracknumber%] %title%)

lossyWAV 1.2.0 released

Reply #46
you should run converter only on .lossy.flac files (excluding .lwcdf.flac files), and about output name format I won't repeat myself

lossyWAV 1.2.0 released

Reply #47
also I just now noticed that I was merging in the source file folder, so maybe that's the problem, as I don't know of a way how foobar could give source file path to the encoder: %s gives destination path and %d gives destination name, or to put it differently - when using merge do this:

- "source track folder" must be selected for output path
- %filename% must be name format of output file

and somehow I forgot to clean up lossywav wav output so please add [font= "Courier New"]&& del "%~n3.wav"[/font] to the last line:
Code: [Select]
c:\"Program Files"\encoders\flac -s --ignore-chunk-sizes -5 "%~n3.wav" -o"%~n3.fla" && del "%~n3.wav"


lossyWAV 1.2.0 released

Reply #48
Yes, I run it on the ".lossy.flac."-files only. That was not the problem. The problem was the name format of the output file. Now I changed it to "%artist% - %album%\%filename%" and it works. Sorry for overlooking it.

I adjusted the last line... now all is fine. Thank you very much for your script and the effort.

lossyWAV 1.2.0 released

Reply #49
lossyWAV uses data type double for FFT calculations - this was due to early differences between the Matlab output and the Delphi output which were traced back to the FFT calculations.


Well, maybe this accuracy is redundant?