For years I have been doing all sorts of hacky things to mangle strings in bash. Today, while looking for something else in the Bash man page, I noticed the section that mentions regex. This is useful. Bash will do regex operations in a Perlish style. The matching substring for each of your parenthesized subexpressions is available in the elements of the BASH_REMATCH array. The syntax looks like this:
filename="myfile.wav"
[[ $filename =~ (.*).wav ]]
echo "${BASH_REMATCH[1]}.mp3"
This simple example converts myfile.wav to myfile.mp3. Of course your string operations can be whatever you need them to be.