Easily. Got ear infection (!) from an unexpected, very loud random noise in my headphones (just one channel) as a result of a bug in my CoreAudio code.
What does CoreAudio do if your floating point audio buffer is filled with random numbers? That's right, it plays random noise at the maximum possible level, bypassing the system volume setting.
Why ear infection? I have no idea, but my GP explained that it's quite possible even if the eardrum doesn't get damaged. Which in my case thankfully it didn't.
If the system volume is a multiplier and the float values have large exponents... Small times huge ~= huge.
I guess safe volume control should ideally limit the output energy. Energy is proportional to square (or so) of frequency, so ideally it would take that into account as well. That rules out simply hard-clamping sample values because that creates high frequency / energy distortions. Not trivial, especially if low latency is also required.
Exactly and it's not obvious at first. You can easily see that the system doesn't limit the FP audio in Logic Pro: you can in principle crank up the volume all you want. So if the system volume multiplier is, say, 0.1, you can have a buffer with values -10..10 and that will play at maximum volume fine. Everything beyond that will get clipped by the DAC.
So random FP noise clipped is still random FP noise at maximum level.
I hit this bug just the other night, and I think what caused it was accidentally sending NaNs to the audio API. That bypassed whatever clamping functions were in place, and just produced an ear-piercing shriek. Very unpleasant.
What does CoreAudio do if your floating point audio buffer is filled with random numbers? That's right, it plays random noise at the maximum possible level, bypassing the system volume setting.
Why ear infection? I have no idea, but my GP explained that it's quite possible even if the eardrum doesn't get damaged. Which in my case thankfully it didn't.