Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Attach sound effects to objects — Gideros Forum

Attach sound effects to objects

billydbbillydb Member
edited September 2015 in General questions
Anybody have any tips on how to go about making sound fx fade as the object generating them move off screen?

I'm creating a platformer with various moving objects that I want to clang bang and woosh but how to make the sound fade as they get further away from the player? Currently it would just be a cacophony of noise.

My solution so far would be to make a list of those objects and there related sound effect and measure there distance from the player per frame and change the volume on each accordingly. Not a major deal but seems like a big hack.

Any hints would be a big help

Thanks

Comments

  • I think that your approach is what you need to do for the effect you want to achieve, perhaps instead of using a list, you could try checking directly in your objects (let them check it for you when their position is updated).

    One single list will have the advantage of using only one enterframe check, but you also need to keep the list updated.

    I believe it's easier to make the check inside the objects class, because they're already going to be placed and removed, and they already "know" their position.

    The only side effect on this approach would be if you have too many objects together on screen: too many contemporary checks risk affecting performance, but how much is "many" all depends on your code :)

    From my experience stick to WAV files if they need to be played instantly, and use mp3 just for a bg music that doesn't need to be in sync with the game.
  • Thanks very much pie. Good to here my crazy ideas arent always that crazy. Seems like a big thing missing from Gideros though and i was suprises not to find anyone else asking.

    This is my first solo project so not had to deal with sound before but it seems like an essential ingredient to be able to have sounds that are placed in the world (not even sure how to phrase that) rather than everything sounding as if it's right next to you.
  • When XMP compatibility was added in the last release it also added an extra 'mixer' with direct control of an extra 64 'voices' that are addressable by number (1-64).

    I don'\t know if this bit of the api had been added yet though, @hgy29 will be able to help you more with that.

    The extra mixer can also control the panning control for each of the voices - so you should be able to have your object move in from one side of the screen and move off the other and the audio follow it. There would be a max of 64 object that would be able to do this on screen at any one time.

    Like I said though, this might have not been added yet.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
Sign In or Register to comment.