Jump to content
Sign in to follow this  
jw custom

How to use custom sounds with createSoundSource?

Recommended Posts

I would like to "attach" a sound to a object so the sound fades out when moving away from it. From what info i could find i understand that createSoundSource.

I have defined a sound called Radio1 in description.ext and it works fine when used with "say" command but using it with createSoundSource gives me an error saying "No entry 'bin\config.bin/cfgVehicles.Radio1'."

This is what i tried:

_soundSource = createSoundSource ["Radio1", getPos aRadio, [], 0]

;

Can i use custom sounds this way and if so please tell me how :)

Share this post


Link to post
Share on other sites

AFAIK a soundSource is not only a "invisible spot which plays a sound" but a object. So you would have to create an addon for it.

But whats wrong with the say command? You can use a Gamelogic as source. Just make sure you have defined your desired sound as CfgSounds in the description.ext and the file is 16bit, 44.1kHz and MONO.

Share this post


Link to post
Share on other sites

But whats wrong with the say command? You can use a Gamelogic as source. Just make sure you have defined your desired sound as CfgSounds in the description.ext and the file is 16bit, 44.1kHz and MONO.

Thats what i'm using now but it doesn't seem to fadeout sound when moving away from sound source. What i need is sound to appear at normal volume within 1-5m of sound source and then more and more fadeout the longer you move away from sound source.

Does it have to be 16bit, 44.100khz and mono? I have tried with 32bit, 48.000khz and stereo and that worked. Will it give problems at some point?

Thanks for your reply :cool:

Share this post


Link to post
Share on other sites

Hmmm...at my side it didn't worked with cfgSounds and stereo soundfiles together with the say command. However, you may try to adjust fadeout behaviour by simply adjust one value in your description.ext:

class Demo1043myfm_11 {
	name = "Demo1043myfm_10";
	sound[] = {"glt_basemanager\music\jingles\Demo1043myfm_10.ogg", 0.2, 1.000000};
	titles[] = {};
};

Take note of the 0.2 after the filepath. I think (at least it seemd to influence it) this sets how fast the sound will fade with distance to the source. For my ears, 0.2 sounds correct to me (higher values result in slower fades/higher audible distance) but you may try for yourself.

I'm using this for a Radio simulation. I also encountered another problem for which i can give you advice on how to solve it: a new given say command to a Gamelogic will cut a previously called soundfile. For me this was a problem since on the radio the songs are usually crossfaded. So i've simply created a second logic and i use them alternatingly. With well prepared audiofiles and well set sleeps for the script, it gives a nice radio sim.

Share this post


Link to post
Share on other sites

Thanks a lot for your help i'll give this a go tomorrow :)

...erhmm i mean today, jeez it's getting late :p

Share this post


Link to post
Share on other sites

Got it it tested and your right that value did the trick and yes 0.2 is working great, thanks again :cool:

Share this post


Link to post
Share on other sites

what command are you putting in your gamelogic? say? playSound? createSoundSource?

Also having trouble with the fade

Share this post


Link to post
Share on other sites
what command are you putting in your gamelogic? say? playSound? createSoundSource?

Also having trouble with the fade

I use "Say" command and the fade does work when you keep db between -10 and +10.

I have some radio talking attached to my radio guy and for that purpose i have db at 0.2 and that works perfectly :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×