You don't need to cd to each subdirectory, you could either loop through a list of subdirectories or use the find command to locate all .wav files.
For example:
Code:
for file in $(find ./ -iname "*.wav"); do
lame -h "${file}" "${file%wav}mp3"
done
or
for file in subdir1 subdir2 subdir3; do
for file in "$subdir"/*.wav; do
lame -h "$file" "${file%wav}mp3"
done
done
The variable expansion ${file%wav} strips the 'wav' characters from the filename. The directory part of the filename is present in both in the first example.
You could produce a simple script that does the conversion, such as:
#!/bin/bash
lame -h "$1" "${1%wav}mp3"
Suppose you name this program "wav2mp3" and save it in ~/bin/. Make sure it is executable: "chmod +x ~/bin/wav2mp3".
Now, this oneliner will convert all of the WAV files to MP3s:
find ./ -iname "*.wav" -execdir wav2mp3 '{}' \;