Audio Issue

Get help using Construct 2

Post » Wed Feb 22, 2012 12:00 pm

I have an audio issue (on chrome) imported wav music (around 3 minutes) on start of layout play looped.

No other sound gets played after that! The strange thing is that if I do the same thing on the first layout it works, I can't post the capx because it's a finished game for the competition, I would like to know if this is a know issue or if there are thing I should know about this.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Feb 22, 2012 12:31 pm

I also found out the if the game goes into game over (which stops the music) and you start again this time both music and sounds works.. why?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Feb 22, 2012 12:42 pm

1/ don't forget to tag your sounds when you launch them (I always do that)
2/ sounds are kinda global, if you launch a sound and you restart the layout the sound won't stop. In your case you can do

[code]System: On start of layout
Audio: stop sound tag "music"
Audio: play sound tag "music"[/code]
This way you're sure the music isn't played twice

If you don't want to restart the music but let it play without duplication you should use a global number
[code]Global number music = 0
System: On start of layout
System: music = 0
-> Audio: play sound looped tag "music"
-> System: set music to 1[/code]
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Feb 22, 2012 2:57 pm

I did everything you suggest, I have to find out, my game has a lot of "code" and at the current state debugging with construct is not easy.. It's very strange though, I have to look into this..
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Feb 22, 2012 4:26 pm

I found out the problem which I think it's a bug @AShley please shed some light.

After excruciating tests I found out the following.

The music gets started BEFORE any other sound (the song is in the music folder). Sound do NOT get loaded until the song finishes to stream. This is the reason why the title song (which is only 20 seconds long) do not create this behaviour. I'm using the latest (stable) chrome.

I fixed this by moving the music in the sounds folder, but it's hackish since this way people will have to wait until the song streamed before hearing it.

Solutions (apart from preloading)?
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Feb 22, 2012 4:33 pm

I don't have that kind of issue on cubemaze. The main music (kinda weird sound that appears progressively) and the woosh in the intro are in the music folder, and the other sound plays nicely.
Also, if you test on localhost, the downloading phase should be pretty fast so following your hypothesis, the sound in the sound folder should plays after like 2 or 3 seconds.
Try to create a test capx the best you can with sound and if you can reproduce your bug, send it over here (:
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Feb 22, 2012 4:36 pm

Ok, I'll try to recreate the error in a new capx, thanks
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Thu Feb 23, 2012 3:54 pm

@Yann

I'm trying to get a sound to play on start-up on an iPad.

I used your following code:

Global number music = 0
System: On start of layout
System: music = 0
-> Audio: play sound looped tag "music"
-> System: set music to 1

It works fine on browsers but wont work at all on iPad. The only way I know to get sound to work is to attach a button or something that triggers the sound to play. Do you know why this is and is there a solution?
B
5
S
1
G
1
Posts: 111
Reputation: 1,122

Post » Sat Feb 25, 2012 12:21 am

The mystery continues..

This bug applies ONLY to chrome.
I don't understand the reason, but you can try this. Import 2 songs. As soon as the first layout starts play the first one. Then as soon as the user clicks somewhere take him to another layout stop the first song and start the other. ALL subsequent sounds will not play until the song has finished streaming! This, I repeat only in chrome every other browser doeasn't do this.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Sat Feb 25, 2012 1:36 am

@0plus1: then you should report this bug to chrome.Kyatric2012-02-25 01:36:48
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Next

Return to How do I....?

Who is online

Users browsing this forum: davides, Walessio and 24 guests