License from €75 Log in
DE EN FR ES IT CZ

Changing volume of the walking sound dynamicly in the game...

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 9 years ago
    Hi mates, is it possible to change the volume of the walking sound dynamicly in the game. I want to change the volume according to the scenes.

    Cheers
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 9 years ago
    Hey, 

    do you have one walking sound set inside the characters outfit or already use single step sounds inside the animation frames where the characters feet meet the ground?
    You could easily put some "if/else"  around the "playsound" action parts to play the sounds in different volume or even change the played sound for different locations. 

    This can come in handy, if you need to switch the walk sounds mid scene for example when the character walks from a dry ti a wet ground surface. For this you can use the action areas. 

    =) 

    ~Sebastian 
  4. · 9 years ago
    But how I can change the volume mate? I have couple of different walking sounds for different environments, I use "change walking sound of the character" comment. There is no volume control for it :\
  5. · 9 years ago
    Checkout this tutorial. Here they play differerent sounds, but you can change that to different volumes.

  6. · 9 years ago
    Play the files with LUA

    local soundID = startSound('vispath:assets/footsteps.mp3')
    setSoundProperty(soundID,{volume=70})
  7. · 9 years ago
    Thank you so much Trepn!
  8. · 9 years ago
    I would definitely say Lua is probably the best way to go if you are wanting to dynamically change the footstep type & volume on a per scene basis as you will need Lua tables to organize the sounds/point of origin for each scene.

    As trepn says, you can play sounds with the openAL Lua function. Lebostein's tutorial that he linked would likely be a good place to start, though that's an action part solution only. If you want to dynamically control the balance & volume levels then Lua script is needed.

    -- example of a Lua table containing some footstep sounds
    sndz = {}
    sndz["wood"] = 
    {
     "vispath:sounds/footsteps/wood_1.ogg",
     "vispath:sounds/footsteps/wood_2.ogg",
     "vispath:sounds/footsteps/wood_3.ogg"
    }
    sndz["metal"] = 
    {
     "vispath:sounds/footsteps/metal_1.ogg",
     "vispath:sounds/footsteps/metal_2.ogg",
     "vispath:sounds/footsteps/metal_3.ogg"
    }

    -- example of playing a footstep sound with a dynamic volume value
    startSound(sndz[Values["ground_type"].String][math.random(3)], {flags=1, volume = math.random(75, 100)})

    In the example above I've assumed that a value inside of the editor has had a string value written to it which will be used to determine the ground type - metal, wood, concrete, debris, stones, rock, fauna, etc. & from that we call a random number (technically we could dynamically get the total table index count for the table with Lua rather than manually declaring the number) & then we dynamically set the volume between 75 & 100 so that each time a sound is played, even if it's the same sound it will sound different because the volume level will be different.

    Balance is a lot more complicated to give an example of because it's highly dependent on what sort of perspective view point you use for your game. Traditionally 2D games tend to use the same perspective style for most scenes so they don't need to create tons of character animations from different perspective points. 3D is a lot different because the camera can change position. Anyway, the next thing is figuring out if the balance should be based on the characters/cameras position from a specific source point or whether the balance should be based on the characters position which means footsteps will always be centered, but all other sounds will be affected based where the character is from them.
  9. · 9 years ago
    Thank you so much Lee! I think it will do the job!

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?