Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: strazer on Sat 07/02/2004 18:38:11

Title: Ambience volume change produces sound artifacts
Post by: strazer on Sat 07/02/2004 18:38:11
Hi!

I use this code

   int volume=0;
   PlayAmbientSound(1,12,255,0,0);
   SetChannelVolume (1,volume);
   while (volume<255) {
   volume=volume+3;
   SetChannelVolume (1,volume);
   Wait(1);
   }

in "Player enters screen (after fadein)" to fade in the ambience channel (rain starts falling).
It works basically, but there are artifacts introduced while doing this (listen to it here (http://www.strazer.net/ags/ambprob.ogg)).

I had the same problem when trying to use a slider to set the ambience channel volume in my settings gui (with another ambience sound).
The sounds are uncompressed wave files, I use AGS 2.6 SP1, Win2k & SBLive! 1024 Player.

Strangely, this affects the ambience sounds only.
Does anyone else have this problem?
Title: Re:Ambience volume change produces sound artifacts
Post by: Pumaman on Sun 08/02/2004 12:23:20
If you try using another file type (eg. mp3/ogg), does it still happen?

And conversely, if you use uncompressed wave for music, does the problem occur if you try to change the music volume?

The reason I ask is that SetChannelVolume doesn't care whether it's being used on ambient sounds, music or whatever, it always does the same thing.
Title: Re:Ambience volume change produces sound artifacts
Post by: strazer on Sun 08/02/2004 17:14:08
QuoteIf you try using another file type (eg. mp3/ogg), does it still happen?

Yes.

QuoteAnd conversely, if you use uncompressed wave for music, does the problem occur if you try to change the music volume?

According to the manual "Changes the currently playing background music to MUSICx.OGG, MUSICx.MP3, MUSICx.MID, MUSICx.MOD or MUSICx.XM", so using a wave file plays no music at all.

But using SetChannelVolume on the music channel (MP3) produces no artifacts, no.

QuoteThe reason I ask is that SetChannelVolume doesn't care whether it's being used on ambient sounds, music or whatever, it always does the same thing.

Not here.  :(

Btw, I tried it with increments of 1 instead of 3 too, same thing.
Title: Re:Ambience volume change produces sound artifacts
Post by: Pumaman on Sun 08/02/2004 17:39:03
Could you upload the ambient sound file that causes the problem? I tried out your script code in a test game, and it worked without problems.
Title: Re:Ambience volume change produces sound artifacts
Post by: strazer on Sun 08/02/2004 17:43:26
It's the same behaviour with other sound files.
But here it is (http://www.strazer.net/ags/sound12.ogg).
Title: Re:Ambience volume change produces sound artifacts
Post by: Pumaman on Sun 08/02/2004 17:51:28
Hmm yeah, I tried it out and it sounded fine.

If you try changing your digital sound driver in setup to WaveOut rather than DirectSound, does that help?
Title: Re:Ambience volume change produces sound artifacts
Post by: strazer on Sun 08/02/2004 17:55:17
No, same thing.
Anyway, if it works at your comp, it probably will on all others too.
So I'll go with the code.

Thank you!
Title: Re:Ambience volume change produces sound artifacts
Post by: Pumaman on Sun 08/02/2004 18:55:54
Yeah, it is rather bizarre though. Has anyone else experienced anything like this?