#!/bin/bash

# Directory to search
dir="/home/ok/Desktop/mobile_audio"

# Loop over all .wav files in the directory
for filename in "$dir"/*.wav; do
    # Get the base name of the file
    base=$(basename "$filename" .wav)
    
    # Convert the .wav file to base64
    base64string=$(base64 -w0 "$filename")
    
    # Create a .js file with the base64 string as a global variable
    echo "var $base=\"$base64string\";" > "$dir/$base.js"
done
