Jump to content
Sign in to follow this  
blackpixxel

Simple Question: play a custom sound

Recommended Posts

Hi,

I am still trying to do a weapon mod. I made an .ogg soundfile. This one has to be played during an sqf script. I tried it with "say3d" and I made a description.ext where I defined the sound for the SoundCfg. I did the same in the weaponconfig.

But it does not seem to work.

Is there another approach for this simple task?

Thank you for your time!

BlackPixxel

Share this post


Link to post
Share on other sites

Oh, thanks alot. It was more tricky than I expected, but now it is working fine.

Thanks for your help!

Share this post


Link to post
Share on other sites

Is there a maximum length file size or something along those lines for sounds? I have a few custom sounds in my mission already, they're reasonably small in size, one probably lasts 30 seconds or so. I've have no problems defining these in description.ext or calling them from an NPC or a player. However when adding actual music tracks, the tracks simply won't play, using the same method (a simple: player say "soundname"; or npc say "soundname";). Both are defined in the same way in description.ext, I've tried defining them as sounds, and music, and trying the playMusic "soundname"; as well but it simply doesn't want to play the sound.

I've used the same program to covert other mp3 files to .ogg and those sounds work fine. Do sounds need to specifically be called inside scripts, or will triggers suffice? And, any ideas why my music tracks aren't playing?

class cfgMusic:

class CfgMusic
{
tracks[]={apple,richochet,stuntin,bless};

class apple
{
	name = "apple";
	sound[] = {"apple.ogg", db+0, 1.0};
};
class richochet
{
	name = "richochet";
	sound[] = {"richochet.ogg", db+5, 1.0};
};
class stuntin
{
	name = "stuntin";
	sound[] = {"stuntin.ogg", db+0, 1.0};
};
class bless
{
	name = "bless";
	sound[] = {"bless.ogg", db+0, 1.0};
};
};

And then I just call it via trigger with:

playMusic "musicname";

Alternatively via cfgSounds:

class CfgSounds
{
// List of custom sounds (.ogg files without the .ogg extension)
sounds[] = {cough,bong,ching,boom,apple,richochet,stuntin,bless};

// Definition for each sound
	class cough
	{
		name = "cough"; // cough sound, perhaps find a better one
		sound[] = {cough.ogg, 1, 1.0};
		titles[] = {};
	};
	class bong
	{
		name = "bong"; // good bong sound
		sound[] = {bong.ogg, 1, 1.0};
		titles[] = {};
	};
	class ching
	{
		name = "ching"; // cash register noise
		sound[] = {ching.ogg, 1, 1.0};
		titles[] = {};
	};
	class boom
	{
		name = "boom"; // not used
		sound[] = {boom.ogg, 1, 1.0};
		titles[] = {};
	};
/*		class apple  - too long / big for sounds maybe? define as music instead?
	{
		name = "apple"; // eat my apple by apashe
		sound[] = {apple.ogg, 1, 1.0};
		titles[] = {};
	};
	class richochet
	{
		name = "richochet"; // richochet by aero chord
		sound[] = {richochet.ogg, 1, 1.0};
		titles[] = {};
	};
	class stuntin
	{
		name = "stuntin"; // stuntin like mah daddy trap edit - lil jon
		sound[] = {stuntin.ogg, 1, 1.0};
		titles[] = {};
	};
	class bless
	{
		name = "bless"; // bless di nation - GTA remix
		sound[] = {bless.ogg, 1, 1.0};
		titles[] = {};
	};*/
};

And then call with a simple player say "bless"; - this doesn't work either.

I figure that this has something to do with the converted .ogg file not being 'correct' - will try converting it with another program and see how that goes

UPDATE: Yep, it was the .ogg files themselves. I converted them to 16 bit mono wavs, then to ogg from there (as opposed to straight mp3 -> ogg) and now they work :) So if anyone was having issues putting music into your missions, perhaps that might be the ticket.

Edited by drunkenjawa

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  

×