IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Linux bash script for lossyWAV batch processing
doccolinni
post Mar 27 2010, 17:37
Post #1





Group: Members
Posts: 173
Joined: 28-May 09
From: Zagreb, Croatia
Member No.: 70204



I'm a Linux user and, unfortunately for me, lossyWAV doesn't support wildcards in filenames so I had to manually process one file at a time with it. Eventually I got bored of doing that (plus today I had to process nearly 1000 files with lossyWAV...), so I decided to write a bash script that does it for me. I figured it might be useful for anyone else who uses Linux and lossyWAV, so I decided to share it. Here it is:

CODE
#!/bin/bash

for dat in *
do
    printf "\n"
    wine lossyWAV.exe "${dat}" -t -i -q 4
done

exit


Of course, "-t -i -q 4" is my personal choice of lossyWAV settings so adjust those to your liking. Here are instructions on how to use the script:

1) Of course, you need to have Wine installed.

2) Copy lossyWAV.exe to ~/.wine/drive_c/windows/system32 ("~" is your home directory, i.e. you need to copy lossyWAV.exe to /home/[YOUR USERNAME]/.wine/drive_c/windows/system32 ). I highly recommend copying libfftw3-3.dll (from this archive) to the same directory for greater processing speed.

3) Copy-paste the script I posted in a text editor, adjust the command-line lossyWAV settings to your liking and save it as lossywavproc.sh (you can choose a different filename, it's not important).

4) As a super-user copy the lossywavproc.sh to /bin but make sure to adjust the permissions so anyone can run the script.

5) In terminal, go to the directory which contains the .wav files you want to process with lossyWAV.

6) Type lossywavproc.sh (or whatever you've named it) and hit enter.

Any non-wav files in the directory will be left untouched (although you will get an error saying "File type is not RIFF" but you don't have to worry, the script won't get stuck and will continue processing any .wav files in the directory until it's done.



If you want the script to automatically convert the files to lossyFLAC, use this script instead (but you need to have FLAC installed as well, obviously):

CODE
#!/bin/bash

for dat in *
do
    printf "\n"
    wine lossyWAV.exe "${dat}" -t -i -q 4
done

printf "\n"

flac --keep-foreign-metadata --replay-gain -8 -b 512 *.lossy.wav

rm *.lossy.wav

exit


Of course, adjust the lossyWAV and FLAC command-line arguments to your preferences.



Cheers. beer.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th December 2014 - 05:29