Sounds like the wrong output device might be selected. This could be the case if you have an additional prefpane like Soundflower or another component used to "improve" the sound of your Mac.
System Preferences > Sound > Output, & make sure Internal Speakers is selected.
This is all I can think of off the top of my head. Hope it helps, but if not, I'll do some poking around for ya.
EDIT: Your iMac isn't connected to an external display via HDMI, is it? It could automatically be choosing the HDMI as the audio output...