Thanks for all the help so far. DeNayGo was right - nano wrapped the text when it shouldn't have. Fixed that and made changes suggested by acid an heema. Here's the script I have now:
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#remove uppercase
for i in *.[Ww][Mm][Aa]; do mv "$i" `echo $i | tr '[A-Z]' '[a-z]'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader $i && lame -m s -o audiodump.wav $i; done
#convert file names
for i in *.wma; do mv "$i" "`basename "$i" .wma`.mp3"; done
rm audiodump.wav
It still doesn't work though:
# wmamp3
mv: `Carrie_Underwood-1-Inside_Your_Heaven.wma' and `Carrie_Underwood-1-Inside_Your_Heaven.wma' are the same file
MPlayer 1.0pre6-3.4.3 (C) 2000-2004 MPlayer Team
CPU: Intel Pentium 4/Xeon/Celeron Northwood (Family: 8, Stepping: 4)
Detected cache-line size is 64 bytes
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection - WARNING - this is not optimal!
To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
77 audio & 188 video codecs
Linux RTC init error in ioctl (rtc_irqp_set 1024): Permission denied
Try adding "echo 1024 > /proc/sys/dev/rtc/max-user-freq" to your system startup scripts.
Opening joystick device /dev/input/js0
Can't open joystick device /dev/input/js0 : No such file or directory
Can't init input joystick
Setting up LIRC support...
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support.
You will not be able to use your remote control.
Playing carrie_underwood-1-inside_your_heaven.wma.
ASF file format detected.
Clip info:
name: Inside Your Heaven
author: Carrie Underwood
copyright: (p)&(c) 2005 19 Recordings Limited
==========================================================================
Trying to force audio codec driver family libmad...
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, 16 bit (0x10), ratio: 16002->176400 (128.0 kbit)
Selected audio codec: [ffwmav2] afm:ffmpeg (DivX audio v2 (ffmpeg))
==========================================================================
Checking audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
AF_pre: af format: 2 bps, 2 ch, 44100 hz, little endian signed int
AF_pre: 44100Hz 2ch Signed 16-bit (Little-Endian)
[AO PCM] File: audiodump.wav (WAVE)
PCM: Samplerate: 44100Hz Channels: Stereo Format Signed 16-bit (Little-Endian)
[AO PCM] Info: fastest dumping is achieved with -vc dummy -vo null
PCM: Info: to write WAVE files use -waveheader (default).
AO: [pcm] 44100Hz 2ch Signed 16-bit (Little-Endian) (2 bps)
Building audio filter chain for 44100Hz/2ch/16bit -> 44100Hz/2ch/16bit...
Video: no video
Starting playback...
A: -0.0 (00.0) ??,?% 0%
Exiting... (End of file)
LAME version 3.96.1 (
http://lame.sourceforge.net/)
CPU features: MMX (ASM used), SSE, SSE2
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding audiodump.wav to carrie_underwood-1-inside_your_heaven.wma
Encoding as 44.1 kHz 128 kbps stereo MPEG-1 Layer III (11x) qval=3
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
0/2 ( 0%)| 0:00/ 0:00| 0:00/ 0:00| 0.0000x| 0:00
average: 128.0 kbps LR: 2 (100.0%)
Writing LAME Tag...done
ReplayGain: +51.0dB
#
well I think we're making progress. Sorry, I don't know anything about scripts or any of the like. I'm at your mercy on this one.
BTW - is there another way of converting wma to mp3?