How to find out when a sound ends?

Is there anyway to find out when a sound ends?

For instance, if I want to play sound A... and when sound A is finished, then sound B and then when sound B ends, play sound C...

Is that possible? Is there anyway to set an attribute upon sound completion?

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    @ookami007 said:
    Is there anyway to find out when a sound ends?

    For instance, if I want to play sound A... and when sound A is finished, then sound B and then when sound B ends, play sound C...

    Is that possible? Is there anyway to set an attribute upon sound completion?

    There is no 'when sound ends' behaviour, but you can simply take the length of the sound and use a timer to trigger the next sound once the first has finished.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Hi @ookami007 I think a lot of GSC users (myself included) would love to have the ability to find out the length of any sound or music in GSC - but it's still not possible, unfortunately. (Maybe one day?)

    So the only way to get this info is to open the sound file in an audio editor, or sequencer like GarageBand, etc., write down the length then, back in GSC, you can user a Timer set to After for the next track to play. (Adding up the time lengths as you go, for subsequent audio to play). Hope that helps.

    Edit: @Socks beat me to it... :-)

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

  • ookami007ookami007 Member Posts: 581

    This is unfortunate. I guess I would need to have a table with all the sounds and all their lengths and then setup an additional table with the sounds the user picks... then as they are played, keep track of the time and set an attribute when it's time to switch to the next sound.

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2014

    @ookami007 said:
    This is unfortunate. I guess I would need to have a table with all the sounds and all their lengths and then setup an additional table with the sounds the user picks... then as they are played, keep track of the time and set an attribute when it's time to switch to the next sound.

    It really isn't that complicated, no real need for tables or attributes or for '[keeping] track of the time' !? (although you could do that if you wanted to).

    I'd simply play sound A - then place sound B in a timer to start when sounds A ends, then place sound C in a timer to start when sounds B ends . . .

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @ookami007 said:
    This is unfortunate. I guess I would need to have a table with all the sounds and all their lengths and then setup an additional table with the sounds the user picks... then as they are played, keep track of the time and set an attribute when it's time to switch to the next sound.

    This is what I've done. It works great but does require the sound lengths to be entered as table data.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ookami007ookami007 Member Posts: 581

    @Socks said:
    I'd simply play sound A - then place sound B in a timer to start when sounds A ends, then place sound C in a timer to start when sounds B ends . . .

    That's only true when you have a set order for the sounds and you play the same sounds in exactly the same order. If the order is different every time... say, a roar and then a fireball one time and then a scream and a fireball the next time... you will need a table.

Sign In or Register to comment.