I've also been having this problem with my Mac mini (2009 version). Static/crackle sound over digital connection when the audio has been idle for a short while.
It reminded me of an old problem that some PowerBook G4 users had several years ago, where the audio hardware would go to sleep to save power and there would be a delay while it woke up. I remembered that there were a coupe of utilities created to remedy this problem by playing silent noises at short regular intervals.
I tracked down these utilities - KeepSoundAwake and SoundOn. Someone mentioned that SoundOn used a whopping 1% of CPU and showed a Dock icon, while KSA usage was usually 0% and had no Dock icon. So I decided to try KeepSoundAwake.
Here is a link:
http://mrfeinberg.com/KeepSoundAwake/
So far so good. I've been crackle-free for the last several minutes since starting up the program. This is a pretty ancient application (last update was a fix for 10.3 compatibility), so there are a few things to be aware of. I now have this one non-intel-native app running constantly, which is sort of a bummer - but with 4GB, I'm not too concerned. The PrefPane that comes with it will not run at all since it is not intel-native, but the default settings are fine so that's not really a concern either. You do need to make the app a startup item so it will be running all the time.
If I encounter any problems with using KSA with my setup, which includes running some multi-channel audio through Plex, I'll report back here.
I do wish Apple would officially address this issue so we wouldn't need to use a 7-year-old hack!