How to fade a playing sound via lua

  • #1, by marvelTuesday, 17. December 2013, 15:17 7 years ago
    Hi community,
    i'd like to fade a playing sound via lua. In my case a sound is played during a conversation. When the conversation is over, the sound has to fade to zero and stop.

    How could that be done? smile

    Key Killer

    598 Posts


  • #2, by afrlmeTuesday, 17. December 2013, 16:23 7 years ago
    actually as a thought I was going to say that you could actually use the jump to action part to create a loop & then have it gradually reduce the volume of the sound by x but having just checked the change settings of a sound action part I noticed there is no option to affect sound by a multiplier value, only the sliders exist.

    the best method (when next release of VS comes out) would be to use the new lua audio commands to start & control the playing sound. the new player commands are already listed on the new vs wiki (with example code) for anyone who is interested in taking a look.

    essentially you would start off with the startSound() command to setup a sound & then you would use the getSoundId() to get the sound id value so that you can use that to control the settings of the sound in the setSoundProperty() command.

    ----

    http://wiki.visionaire-tracker.net/wiki/GetSoundId
    http://wiki.visionaire-tracker.net/wiki/GetSoundProperty
    http://wiki.visionaire-tracker.net/wiki/SetSoundProperty
    http://wiki.visionaire-tracker.net/wiki/StartSound
    http://wiki.visionaire-tracker.net/wiki/StopSound
    http://wiki.visionaire-tracker.net/wiki/ToggleSoundPause

    here is the link to the page containing all player commands: http://wiki.visionaire-tracker.net/wiki/Player_Commands & here is the link to the common commands page: http://wiki.visionaire-tracker.net/wiki/Common_Commands

    I've just linked these here as reference for anyone who is interested.

    Imperator

    6842 Posts

  • #3, by NovelSaturday, 21. December 2013, 23:26 7 years ago
    actually as a thought I was going to say that you could actually use the jump to action part to create a loop & then have it gradually reduce the volume of the sound by x but having just checked the change settings of a sound action part I noticed there is no option to affect sound by a multiplier value, only the sliders exist..


    I'm not sure if I get you right here, but I actually implemented a fading out like that. See screenshot. I connected a value "fader" to the decrease of volume and the speed is defined by the pause inbetween.

    Newbie

    100 Posts

  • #4, by afrlmeSunday, 22. December 2013, 00:02 7 years ago
    yeah globally you can fade out music/sound etc but you can't fade out a single sound.

    in the upcoming release you have 2 new additional sound options to control; these being: "movies" & "global". global is good because you can fade out all sounds in one go or set a global volume level while stil being able to control the other 4 sound options.

    Imperator

    6842 Posts

  • #5, by NovelSunday, 22. December 2013, 22:22 7 years ago
    Ah, I see! Looking forward to the next version then. smile

    Newbie

    100 Posts

Write post