Skip to main content
Topic: How to convert WAV to FLAC conversion via batch script? (Read 5690 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to convert WAV to FLAC conversion via batch script?

I'm interested in creating a batch script that will help convert multiple WAV files to FLAC files, and numerous searches in this forum only shows solutions that aren't compatible with Windows 8.

BTW: Yeah, I know I can use fb2k. But I'm interested in doing it the old school way.

ghostman

How to convert WAV to FLAC conversion via batch script?

Reply #1
Code: [Select]
flac *.wav
see https://xiph.org/flac/documentation_tools_flac.html#usage, though I'm not really sure if FLAC handles that correctly when using CMD, since with CMD wildcard expansion has to be performed by the program itself. Powershell does wildcard expansion, though.

So, in CMD your best bet would be:
Code: [Select]
FOR %%F IN (*.wav) DO flac %%F
see http://ss64.com/nt/for.html. Use only one % when invoking from the CMD shell directly, and two %% in batch scripts.
It's only audiophile if it's inconvenient.

How to convert WAV to FLAC conversion via batch script?

Reply #2
Don't you need a /R switch and - at least for typical file names these days - enclose "%%F" in quotation marks?

Not to mention that oldschoolness requires you to read yourself up on all switches like whether to keep foreign metadata, verification, logging of errors, ...
High Voltage socket-nose-avatar

How to convert WAV to FLAC conversion via batch script?

Reply #3
Code: [Select]
flac *.wav
see https://xiph.org/flac/documentation_tools_flac.html#usage, though I'm not really sure if FLAC handles that correctly when using CMD, since with CMD wildcard expansion has to be performed by the program itself. Powershell does wildcard expansion, though.

So, in CMD your best bet would be:
Code: [Select]
FOR %%F IN (*.wav) DO flac %%F
see http://ss64.com/nt/for.html. Use only one % when invoking from the CMD shell directly, and two %% in batch scripts.


I ended up choosing the 2nd option, but it didn't work at all. Put that line into a TXT file, renamed the extension BAT, put flac.exe, metaflac.exe and a wav file into a folder with it. But whether I dragged the WAV file onto the BAT file or just clicked on it, nothing worked.
ghostman

How to convert WAV to FLAC conversion via batch script?

Reply #4
Code: [Select]
:loop
if %1.==. goto end
flac %1
shift
goto loop
:end

How to convert WAV to FLAC conversion via batch script?

Reply #5
Okay, this script successfully worked. I'm curious, though, how to modify it to use pipe encoding, if it doesn't already.
ghostman

How to convert WAV to FLAC conversion via batch script?

Reply #6
please explain.

How to convert WAV to FLAC conversion via batch script?

Reply #7
Does the script use temp wav or pipe encoding? I've heard that the latter is more efficient.
ghostman

How to convert WAV to FLAC conversion via batch script?

Reply #8
Flac reads directly from a wav file and writes directly to a flac file, There are no intermediate files.

How to convert WAV to FLAC conversion via batch script?

Reply #9
Great. That's good to know.
ghostman

How to convert WAV to FLAC conversion via batch script?

Reply #10
So now that the basics are locked down, I was wondering how the batch script could be modified so that the end product ends up in a separate folder (i.e. like it does in SoX)
ghostman


 

How to convert WAV to FLAC conversion via batch script?

Reply #12
Funny ;-)

But, seriously, didn't Synthetic Soul have a script that could direct output to a specific folder?
ghostman

 
SimplePortal 1.0.0 RC1 © 2008-2020