Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411977 Posts in 69438 Topics- by 58486 Members - Latest Member: Fuimus

June 15, 2024, 03:49:39 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Gamemaker 7.0 sound problems
Pages: [1]
Print
Author Topic: Gamemaker 7.0 sound problems  (Read 2333 times)
Lazrool
Level 0
***



View Profile
« on: June 09, 2010, 11:31:07 PM »

Problem:

When multiple instances play the same sound effect at the same frame, the sound volume "stacks". For example lets say the sound volume for a sound file is 20. There are five instances of bullets for example that all hit a wall at the same time and make a hit sound when they do. The sound volume gets tacked and is now 100.


Solution:

Huh?
Logged
nikki
Level 10
*****


View Profile
« Reply #1 on: June 09, 2010, 11:50:04 PM »

mySoundVolume = myDesiredSoundVolume/numberOfInstancesAtThisFrame      ?

but then i don't work with Gm so it's just BS
Seems like a problem that someone must've already solved ...
I hope they respond too.

 
Logged
GZ
Level 1
*



View Profile WWW
« Reply #2 on: June 10, 2010, 01:54:23 AM »

I recall experiencing this before, but I don't know if it can be avoided. For instance, a few seconds ago I generated some noise in Audacity and lowered the volume of it (amplify, -20 db). Then I copied the data and hit play. Volume was low, so I pasted another copy below it. It got louder, and every new copy made it even louder until it maxed out. So I am pretty sure this isn't just a GM thing.

Have you used sound_stop to stop the wall hit sound before you play it? It might be a little weird sounding that way, but it might be more desirable than the volume stacking like that.
Logged

Lazrool
Level 0
***



View Profile
« Reply #3 on: June 10, 2010, 03:34:39 AM »

If sound_isplaying(argument0) then sound_stop(argument0);
sound_play(argument0);

That is what I'm using as it stops other kind of sound stacking but not the volume one. I can't think of any other solution besides having a seperate object that handles some of the sound playback, for example it could be in an alarm event so that every time they sound is triggered it sets the alarm[0] = 1 and regardless of how many times you set alarm[0] = 1 it still going to be 1 and it is still going to trigger just once.

But that seems like a really amateurish workaround, probably doesn't even work and I really don't want to use something like that anyway.
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #4 on: June 10, 2010, 04:41:28 AM »

i don't think this is just gm. in many sound libraries playing the same sound twice, over itself, will double the volume.
Logged

muku
Level 10
*****


View Profile
« Reply #5 on: June 10, 2010, 04:58:04 AM »

It's just a basic fact of digital audio: if you play the same thing twice, all the samples will add up to twice their original value. (Technically, that doesn't make the sound twice as loud; for that you'd need an increase by a factor of about 10dB, which corresponds to multiplying by ~3.16.)

Possible workarounds, as mentioned, are detecting how often the sound was triggered and starting it at most once per frame, or cutting off any previous instances of the sound. One thing I'd imagine helping too is randomly using one from a couple of similar, but different sounds for the same event; this way you don't get the perfect superposition which leads to the blow-up of the sample values.
Logged
moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #6 on: June 10, 2010, 06:07:50 AM »

Yeah it happens in all programming languages. One solution would be to apply one or just a handful of channels to that sound and not have new sounds interrupt older sounds on those channels instead of mixing.
Logged

subsystems   subsystems   subsystems
Lazrool
Level 0
***



View Profile
« Reply #7 on: June 11, 2010, 12:46:26 AM »

Well this is something that you have to take into consideration BEFORE you set up any sound playback, so I'll just figure out some workarounds since I'm pretty far in already.

I'll remember this in future projects.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic