Did you upgrade iTunes recently? Have you tried playing music through different players on the iMac? If it is garbled distorted sound it could just be a software issue, I had terrible sound on a Windows XP version of iTunes after upgrading to a newer iTunes version....
I would not think that a bad internal soundcard would affect optical digital out... as the digital signal is just passing through... So make sure you rule out software problems first.
I would not think that a bad internal soundcard would affect optical digital out... as the digital signal is just passing through... So make sure you rule out software problems first.