#!/bin/bash

# Define the input and output directories
input_dir="/home/christian/audio/reference-audio-wav"
output_dir="/home/christian/audio/reference-audio-wav-mono-24khz"

# Create the output directory if it doesn't exist
mkdir -p "$output_dir"

# Loop through all wav files in the input directory
for input_file in "$input_dir"/*.wav; do
  # Extract the filename from the input file path
  filename=$(basename "$input_file")
  
  # Define the output file path
  output_file="$output_dir/$filename"
  
  # Run ffmpeg command to resample and convert to mono
  ffmpeg -i "$input_file" -ac 1 -ar 24000 "$output_file"
done

echo "Resampling and conversion completed."