The digital audio goes to sleep soon after an audio source goes silent, but this is the first complaint of the issue that I have seen where it is reported to do it within 3 seconds!
Google around and you may find a little app to keep digital audio on a Mac awake. SoundOn and KeepSound Awake were two in the past.
I've got the same issue with my HTPC... (mid '09) Mac Mini > Toslink > NAD amp
Every audio source has a half second or so 'hiccup' in the beginning. Even if iTunes (or whatever) was just playing a previous file. It is like the sync is released and then re-established based on the file's usage (not the program).
Adding a cross-fade setting in iTunes seems to help, but that doesn't help in the least for editing (which I do a lot of).
The analog output really is inferior to the optical (especiallt if you have a good DAC), but if you can't hear it what's the point?
I haven't found any scripts that work for my 10.6x Mini yet...
I went ahead and wrote a simple app to fix this issue in OSX Lion as well as previous versions. It's called Silent But Deadly.
Same concept that you may have heard of before in the past; play a short audio clip that's just loud enough to activate the Toslink SPDIF port but still soft enough to not be noticable. The app will automatically lower to the dock and utilizes <1% cpu usage on most machines. Bloatware, Malware and Virus free.
This problem really bugged me also, so I had to write something that keeps the optical audio port alive with the lowest impact. The best solution was an AudioQueue-based tone generator, which generates a 20 hz pulse with the lowest pulse level, silenced to 1 percent. It's absolutely unhearable on my LG home theatre system with all volumes maxed out, so I'm quite happy now.
I've just released the app on the mac app store, it is called Optical Audio Port Keepalive .