sound in construct

For questions about using Classic.

Post » Thu Mar 03, 2011 2:49 pm

How do i add a sound file in my game? & let it play continually?

My current sound file is 29 mb big; will construct take such big file?

(Sorry if i ask many questions) There is so many i still need to know :lol:
B
3
G
2
Posts: 40
Reputation: 780

Post » Thu Mar 03, 2011 2:55 pm

You might want to check out the wiki - [url:1b1c4i2d]http://sourceforge.net/apps/mediawiki/construct/index.php?title=XAudio2_Object[/url:1b1c4i2d]
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,840
Reputation: 48,281

Post » Thu Mar 03, 2011 4:48 pm

Right click to insert the Audio2 obj into your layout.At the bottom right hand corner there's a tab called project ,Go to the files folder and right click on it.Add the music or sound file to that folder.

Events sheet
Go to system , Start of layout , Autoplay resource.The file you inserted into the files folder earlier should be there.Now if the game starts the music should start automatically.For music files use mp3,for Sound files use wav sounds.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Thu Mar 03, 2011 5:17 pm

Hi,
I'm currently having trouble with Xaudio : a simple problem : NO SOUND

I tried everything :
- wav, ogg, mp3
- autoplay file (AppPath & "mysound.wav" with my .wav next to my .cap)
- autoplay ressource (after putting my sounds in "files")
- Xaudio as a global object
- and I checked if the event that is supposed to trigger the sound works : and it does

I use Construct v0.99.97. I could post a *.cap but it would be useless, I told you everything :? .

By the way, I did turn on my speakers :lol:
B
4
S
1
G
2
Posts: 30
Reputation: 910

Post » Thu Mar 03, 2011 5:34 pm

Try file again using the actual path. Not apppath
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Mar 03, 2011 5:40 pm

I have always used

XAudio2: Autoplay file[color=#FF0000:1f5z0mi9] AppPath & "sounds\ambient.ogg"[/color:1f5z0mi9]
(when my sound files are in a folder called 'sounds')
This works 100%.

so you could use -

Autoplay file[color=#FF0000:1f5z0mi9] AppPath & "mysound.wav"[/color:1f5z0mi9]

Also I noticed that your example uses brackets. I dont think you need them.

good luck
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Thu Mar 03, 2011 5:49 pm

I tried with a subfolder sounds, it didn't work, then with full path "E:\...\sounds\sound.wav" it didn't work either.

I will save a zip containing my cap and my wav on Dropbox.

[EDIT] [url:3bdghblr]http://dl.dropbox.com/u/21012276/Test.zip[/url:3bdghblr]
B
4
S
1
G
2
Posts: 30
Reputation: 910

Post » Thu Mar 03, 2011 6:00 pm

@shadf : Is your wav file in the correct format?.22.5Khz 16bit stereo or mono.Remember the wav file should be PCM and not ADPCM.


This is an example of a PCM wav file.Right click on the wav file and select properties then go to the summary tab to see its properties.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Thu Mar 03, 2011 6:04 pm

As i suspected,Your .wav file is actually an mp3 file.Convert it to a proper wav file and it should work.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Thu Mar 03, 2011 6:09 pm

My sounds are .wav from .mp3, I could not check whether my wav is the correct format or not, so I converted the .mp3 again with the right settings in the convertion software and... IT WORKED :D
Thank you !!!!!

[EDIT] I'm late, you have already found it !
B
4
S
1
G
2
Posts: 30
Reputation: 910

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests