ID:1518568
 
BYOND Version:504
Operating System:Windows 8 Pro 64-bit
Web Browser:Chrome 33.0.1750.146
Applies to:Dream Seeker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:
In my project I'm playing a background sound when the player enters the area and a sound when a door is opened.

The background sound has a volume of 10% but this seems to be slightly higher when it is first played.

Once the foreground sound of a door opening is played the background sound reverts to the 10% volume setting.

Numbered Steps to Reproduce Problem:
1. Play a background sound on repeat with a lower volume setting when the player logs in.
2. Add a verb that plays a regular sound (no additional settings, just a regular call to sound() with an ogg file in single quotes as the only parameter)
3. When you log in the background sound plays at a higher volume than what you'd expect.
4. When you click the verb the foreground sound plays. The background sound decreases its volume and plays normally from that point.

Expected Results:
Sound A should not change settings of Sound B / Sound B should always play at the specified volume.

Actual Results:
See steps to reproduce. Sound plays at a higher volume and/or volume goes down when another sound is played.

Does the problem occur:
Every time? Or how often?
Every time.
In other games?
Untested.
In other user accounts?
Untested.
On other computers?
Untested.

When does the problem NOT occur?
The problem with my volume setting is resolved after another sound is played, and seems to stay resolved.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Unknown.

Workarounds:
It may be possible to play inaudible noise (i.e., silence or sound that can't be picked up by the human ear) as a stopgap.
I think a test project for this could go a long way. Sound problems are notoriously often different on different platforms.
Isn't this just a case where the volume is being set in multiple locations (e.x., once when the sound is originally played on the client and an update when the client receives another sound?) and in one of those locations the volume is set incorrectly? Please just look in the source-code for the places where volume is being set, it could save both of us a lot of time.
Playing a blank sound file does not resolve the problem.

It seems that anything played over a certain volume reduces the overall volume of the other sounds. Playing the door sound at full volume resolves the problem, but playing it at 5% volume does not.

Is there an auto-tune of some kind in place that specifies what 100% volume means in decibels? If so that may be triggered when a louder sound is played to reduce the volume of all sounds overall.

I also found this article which may help: http://stackoverflow.com/questions/7186523/ fmod-channel-setvolume-doesnt-work

If you set the volume (and possibly other settings as well) before the sound is played it won't work, you have to pause it, then play it, modify the settings, then unpause the sound.
The following resolves the issue for me:

// Play the sound.
var/sound/S = sound(music, repeat = 1, channel = 10)

S.status |= SOUND_STREAM

M << S

// Spawn(0) is needed to delay execution until the client is playing the sound. (Only tested locally.)
spawn(0)
// Set the volume manually.
//S.file = null // Doesn't work in combination with SOUND_UPDATE, but the documentation says it should.
S.status = SOUND_UPDATE
S.volume = 10

M << S


Unfortunately this creates a brief period where the sound is played at full volume, and I'm not sure if spawn(0) will work in a production environment. Threads are off in my local instance (due to id:1487244).

Another quirk is that setting the file variable to null will stop playback even when SOUND_UPDATE is used. The documentation seems to indicate otherwise: using SOUND_UPDATE will update the configuration of the selected channel, but continues to play the same song.

I had hoped to be able to configure channels from processes that don't know what's playing on them, but that doesn't work apparently.

Please read my previous comment for a Stackoverflow issue regarding FMOD and setting the volume. The solution to this issue could also be the solution to id:1518573.




While you're resolving this issue could you also look into adding the following?

- Adding a client.sounds variable that has a list of read-only /sound datums that the client is playing at that moment? Right now I have no way of telling what sounds are playing on the client and without a proper length variable on the /sound datum I have no way of telling.

- Ignoring sound.file if it is set to null and the SOUND_UPDATE flag is used?

Thanks.
Necromancer powers, ACTIVATE!!

I've started putting sounds into my game to try and see how some of it will end up, and it appears to be tied into this issue.

I've only got one sound file available, but I call src<< sound() with volume set to 1.

This gets called repeatedly (I'm not looping it, but calling it when necessary for a gatling gun sound) and even though the volume is set to 1, it keeps getting louder and louder. Eventually, it's loud as hell and is terrible.

I've tried setting volume in the sound proc, as well as setting the volume variable directly, regardless of method it just kind of builds up.

I'm thinking there's some kind of internal issue on how the volume is handled across multiple sound objects.

It feels like it adds the volume variable every single time as setting it to a higher volume makes it get ridiculously loud much faster, volume 2 gets obnoxious roughly twice as quickly.

Try it out with a verb that just repeats itself and calls the sound proc with a volume of 1 every 1 tick or so (10/second. Eventually it just builds up and explodes your speakers.

I don't mean to hijack the post, but I think it may stem from the same issue, so I wanted to be sure to avoid posting what is essentially a duplicate report.
In response to Bravo1
Bravo1 wrote:
Necromancer powers, ACTIVATE!!

Obviously the proper phrase of power is: Klaatu Verada Nicto.
In response to Bravo1
Do you have a channel on your sound datum? Because if you don't, what you're hearing is multiple gun sounds, not just one of them getting louder.
In response to Lummox JR
I don't, but the gun sound only plays once, and then never again. The reason I don't use the same channel is because otherwise the sounds don't overlap at all, and it sounds choppy and interrupted.

Ex: With channels randomly picked.

Start sound on channel x at volume 1, sounds like volume 1. Sound ends.

Start sound on channel y at volume 1, sounds like volume 2. Sound ends.

Repeat tons of times

Start sound on channel z at volume 1, sounds like death.
Ok So I believe I've figured this one out. For some reason, loudness equalization on windows will slowly increase the volume of any sounds played until it's maxed out. Turning LE off in windows stops this. I find that this doens't happen with other programs though. Strange. I turned it off for good just o be sure though.