How do I play sound in the app?

Get help using Construct 2

Post » Tue Feb 23, 2016 7:16 am

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.
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Tue Feb 23, 2016 8:05 am

Message: horoblast can only post plain text URLS until they have 500 rep. 4 URLS modified. Why?
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:

https://www.scirra.com/tutorials/181/ad ... ners-guide
https://www.scirra.com/manual/109/audio
https://www.scirra.com/manual/84/sounds-music
https://www.youtube.com/watch?v=l0704tPAeEA

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.
B
6
Posts: 50
Reputation: 367

Post » Tue Feb 23, 2016 8:27 am

sudeep98 wrote: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.
Working on "EVERBLAST"
Image
B
31
S
6
Posts: 221
Reputation: 2,837

Post » Tue Feb 23, 2016 9:07 am

@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.
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Tue Feb 23, 2016 9:11 am

@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.
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Tue Feb 23, 2016 2:46 pm

Message: horoblast can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
sudeep98 wrote:@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
http://stackoverflow.com/questions/1044 ... ame-engine

.
B
6
Posts: 50
Reputation: 367

Post » Tue Feb 23, 2016 9:02 pm

@horoblast Sure, my friend. Thank you so much for your help.
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Wed Feb 24, 2016 10:58 am

@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.
B
24
S
7
Posts: 337
Reputation: 2,224

Post » Wed Feb 24, 2016 11:58 am

sudeep98 wrote:@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.
Working on "EVERBLAST"
Image
B
31
S
6
Posts: 221
Reputation: 2,837

Post » Wed Feb 24, 2016 5:18 pm

@Kraudi
Yes, I have .m4a and also .ogg files for all sounds. I don't understand why it isn't working properly.
B
24
S
7
Posts: 337
Reputation: 2,224

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 38 guests