using multiplay without blowing my speakers...

Hi all,

So I’m building a little generative sound machine that has around 256 elements that can each play a sound.

Okay so maybe not so little.

I’m on here because I’m playing just 16 sounds right now (with the volume set to 0.25) and my speakers do NOT sound very happy with me… they’re starting to be a little crackly as the sounds build up.

Am I going to blow my speakers?

I am using a single ofSoundPlayer object right now, with


any help, very appreciated…

-C :smiley:

Am I going to blow my speakers?

it sure sounds like you are maxing out on volume. are the samples loud? there is code around the forum for seeing the fmod waveform, so you can look your self. if you see alot of clipping, you’re in trouble.

I could be wrong, but it sounds like 16 samples playing at 1/4 volume is going to hurt

but check if it’s that you are maxing volume or if something else is wrong, like fmod is having trouble keeping up and is stuttering. are they silences (gaps) or like blow out your speaker type noises?

take care!

If all the sounds play at 100% volume you will get clipping if you play them all at the same time (depending of course how loud the sounds are to begin with).

What you can do is check how many are playing at any one time and then set the volume of each sound to be 1/MAX_NUMBER_OF_SOUNDS, that way you can kind of keep things at the equivalent sound level of just 1 sample.

Hey Cameron,

In an analogue setup 1.0 or max volume represents the maximum movement the speaker cone can safely move in and out of the speaker without it becoming damaged. Any volume over this would be asking the speaker to move more than it was designed to do and would most likely ‘blow’ the speaker.

With a computer 1.0 represents a pretty absolute limit (if I understand it right) where 1.0 is the max height of a waveform the computer can store. Any sound that goes over this limit is set to 1.0 and this audio data is lost, hence ‘clipped’. This produces a distortion effect due to the loss in resolution of the data whenever it goes over 1.0. The good thing about this though is that the audio is being clipped digitally by the computer and therefore will be at a safe level for the speakers, even though it might not sound great. Generally though it is a good idea to give your self a little extra headroom and not always try and work at exactly 1.0, you might not blow your speakers but you could damage your ears :smiley:

So for your case if you have a sound at 0.25 volume then the max volume the sound can output is 0.25 - ( most of the time the sound will be somewhere between 0.0 and 0.25 but at loud moments it can reach a max of 0.25 ).

If you have more sounds playing at the same time, their volume (or amplitude) is cumulative. So with three sounds at 0.25 - the system volume could be anywhere between 0.0 and 0.75. With four sounds at 0.25 - anywhere between 0.0 and 1.0. etc

With sixteen sounds the max volume would be 16 * 0.25 = 4.0. If the system clips at 1.0 then you are loosing a lot of audio data - which would result in a lot of distortion from clipping.

So as Grimus suggested you should figure out what the max number of sounds you will be playing at any one time and then set the volume to be 1.0/MAX_NUMBER_SOUNDS (0.8 / MAX_NUMBER_SOUNDS if you want to play it safe). This will give you a consistent volume for each sound and ensure that there is no clipping. Sounds played on their own however will sound quite quiet, so you might want to dynamically set the volume for each sound based on how many are actually playing.

ie: if you have 5 sounds playing set each of their volume to 0.2 ( 1/5 )
if you have 10 sounds playing set each of their volume to 0.1 .

A thing to note if you do this is that any sudden change in volume of a sound will produce a small ‘pop’ in the audio. So if you decide to dynamically change the volume of each sound you should fade to the volume over a short period of time.

I think you mentioned though you are using a single ofSoundPlayer object though, which wouldn’t allow you to dynamically adjust the volume of each sound once it had been played with multiplay.

anyway hope that helps!

zach, grimus and theo.


I am a sound n00b, and this is very very helpful.

I definitely notice the clipping. :o

I feel pretty confident I’m not going to blow my computer up now, so I can start thinking about how to structure my code.

Is there any reason I should not want to have ~1024 ofSoundPlayer Objects?

I’m just trying to figure out the best way of putting a bunch of sounds together… what to multiplay, and what to create new object…

thanks again! !!