Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.


over the years of using Microsoft operating systems, I many times encountered the situation that I only now want to understand. When you get BSOD while listening to music, there is a short period of time (1-2 sec), when screen freezes and the last part of music is repeated several times, before everything falls into blue abyss. Today I became very curious about mechanics behind this situation - what makes that certain part of audio to loop? I beg you, kind sirs, to satisfy my curiosity.

share|improve this question

3 Answers 3

up vote 6 down vote accepted

It is simply to do with buffering and DMA.

The operating system doesn't play the sound directly, but decodes it (uncompresses, etc) and sends it out to the sound hardware for playing.

This is seldom done by the processor directly but by the DMA subsystem (Direct Memory Access) which handles it independantly. The processor basically tells the DMA system to copy chunk A of memory to the sound hardware and indicate when it is done.

If the operating system has crashed then it will never receive the signal from the DMA chip to say that the transfer has finished, so it will never be able to tell the DMA chip to transfer the next chunk. So what does the DMA chip do? Well, unless it has been told to do something else it may well transfer the same chunk of data again.... and again... and again... until it gets shut down, resulting in repeated sound. The other thing that may happen is that the operating system has received the signal to say it has finished transfer, and then send the signal to start a new transfer, but not have put any new data into the buffer, resulting in the same piece of data being transferred again... and again... etc. Which of these is actually happening is all dependant on how MS have decided to use the DMA system for audio playback, and without seeing the source code to Windows I really couldn't say which it is.

I hope this gives some insights into it, anyway.

share|improve this answer

The small section of RAM, or buffer, that the sound card uses to play from is circular. The DAC within the sound card, once it reaches the end of this buffer, goes right back to the beginning. Before that time the OS is supposed to have overwrite the old data in the buffer with new sound data. However, if the OS hasn't gotten to that because of high CPU, or a crash, the DAC in the sound card will just keep on trucking.

Most hardware is "stupid" like this, by design. Simplicity is reliability, as far as hardware and network design goes. It applies for OS design as well, but, you know...

That's how a lot of digital audio works. CD players are based on the same principle, and that's why you hear them skip the way they do when bad sectors are encountered.

share|improve this answer

AFAIK, sound happens in real time and is quite complex - codex/buffers/cache etc all happen within the chip.

to try and put it simply, The computer basically puts to the cache/buffer the audio to hear and tells it to start playing. It needs to be told to stop, and if it doesn't get the stop command, it will continue to play over the cache/buffer until it is forced to stop.

The Windows Audio Service which links the sound card to the operating system in a usable manner. During a BSOD, this service fails and in the few seconds between the sound card/chip loosing power/timing out, it replays the buffer/its last command over and over again.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.