How do I add audio?

Get help using Construct 2

Post » Mon Mar 02, 2015 6:42 pm

In the game I am creating, I want music to play in the background. I followed the manual on how to import it (it is the right file type). I then imported it, and created an event that would start it (after adding the audio to the object types). But, upon the event happening, the audio did not start playing. Assuming it had something to do with it not being pre-loaded, I saved it again, but as a sound file (with pre-load, I would assume it would wait (and not run) until the file was fully loaded). But, it started up normaly, and when the event happened, the audio did not start playing.

How do I get audio to work with my game?

Note: It might have to be with the browser it runs in, but I can't test if it is right now (public computer).
B
3
Posts: 2
Reputation: 179

Post » Tue Mar 03, 2015 12:05 am

Can you upload your capx?
Image
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,145

Post » Tue Mar 03, 2015 12:46 am

Can you share a capx?
B
71
S
20
G
10
Posts: 641
Reputation: 9,648

Post » Tue Mar 03, 2015 12:51 am

ok so basically to play a sound or music in your game, you have to have the sounds music files, in WAV format, not mp3 , and have bit rate of 16000 hz not 25.k not 8k 16-bit rate that's if u converse it with audacity ul have options in bottom left.
then c2 automatically converses them to 2 files 1 .ogg and 1 .mp4, the .ogg is for html5 browsers facebook etc the mp4 is for mobiles when u play audio u need to add the audio object and then call a condition when u want to play it lets say at start of game : when layout starts >audio|>play sound, your sound... and if u want to loop it loop it if not will play 1 time.

also when u run your game you have a game property saying preload sounds at startup , that means all sounds will be loaded when ur loading bar shows at startup so it does not lag ur game, during gameplay or menu show.
Image
B
57
S
16
G
64
Posts: 1,260
Reputation: 39,825

Post » Thu Mar 05, 2015 5:57 pm

I ending up fixing it; it was related to the fact that the game being run in IE. When I switched it Chrome, everything started working.
B
3
Posts: 2
Reputation: 179


Return to How do I....?

Who is online

Users browsing this forum: SnipG and 1 guest