# Physically how many sounds can be played simultaneously?

The question may sound a little vague so allow me to explain:

I am not a sound engineer, so I don’t know the lower level of how sound flows around the hardware. In a game, for instance, if there are so many gunshots around, you will hear all these “bang bang bang” from everywhere. It is logical that there should be a total number of sound that can be played simultaneously. The question is “can I detect these limits on each computer and how so?” and “are there workaround for these limits?”

The number of “audio tracks” that Audacity can handle depends on the capability of the computer that it is running on. My old Pentium II 500 can handle about 10 stereo tracks simultaneously. My 2 GH laptop can handle over 50 (never needed more than that).

If you reach the limit of how many tracks your computer can handle, you can mix down some of the tracks to a single mono or stereo track and then add more tracks.

The number of “audio tracks” that Audacity can handle

But the questions was playing them. Correct me, but the answer is two, left and right.

Koz

If I listen to a CD recording of an 80 piece orchestra with a choir of 120 singers, how many sounds are playing?

Two. Left and Right.

Koz

What if I’m watching a movie in Dolby Surround and I have 6 speakers?

ionosphere, even with your explanation, your question is still vague… What exactly do you want to achieve? Why do you need to know that number?

Six (5.1). But you won’t be doing it in Audacity. I believe you can get Dolby AC3 Surround into Audacity, but you can’t get it out.

Koz

ionosphere, even with your explanation, your question is still vague… What exactly do you want to achieve? Why do you need to know that number?

With all the replies, perhaps I should reconsider myself and study a lot more.

Okay, I have to admit that I am no sound engineer, so perhaps I should elaborate my scenario:

I am writing a game program. I am trying to understand how the audio goes around the hardware, so that I can manage them better programming-wise. For instance, if we have 200 zerglings and 100 marines fighting each other, we will have to play lots of “zergling’s claws” and “machine gun” sound effects at once. We have many instances of sound effects at once, so this is why I am asking for the audio limitation. If things get too messy and chaotic in the game, we might get “your ba-ba-base is under attack”. Stuttering sounds. That’s why I am asking whether we can do anything about it or not.

I thought it might be something like that.
I presume that each of your “sounds” would be pre-recorded audio data and your program would trigger the playback of the appropriate audio sample at the appropriate time. So in a “busy” part of the game, there will be a lot of samples playing at the same time. There could be many limiting factors. For each sound sample, the audio data must be read from the disk and sent to the sound card. Simultaneous sounds could be pre-mixed in your software, or could rely on the sound card drivers to handle mixing the audio streams, either way there could be a limit to the number of streams that can be handled that is imposed by the software, or the limit could be the speed at which the computer can access the data and send it to the sound card. Probably the best thing to do to ensure smooth game play would be to limit the number of sounds to a fairly small number, then try increasing that number and checking that it still runs smoothly. If you are writing a highly optimised sound engine that pre-fetches the audio data and mixes it to a single audio stream efficiently, then you may be able to handle hundreds of sounds. On the other hand you may be building the game using some sort of game maker software that only allows one sound at a time.

To play a sound you probably need to call some function to play it right? Which one will depend on the API you’re using…

That will probably interact with the sound card driver at some point. How everything is processed will depend a lot on the sound path (in the software) and at which points the sounds get mixed. But this is not an hardware, it’s all software. The sound card (the hardware) only gets “one sound” at a time.

When you’re playing more than you sound simultaneous this has to be mixed at some point. This can be done by the sound card driver (some might be able to do it, others might not… some will get sound card locked until finishing playing the current sound and you can only make another call to the “send sound” function when it’s done with the previous).

Usually the best solution is to use some kind of “sound engine” that will do all this processing for you in an optimized way… So you got some piece of software running called a sound engine, which will provide you an API with functions for playing sounds for example. You call that function and you send that sound to the sound engine. Then if you send more “nearly” simultaneous requests the sound engine will take care of them and mix them down before sending them to the sound card driver.

What is the number of simultaneous “play calls” you can make to the sound engine will depend on the sound engine. You have to read the documentation of the sound engine API to know more about that. There are probably more than one free open source sound engine that you can use. That’s probably the best way to go, than writing your own from scratch, unless you have a very good reason for that.