Jump to content


Photo

sound_volume not working on wav


  • Please log in to reply
5 replies to this topic

#1 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 09 June 2012 - 02:09 PM

I'm having trouble getting sound_volume to work at all. To test it out I put this in the Create event:

sound_loop(Music);

Then in a press return key event I have this:

sound_volume(Music,0);

But I just can't seem to be able to change the volume. I've tried different volumes, different ways of doing the code but I just can't get it to work. I did some searching first and the common problems don't seem to apply here, the sound is a wav that I've imported into GameMaker and is a "Normal sound".

#2 AhmedElyamani

AhmedElyamani

    Yamani

  • GMC Member
  • 1583 posts
  • Version:GM:Studio

Posted 09 June 2012 - 03:04 PM

there must be an error in that event , what is the return key anyway?
try it with another event and see what happens Posted Image
Ahmed.
  • 1

#3 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 09 June 2012 - 03:10 PM

I don't think it's a problem with calling the sound_volume itself since I've tried a few different ways, I've even tried calling the sound_volume immediately after playing the sound like below. It just does not seem to take any notice of sound_volume.

sound_loop(mAmb);
sound_volume(mAmb,0);


#4 Lemon Flavor

Lemon Flavor

    The Helpful Lemon

  • GMC Member
  • 135 posts
  • Version:GM8

Posted 09 June 2012 - 03:37 PM

Its because you already started the sound at a volume of 1, and you can't change it while the sound is playing. You have to stop the sound and play it again every time you change the volume.
  • 1

#5 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 09 June 2012 - 05:38 PM

In another of my games I can change the sound_volume of a sound that's playing. I use it to create sound that gets louder as the player gets closer. The way I do it is I play the looped sound at the start of the room and immediately set the volume to 0. Then I have code in a separate object that sets the sound_volume based on how close it is to the player. This works fine in the other game, but not in my current game which is strange because it's a simple technique.

#6 Hello Darren

Hello Darren

    Pirate

  • Banned Users
  • 275 posts
  • Version:Unknown

Posted 10 June 2012 - 09:08 AM

Okay so I switched the sound for another and got it working perfectly for that, the problem seems to be whenever I save a wav through Audacity. The wavs I download from music resource sites work fine so there must be a wrong setting in Audacity, I'm guessing it's the encoding but I don't know anything about them. These are the encoding options, does anybody know which one I should be using? I've been using the "Signed 32 bit PCM". The default was "Signed 16 bit PCM" but it made them sound very tinny in GameMaker.

Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users