GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Fade in/out individual sounds.

okay so i have a game where enemies makes breathing sound and footstep sounds, so the closer i get to the enemies, the louder the foot steps and breathing sounds get. If i mess with game.audio.soundvolume it lowers all the sounds of the game. How can i fade in/out individual sounds. my enemies track the main character x/y location, i got that far, but don't know how to fade in/out the enemies sound.

Comments

  • pHghostpHghost London, UKPosts: 2,283Member

    The volume of each sound can be an expression, so use that, in the Play Sound action.

  • JapsterJapster Posts: 642Member, PRO

    Armelline did a great video on this @geoascencio - Here you go...

  • geoascenciogeoascencio Posts: 13Member

    @Japster I've followed the video tutorial but when the scene starts, the audio is in full volume. It isn't until the actor gets to the point where you should start hearing the audio (the point where the audio would be at it's lowest volume), then it's starts working perfectly and starts acting the ways it's supposed too. This only happens when the scene starts. I'm working in the windows version of game salad, so maybe that might be the problem, but maybe I'm doing something wrong.

  • ArmellineArmelline Posts: 4,619Member, PRO
    edited October 2017

    @geoascencio Can you show us the logic you're using to control the sound volume? It sounds like maybe the sound is being triggered before the attribute that controls its volume is set. I just tested and can confirm that attributes are applied to the sound volume immediately upon scene start, so it's possible the volume control is in an actor higher on the layer list than the sound?

  • geoascenciogeoascencio Posts: 13Member
    edited October 2017

    @Armelline thank you so much for helping! I'm trying to figure out how to post images on the forum to show you what i got.
    https://imgur.com/PWKG6in
    https://imgur.com/8F4DZPw

  • pHghostpHghost London, UKPosts: 2,283Member

    I think the problem is that you start too far, and at those distances the calculation you use gives a negative number. As that is an invalid entry, the sound volume will stay at 1 instead. Later on, if you reach that distance, the volume has already been reduced, so it stays at that instead, and it works.

    I'd suggest wrapping the whole expression into a MAX function --> max(0,[your calculation])

    That way, the expression will never give you a number lower than zero and it should all work fine all the time.

  • geoascenciogeoascencio Posts: 13Member

    @pHghost IT WORKS!! The MAX function did it! @Japster @Armelline thank you guys so much!

  • ArmellineArmelline Posts: 4,619Member, PRO

    Glad you got the problem sorted! @pHghost was too fast for me :D

  • pHghostpHghost London, UKPosts: 2,283Member

    Glad to help. Good luck with the game!

Sign In or Register to comment.