How do I play sound in the app?

  • Hi,

    I'm developing a game for iOS and android. In that, I added sounds for every screen but the problem is these sounds are not being playing unless and until I tap on the screen. Also after closing and reopening the game, I hear distortion in sound quality.

    I use Intel XDK to build the app. Please help, I'm not sure why this is happening.

    Thanks in advance.

  • Hey there,

    i haven't had to work with sounds yet in construct 2 but i did some searching, maybe these links can help you further:

    scirra.com/tutorials/181/ad ... ners-guide

    scirra.com/manual/109/audio

    scirra.com/manual/84/sounds-music

    youtube.com/watch

    Did you try adding the music on a system -> on start of layout?

    Maybe try it with a variable set on 1 and "on start of layout" + condition "if variable = 1" play your track? If it should loop you can try putting/setting the variable somewhere else.

    I've only been trying out construct 2 for a few days now so i don't have much experience in it either, but i hope this could help you in one way or another so you can find a solution to your problem.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    I'm developing a game for iOS and android. In that, I added sounds for every screen but the problem is these sounds are not being playing unless and until I tap on the screen. Also after closing and reopening the game, I hear distortion in sound quality.

    I use Intel XDK to build the app. Please help, I'm not sure why this is happening.

    Thanks in advance.

    The distortion is a bug on iOS only and there is a workaround fix in the v223 beta which was released yesterday.

    Also all sounds you import in the sound folder will be played with no problem. Only when you have music imported in the music folder you always need a on touch end event for it to be played.

    In my project I have only one small music loop for the background music. I just imported the music in the sound folder as well. Works instantly.

  • horoblast Thanks for links. Yes, I added the music on start of the layout and it is in loop. When I run the game on my computer, It is working fine. Every sound is being playing according to the requirement but when it was run on my phone, the sounds aren't being played until and unless I tap on the screen. I'm not sure where it when wrong.

  • Kraudi Wow, thanks. Your suggestion has directly answered my query. I will try it right away. And yes, I imported all the sounds into the music folder. Now, I will import them in the sound folder and run the game.

    I will let you know what has happened.

    Thanks again.

  • horoblast Thanks for links. Yes, I added the music on start of the layout and it is in loop. When I run the game on my computer, It is working fine. Every sound is being playing according to the requirement but when it was run on my phone, the sounds aren't being played until and unless I tap on the screen. I'm not sure where it when wrong.

    Huh, that's odd... hopefully you were able to fix your issue using the other person's help.

    If not, maybe these links can provide some help:

    no-sound-in-android-cordova-with-xdk-1912-export_t130051

    stackoverflow.com/questions/1044 ... ame-engine

    .

  • horoblast Sure, my friend. Thank you so much for your help.

  • Kraudi Thanks a lot man. Now, I don't any issues with the sounds. They are being played on the start of layout without any user interaction. But for some reason only one sound is not being played. It is playing fine on the desktop and android versions. Below is how I defined the evens

    On start of layout ->

    IF -> has bonusLife -> Play Sound 1

    If -> Game over -> Play Sound 2

    The sound 2 is not being played even though the game is over. I find this issue only on iOS.

    Please help.

    Thanks.

  • Kraudi Thanks a lot man. Now, I don't any issues with the sounds. They are being played on the start of layout without any user interaction. But for some reason only one sound is not being played. It is playing fine on the desktop and android versions. Below is how I defined the evens

    On start of layout ->

    IF -> has bonusLife -> Play Sound 1

    If -> Game over -> Play Sound 2

    The sound 2 is not being played even though the game is over. I find this issue only on iOS.

    Please help.

    Thanks.

    Do you have *.m4a files for both sounds? iOS needs those. Maybe that's the case. Otherwise I don't know why it shouldn't work.

  • Kraudi

    Yes, I have .m4a and also .ogg files for all sounds. I don't understand why it isn't working properly.

  • Kraudi

    Removing and re-adding the sound has solved the issue. Thanks for your help.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)