Multiple Sounds At Once Issues

Hey,

For my upcoming game, Music Magic, I have to play up to 14 sounds at once. But the catch is, about .2 second later I have to play 14 sounds again... etc.

I have done some tests and see that GS just isn't up to handling this kind of sound producing. Are there any way around this? If I can't do this, iI'll have to forget about this idea, and I don't want to do that.

Any advice?
- Thomas

Comments

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

    @SnapFireStudios Hi, do you mean that the first 14 sounds (or some) are clipped by the second lot 0.2 of second later? You'll need to replicate the same sound i.e have more than one of each sound, so they can "overlap". It'll need a few Rules too, each of the sounds with an integer attribute, so they can be looped through the same set; if you see what I mean.

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

  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792

    @SnapFireStudios Hi, do you mean that the first 14 sounds (or some) are clipped by the second lot 0.2 of second later? You'll need to replicate the same sound i.e have more than one of each sound, so they can "overlap". It'll need a few Rules too, each of the sounds with an integer attribute, so they can be looped through the same set; if you see what I mean.
    Why replicate the sound? Just ticking the 'play to completion' box should be enough to make sure the sound doesn't get cut off. Unless I am misunderstanding you?
  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    @gyroscope @HoneyTribeStudios -
    So.. this is the same exact sound file being played at the same time by 14 actors, and then the sounds being player 14 more times by 14 more actors .2 seconds later, and again, etc.

    So two of the same sounds not be played at the same time?
    - Thomas
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @HoneyTribeStudio Hi Shaz, even with Play to Completion checked, a touch pressed or any other trigger will still cause a Play Sound audio file to start from the beginning again... unless i'm misunderstanding something now....

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

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    edited February 2013
    Here's some more info.

    There is a 14x14 grid, and I have an actor that goes across the scene with a move behavior. When it colides with the tile actors, they are supposed to make a sound, if they are toggled.

    But just to test I made half of them toggled so that it has to play 7 sounds about every .2 seconds. These sounds last about 1.5 seconds for reverb. Anyway, at first no sounds were made at all, but when I slowed down the bar they started being made, but in a very buggy way. Also, the sound quality was very bad on the ones that did play.

    Are there any ways to optimize this? I need to be able to use high tempos. Is it because it's done when it collides with the actor?

    Thanks,
    - Thomas

    EDIT: I got it to play, but it slows down the bar with the move attribute when it gets to the layer. I have to have this bar moving at a steady rate across the screen at all times.

    EDIT 2: If I check 'Play To Completion' it won't let me play the same sounds again .2 seconds later.. so I can't do that.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Hi @SnapFireStudios

    EDIT: I was typing a comment while you were typing, but I've deleted my comment now.....I'll read your comment and be back now you've supplied more info!

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

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    It is not the same file, it is different pitches generated out of GS imported as different files, because GS pitches are so glitchy.

    I'm going to do some testing, i'll get back to you.
    - Thomas
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Hi Thomas, You say you want sounds on collision, then you say you've given them a time constraint ("about every 0.2 seconds")

    As far as I understand from your description then, have your sounds triggered when colliding, but delete that time constraint, in other words, the sounds will play straightaway when colliding, and you don't need any other rules/behaviours there....

    Another thing to check: make sure the collision rules are in the tile actors, not in the moving actor.

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

  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    edited February 2013
    David, I still don't think Thomas should be using duplicate sounds.

    Trigger sound A (which last 1.5 seconds) at 0:00. Keep 'play to completion' ticked.
    Trigger sound A again at 0.02

    Both occasions of sound A being played will be correct. The sound won't be cut off. Pretty sure that's how it woks in GS from memory.

    Does using a move behavior and collisions keep accurate time? Not tried that but it sounds like a potentially unreliable way of doing it?

    Why not just use time references that relate to the game.time?

    As for the initial issue, is it a problem on the initial playing of sounds or every time? i.e did you have all the sounds play silently at the start of the scene to make sure they are loaded into RAM?

    Then when they are all loaded in you can start triggering them in-game without any stuttering issues.


  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013
    David, I still don't think Thomas should be using duplicate sounds.

    Trigger sound A (which last 1.5 seconds) at 0:00. Keep 'play to completion' ticked.
    Trigger sound A again at 0.02

    Both occasions of sound A being played will be correct. The sound won't be cut off. Pretty sure that's how it woks in GS from memory.

    Hey, thanks Shaz, you are correct! I think I was thinking of a keyboard key, whereby touching that twice, it would cut off the sound mid-play to play again. But now I see @SnapFireStudios is using the same sound triggered with two or more different Play Sound Behaviours (each one in a different actor). Cheers!


    Does using a move behavior and collisions keep accurate time? Not tried that but it sounds like a potentially unreliable way of doing it?

    Why not just use time references that relate to the game.time?

    As for the initial issue, is it a problem on the initial playing of sounds or every time? i.e did you have all the sounds play silently at the start of the scene to make sure they are loaded into RAM?

    Then when they are all loaded in you can start triggering them in-game without any stuttering issues.

    I'm thinking the stuttering is due to some type of time constraint which isn't needed, rather than letting the play sound behaviours just fire on collision....

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

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    edited February 2013
    So, now when I try to play 7 different sounds at once, in a timer as opposed to when they collide, it still slows down my moving actor because it has to take time to think about the sounds. Is there a way to make sure that my bar keeps on moving no matter what?
    Also, the sounds are still extremely glitchy. I guess GS's sound system just isn't able to cope with many sounds played one after the next, especially not without affecting the speed of other thing, like a move behavior.

    - Thomas
  • PixelMetalPixelMetal Member Posts: 283
    edited February 2013
    The stuttering is due to the mobile device simply not being able to handle that many sounds playing at once. I can't think of any occasions where playing that many sounds at once makes sense. If you have long sound files playing, you may run into the issue with fewer sounds than if the sounds were short clips.

    As for GS clipping the sound when it's repeated, that doesn't happen in my projects at all, and if sounds are getting cut off, it's probably due to the device running out of channels to play the sound and it's automatically killing the oldest sounds. That's just a guess, but that's how desktop sound devices have worked as long as I've used a computer (30-ish years) so I can't imagine anyone has reinvented the wheel for mobile.
  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    My app is basically a much better version of the ToneMatrix. http://tonematrix.audiotool.com/

    So.. is GS not able to handle this? I know that it's not the device, because some other apps do a great job of it. (Like Beatwave)

    Thanks for the help,
    - Thomas
  • PixelMetalPixelMetal Member Posts: 283
    I don't know that we've ever been told what the maximum sound files playing at once in GS is. Maybe ping @SaladStraightShooter to get an answer to that.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013


    As for GS clipping the sound when it's repeated, that doesn't happen in my projects at all, and if sounds are getting cut off, it's probably due to the device running out of channels to play the sound and it's automatically killing the oldest sounds. That's just a guess, but that's how desktop sound devices have worked as long as I've used a computer (30-ish years) so I can't imagine anyone has reinvented the wheel for mobile.
    For the record, (and as I described earlier) if the same Play Sound behaviour is retriggered before the sound hasn't completely finished playing - whether play to completion is checked or not - it'll stop playing, i.e be clipped, and restart. But the same sound can play at the same time if they are played from multiple Play Sound behaviours. Info just for any newer GSC users reading this...

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

  • PixelMetalPixelMetal Member Posts: 283
    edited February 2013
    Ah, that makes a bit more sense @gyroscope. Well, it doesn't make sense, but in that specific context I can almost understand the logic of why it would work that way in GS.

    Though if it's a ToneMatrix clone as @SnapFireStudios suggests, and the sounds are triggered by enabling each button, then that shouldn't count as the same Play Sound behavior, right? Because I have duplicates of the same rule on multiple objects and they don't cut each other off.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    edited February 2013
    @BlackCloakGS Could you offer some clarification on this? Given the typical kind of devices that GS games will be played on, what do you think is a reasonable amount of sounds that we can expect to be able to play at any one time? Lets assume we have really short sounds files, so overloading the RAM wouldn't be so much of an issue.

    Just to avoid wasting time with guessing games.

    But yeah, what @PixelMetal says sounds like a practical explanation.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Though if it's a ToneMatrix clone as @SnapFireStudios suggests, and the sounds are triggered by enabling each button, then that shouldn't count as the same Play Sound behavior, right?
    Sure thing, @PixelMetal , agreed :-)

    As far as I can gather from @SnapFireStudios each tile has it's own Play Sound behaviour, so being individual actors, it doesn't matter that some might call up the same sound file from their individual Play Sound behaviour.

    It sure would help more seeing the game file from @SnapFireStudios to be certain though.... ;-)

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

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    I'm going to run some more tests, and if I can't get it to work, i'll PM you the file @gyroscope.
    - Thomas
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    OK Thomas, best of luck in sorting it, but if not, you're welcome to send me a copy as you said, and I'll take a look for you and hopefully get it sorted.

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

  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    So I did a complete redo of the system, and I have it basically working.

    However, when I try to do different pitches according to y position, the notes play from bottom to top even though they are all being touched at the same time. The highest tile plays a fraction of a second before the the tile below that, and so on.

    Does GS do rules in actors from top left to bottom right or something?
    - Thomas
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    Inside the actors, the rules at the top play first.

    Then on the scene the actor at the bottom of the layers list has it's rules processed first. The actor at the top has it's rules processed last.
  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    edited February 2013
    Here's what I have in my tile actor:
    If overlapping or colliding with actor: Middle Bar, and attribute self.toggled is equal to 1, then play sound: TestSound.

    Then the volume is one, and the pitch is self.position.y/100. This gives me a good low and high note range. But then when they collide and are toggled, the top pitched one plays first

    @ HoneyTribeStudios all of my tiles are placed randomly and at different times, not necessarily from bottom to top or top to bottom. I have tested in different places in the grid also.

    Thanks for all the advice,
    - Thomas
  • SnapFireStudiosSnapFireStudios Member Posts: 1,603
    Turns out that the bug I was just describing doesn't actually happen on the device, so no problem.

    Thanks for all your help everyone, hopefully now everything will work as planned.
    - Thomas
  • bigsockbigsock Member Posts: 4

    Another work around. I have had similar troubles, the answer is to use a different kind of trigger. Using collision to trigger sounds only has maybe 3 or 4 polyphony and maybe 10 or so max polyphony when exported onto the device depending on the device. (in my tests anyway) In my project that has a billion snow flakes falling and I wanted a note triggered when each hit the ground I am using attribute self linear velocity >1 and having the snowflake bounce just a tiny bit when hitting the ground. Using this trigger yelds in hundreds of polyphony which is a big difference from 3 or 4 just by flipping out what triggers the sound. Hope this info helps others, there's always a workaround.

Sign In or Register to comment.