QUOTE(I am all FLAC @ Feb 16 2008, 01:23)

Does "${f%ape}flac" mean "take the variable $f and replace ape with flac"?
The expression "${foo%bar}" tells the shell to remove the shortest string matching the pattern "bar" from the end of the string stored in variable 'foo' and return the result (this doesn't change what's stored in 'foo', though). So "${f%ape}flac" removes "ape" from the end of the string stored in 'f' (if present), then sticks the string "flac" on the end of what was returned. This has the net effect of replacing the "ape" extension with a "flac" extension, but there are plenty of cases where you'd want to just remove the matching part of the string without replacing it.
Check your shell's manpage for a better and more complete explanation. If you're using bash, it's in the "Parameter Expansion" section.