is it possible to fade sfx in/out at the individual sound level?

old_kipperold_kipper Member Posts: 1,420
I have a problem after trying to change volume in an individual sound level. The global is no problem, but not much use in this case as I want to use rules to switch out a sound but have to keep it in sync with a new sound.

thanks

kipper

Comments

  • PhoticsPhotics Member Posts: 4,172
    I'm not sure what you're trying to do.

    Maybe use more than one attribute to create channels...

    game.Sound * game.Channel.1

    So if game.Sound is 1 and game.Channel.1 is 1... then the sound is played at maximum value,
    If the game.Sound is .5 and the game.Channel.1 is .5... then the sound is played at .25
    If the game.Sound is 1 and the game.Channel.1 is 0... then the sound is played at 0
  • old_kipperold_kipper Member Posts: 1,420
    Hi Photics, what I am trying to do is play a long sample that syncs with movement of an object and is fired at the start of the movement pass with the motion, but during the long pass an event could happen that would need for the sound to be temporally dropped out but returned when the the event is over. because the sample I want to drop out is very much synced to the movement I can't just fire it again, and as it is a four second loop and the interruption could happen at any point I can't make short sections to cover a stop and then resync it with the movement. I know it sound a bit weird but it is an odd case.

    I have tried referencing a level from an attribute (I checked with a text display object to make sure it was changing), from the volume of the sample in the actor but this seems only to apply at the start of the playing of the sample...

    As I say, the global is useless in this case, and If I could split the sound across the music and sound channels I wound but I have music as well...

    any thoughts?

    thanks

    kipper
  • PhoticsPhotics Member Posts: 4,172
    old_kipper said:
    any thoughts?

    The two attribute trick doesn't work for you? From the way I understand the problem, it seems like it should.

    game.sound is a global sound volume (It can be like game sound preferences.)
    game.channel.1 is a group that can be controlled separately.

    When you want to fade the sound of the channel 1 sounds... just interpolate that attribute to zero. The sound should keep playing... without any sound though... and then interpolate back to 1 to make the sound heard again.

    Maybe I'm not being clear enough...

    In the volume section of the play sound behavior, two attributes are placed there...

    game.sound * game.channel.1

    The asterisk means multiplication... game.sound times game.channel.1
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    I think I get what you're after, kipper; for the sound to drop to zero but still play on, then after a certain time, volume is back again?

    Then surely your global attribute (or a scene attribute) should work just fine.

    So in your play Sound Volume, put the boolean attribute, SoundAVol for instance. When your certain events happen, make SoundAVol either 0 or 1 accordingly.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • old_kipperold_kipper Member Posts: 1,420
    Photics, I am sorry... I am being thick (as usual, but have just done a very long stint at this machine). I miss this channel thing somewhere down the line.

    So when you place a sound in an actor you can set it to a channel... by adding the string

    game.sound * game.channel.1

    then to alter that channel you address it through something like

    change attribute game.sound0.2 game.channel.1 to drop it from 1 to 0.2?

    I am sorry about this.

    kipper
  • old_kipperold_kipper Member Posts: 1,420
    gyroscope said:
    I think I get what you're after, kipper; for the sound to drop to zero but still play on, then after a certain time, volume is back again?

    Yes but with another sound as a sound rather than a music so I can't use the total game sound volume.
    gyroscope said:
    Then surely your global attribute (or a scene attribute) should work just fine.

    Photics' pointing at game channels for sound is getting me all excited.

    But I am more confused.. Where's gyro's post gone?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Whoops, sorry kipper, I deleted cos I thought it wasn't relevant any more...

    Hope Photics suggestion works out for you! :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • PhoticsPhotics Member Posts: 4,172
    old_kipper said:
    Photics, I am sorry... I am being thick (as usual, but have just done a very long stint at this machine). I miss this channel thing somewhere down the line.

    So when you place a sound in an actor you can set it to a channel... by adding the string

    game.sound * game.channel.1

    then to alter that channel you address it through something like

    change attribute game.sound0.2 game.channel.1 to drop it from 1 to 0.2?

    Do you have The Unofficial GameSalad Textbook? When I first started posting, I thought that you already had it.

    So... I'll start over and I'll assume that you don't have the book.

    With my GameSalad games, I like to create a game attribute called game.sound. Then, whenever I use the "Play Sound" behavior, I put the game.sound behavior in the volume field. That way... if I want to decrease the volumes of all sounds, I simply use the "Change Attribute" behavior... or I can use Interpolate to create a fade in/out effect.

    From the way I understand the scenario, I think that's all you need. You can create channels by creating different attributes.

    If you want to combine both — a global volume control and volume groups (channels) that's where the multiplication enters the picture.

    If I want the whole game volume to be at 100% volume, I set game.Sound to 1.
    If I want to set "Channel 1" Sounds to 50%, I set game.Channel.1 to .5

    So... 1 x .5 = .5 ...or 50%

    In your scenario, you want to silence one set of sounds.

    So... 1 x 0 = 0 ...or mute sound.

    By using attributes to group your actors, you can create "Channels". Rocks could use the Channel.1 attribute and Wooden Blocks could get the Channel.2 attribute. So if your character suddenly got a shield that reduced damage from rocks by 50%, Channel.1 could be set to .5.

    It's just a theory. I haven't tested it. I haven't actually had a need to group GameSalad sound effects yet.
  • old_kipperold_kipper Member Posts: 1,420
    HI Photics. thats what I've done... But the volume levels out of an attribute just don't update a playing sample. I think it may be a case like a random number inside a rule not changing after a first firing which somebody mentioned on here.

    Thanks anyway.

    kipper

    p.s. I do have your book and a have used it usefully, Thanks. It's been good reference for stuff and helped out a lot.
  • PhoticsPhotics Member Posts: 4,172
    old_kipper said:
    But the volume levels out of an attribute just don't update a playing sample.

    Are you sure about that? A live example is the sound volume slider in BOT. It can change the volume of the sound while the sound is in play.
    old_kipper said:
    p.s. I do have your book and a have used it usefully, Thanks. It's been good reference for stuff and helped out a lot.

    Great! I'm happy that the textbook was helpful to you :)
  • old_kipperold_kipper Member Posts: 1,420
    Is your game live volume slider addressing the game global sounds or individual sounds?
  • PhoticsPhotics Member Posts: 4,172
    old_kipper said:
    Is your game live volume slider addressing the game global sounds or individual sounds?

    The Play Sound behavior is using the game attribute I created for sound volume.
  • old_kipperold_kipper Member Posts: 1,420
    simple question... With your system can you cross fade 2 long samples while they are playing, with neither as a music file? This is the test I think. I would love to know if you have time.

    cheers kipper
  • PhoticsPhotics Member Posts: 4,172
    old_kipper said:
    simple question... With your system can you cross fade 2 long samples while they are playing, with neither as a music file? This is the test I think. I would love to know if you have time.

    I haven't done it, but I think cross-fading is possible. Music can be imported as sound files... and then each can have their own sound channel attribute... one fades out while the other is faded in... or they could be played at the same time.

    ...but with large sound files, I'm thinking that might create memory/loading issues.

    ...also, you could mix it... one sound file could be imported as a music file and another imported as sound. With BOT, the sounds played while adjusting the sound volume is actually a music loop. I just imported it as a sound file, in order to have greater control over the volume.
  • old_kipperold_kipper Member Posts: 1,420
    The issue is that I have a music backing in the music channel and I want to just cross fade the sample fx. I wouldn't lay money on it but I have not been able to find a way. When the TOTB3 is done I'll do a real test (just spend 3 hours playing with it and no luck).

    Please do let me know if you find it is possible. I just can't think how.

    kipper
  • PhoticsPhotics Member Posts: 4,172
    I just ran a test... worked fine...

    Imported one music loop as a sound.
    Imported another music loop as a sound.

    I put two "Play Sound" attributes on a single actor.

    One Play Sound has game.Channel 1 as an attribute for volume.
    The other has game.Channel 2 as an attribute for volume.

    I created a rule... if the key "1" on the keyboard is pressed, interpolate game.Channel 1 to 1
    Otherwise... interpolate to 0.

    I created another rule... if the key "2" on the keyboard is pressed, interpolate game.Channel 2 to 1
    Otherwise... interpolate to 0.

    I was then able to fade in and out songs by pressing keys on the keyboard. They would play continuously... even if the volume is set at zero.
  • old_kipperold_kipper Member Posts: 1,420
    its 2 in the morning here and only 10 hours of totb time. My thinking isn't clear (understatement) and got an awful lot to do.

    but thanks. will see you when I surface....

    kipper
Sign In or Register to comment.