Implement a script in /app/ that converts audio files from FLAC format to WAV format using FFMPEG.
Functionality To Implement:
The script should iterate through all .flac files in the current directory.
For each .flac file, the script should use FFMPEG to convert it to a .wav file with the same base name.
Expected Inputs:
The input will be a directory containing any number of .flac audio files.
Expected Outputs:
For every .flac file in the directory, the script should generate a corresponding .wav file with the same file name (but with a .wav extension) in the same directory.
File Location and Naming:
Create a shell script named convert_flac_to_wav.sh in the /app/ directory. Ensure that the script can be executed.
Make sure to handle any potential errors in file conversion gracefully, and ensure that FFMPEG is installed and accessible from the script.
Tests
The following test script will be used to verify your solution:
bash
#!/bin/bash
# PURPOSE: FFMPEG Audio Conversion Script (flac -> wav)
echo "-------------------------|" $TITLE "|"
cd "$(dirname "$BASH_SOURCE")" ||
{
echo "Error getting script directory" >&2
exit 1
}
# VARS ###########################################################
TITLE='FFMPEG Audio Conversion Script'
for f in *.flac; do
ffmpeg -i "$f" "${f%.flac}.wav"; done
done