Sound Problems

Posted By: luke_was_ere

Sound Problems - 05/10/07 19:04

I want to have a WAV file that plays in the background looping, it is ambient city noise like cars beeping etc....

here is the code i have used to put the sound in and it loads the file and runs the script but wont actually play the sound thru the speakers


sound background = "background.wav";
var_nsave background_handle;




background_handle = snd_play(background, 75, 0);


any ideas?
Posted By: Dj_Pint

Re: Sound Problems - 05/10/07 19:08

hmmmm,are the speakers on?^^ try to use this:


background_handle = snd_play(background, 75, 0);
if(background_handle == 0)
{error("[censored], no sound!");}
then u see if the soundis played and stuff...
Posted By: tompo

Re: Sound Problems - 05/10/07 19:09

sound background = "background.wav";
snd_loop(background,75,0);

And be sure that WAV format is OK, check help for this.
Posted By: Ran Man

Re: Sound Problems - 05/10/07 19:13

Yes, use sound_loop and not sound_play if you want it looping.

Be sure to declare the SOUND and VAR_NSAVE handle variable outside of any function, but then call the snd_loop, from within a function.
Posted By: luke_was_ere

Re: Sound Problems - 05/10/07 23:28

i checked the sample rates supported in WED and converted my file to 22Kb sample rate rather than 16, also checked speakers were on!

But still no joy,

Then when i added this code:

if(background_handle == 0)
{error("[censored], no sound!");}

it displayed the error which i guess means it isnt playing the sound.


I have also tried using an MP3 file and a MID file but these two chuck up errors about the file type not being supported even though it says it is in the manual.


Im stuck here :-(

Cant really see whats wrong.
Posted By: MrCode

Re: Sound Problems - 05/11/07 00:22

You have to use media_play/loop to use mp3s, mids, avis, and wmvs.
Posted By: tompo

Re: Sound Problems - 05/11/07 09:34

be sure that your wav file is in main folder or you have a path to it at the top of main script.
Try use more simple example without handle.

Before your main script write:
sound background = "background.wav";
and below main function write
starter start_loop
{snd_loop(background,100,0);}

and try to use another sound... f.e. one from templates and we'll see what happen.
Posted By: MTD

Re: Sound Problems - 05/11/07 10:30

Try to play a simple sound file in windows media player. If you here sound then your hardware is o.k. Else you don't have a sound cards

If everything is o.k. than check your wav file summary , and check what audio format you have. If it is a PCM than o.k. else maybe there is the problem...
Posted By: Raymaker

Re: Sound Problems - 05/11/07 11:00

Hey i had some problems with the sound to;
I had a cute little game I made for my mother (very simple: to pop-up all the baloons before the time runs out; you'll know where the baloon is coming from when you hear the sound coming from the left or from the right) but I couldn't make it play to the right side even if I put the balance to 100. After some time I realised that the problem is (I guess) the sound is mono; but when I reconvert it to stereo the engine shouts "Unknown sound format" or something like that what should i do?? THNX in advance!!!!
Posted By: tompo

Re: Sound Problems - 05/11/07 11:20

Raymaker... check the manual about WAV format (bitrate)
Posted By: Raymaker

Re: Sound Problems - 05/11/07 11:48

You know the story about the dragon who lived behinde seven seas, seven islands, seven mountains, seven forests, seven other dragons.....


And one morning he wakes up and seys: "Man, where the f.kc I foun the place to live!"

LOL!! thx tompo! this joke was for you if you understud it.....:D
Posted By: luke_was_ere

Re: Sound Problems - 05/11/07 11:56

Thats a joke? ok...


Any ways Stereo files arnt supported in Wav through 3DGS, only Mono.
Posted By: tompo

Re: Sound Problems - 05/11/07 12:35

Kurwa mac, ja pierdole, po chuju pojecia nie mam gdzie mnie w pizdu wywialo
Translate... beeep beeeep beeeep I have no idea beeep beeep

But Palm Beach sounds great to me
Posted By: luke_was_ere

Re: Sound Problems - 05/11/07 12:58

Right this is wierd, Wav files from the template folder work, but the city noise file i have doesnt, is there a size limit on the files as the file is about 4Mb? I dont have the commercial eddition so sadly i cannot use MP3s aparently


Tried the simplified code and the problem remains.

Bah maybe il just go without the long sound file and have a shorter one looping
Posted By: tompo

Re: Sound Problems - 05/11/07 13:02

so check the bitrate of your wav file and template one.
BTW... if this is a city noise... You can even change this wav to mono.
Posted By: luke_was_ere

Re: Sound Problems - 05/11/07 15:35

think the sound file is corrupt or something because even when i change the sample and bit rates it doesnt work. I have used a different sound file and now it works fine :-)
Posted By: tompo

Re: Sound Problems - 05/11/07 17:02

try to play this wav in winamp or something if it'll be working maybe this file is to quiet then check master_vol
Posted By: luke_was_ere

Re: Sound Problems - 05/12/07 10:59

it plays nicely in windows media player, and the volume of the code was set to 100 lol, ahh well never mind.
© 2024 lite-C Forums