Page 2 of 2

Re: Problems with adding custom sounds

Posted: Wed Jul 30, 2014 1:00 pm
by Marth8880
Please post the aforementioned asfx file.

Re: Problems with adding custom sounds

Posted: Wed Jul 30, 2014 1:10 pm
by thelegend
ah ok. Here is the asfx file that always get the soundmunge bats to work:

Code: Select all

effects\uzi.wav -resample xbox 22050 pc 22050
Note: It is unimportant which wav file it reads. Every sound file has no problems or errors.

And if I add one more line, as here, I get the errors:

Code: Select all

effects\uzi.wav -resample xbox 22050 pc 22050
effects\ak47.wav -resample xbox 22050 pc 22050
effects\9mm_shot.wav -resample xbox 22050 pc 22050
Edit: Ok. I just use the default sound munge bat files from Bf2_Modtools/ data and added the .asfx line to my soundmunge.bat. After that I replaced my munge.bat with the munge.bat by Anakin he sent me. Now if I munge the sounds with the munge.bat my .lvl file is only 3kb file size.

Re: Problems with adding custom sounds

Posted: Wed Jul 30, 2014 5:16 pm
by Anakin
Just got an idea. How to you edit the files?? And what os are you using??

It's may an formating (ASCI, ANSI, utf8,...) problem of the files. Most only differ in the öäü,... and the endline character.

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 8:23 am
by thelegend
I open the soundmunge, soundmungedir and the munge.bat files with the texteditor. I edit the lines I had to edit* and save them all as bat files. I munge with the munge.bat in data_LC1/_BUILD/Sound. But my lc1.lvl (soundlvl.) is just 3kb in file size. But it should be larger than now.
*The lines I add in soundmunge.bat:

Code: Select all

@call soundmungedir _BUILD\sound\worlds\lc1\%MUNGE_DIR% sound\worlds\lc1 sound\worlds\lc1\%MUNGE_PLATFORM% %MUNGE_PLATFORM% _BUILD _LVL_%MUNGE_PLATFORM%\sound _BUILD\sound lc1
in soundmungedir.bat:

Code: Select all

@for /R %%A in (*.asfx) do @echo Munging %%~nA%%~xA & @soundflmunge -platform %4 -banklistinput %%A -bankoutput %MUNGEDIR%\ %CHECKDATE% -resample %CHECKID% noabort %SOUNDOPT% %BANKOPT% 2>>%MUNGE_LOG% 1>>%SOUNDLOGOUT%
And in munge.bat:

Code: Select all

@for /R %%A in (*.asfx) do @set BANKLIST=!BANKLIST! %%A
Edit: I think the bat files are ok. I tried it and replaced one bat after one bat with the ones you sent me. I didn't get errors. But after I replaced the lc1 folder with your sorce folder you gave me I always get this errors. (the lc1 folder in data_LC/ Sound.)

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 9:02 am
by Marth8880
3kb sounds about right for three tiny 22kHz sound samples. Send me your sound folder, lemme see if I'm able to munge them.

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 9:33 am
by thelegend
Actually there are 5 sound files/samples. Anakin was able to get them munged. But ok. I have sent you the sound files.

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 11:14 am
by Marth8880
I think I see the problem: your sound effects are stereo; all sound effects *have* to be mono. To make a stereo sound mono, import it into Audacity, select the track, go to Tracks, Stereo Track to Mono, and re-export.

The only sounds that should *ever* be stereo are music tracks and ambient environmental stream tracks (such as the sound of rain or birds chirping).

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 11:39 am
by thelegend
Hm..I am going to re-stereo-to-mono them all. Did you get any error messages then you munged the sounds?

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 11:40 am
by Marth8880
I didn't even bother attempting to munge them. Stereo WAV files loaded in ASFX or SFX files shouldn't be able to be munged at all.

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 11:53 am
by thelegend
YES. It works now. No errors. Larger lvl file. Everything works and the sounds sound now more better. Thank you marth. I made all sounds to mono and now it works. Again thank you so much.

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 11:54 am
by Marth8880
Great. :D I'd recommend using different sound effects for those weapons, though, just FYI. ;)

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 12:18 pm
by thelegend
Ok. I just have one little question. I added a sound to my vehicle. In game it works but only so long as the soudn wave file is. Example for a helicopter: It just plays the 5 seconds of my wav file. After that it stops till I do a trickroll, or land or whatever with my vehicle. It is possible to let the sound files repeat if they end?

Re: Problems with adding custom sounds

Posted: Thu Jul 31, 2014 12:33 pm
by Marth8880
Sure. Just add Looping(1); to the sound property. However, you might want to set it up as a parameterized engine sound instead.
Hidden/Spoiler:
[code]///// ---A-61 Mantis Gunship Start ---
// ------- Start Mantis Engine Loops ----------
//Acceleraton = 30.0
//MinSpeed = 20.0 =.2
//MidSpeed = 40.0 =.4
//MaxSpeed = 60.0 =.6
//BoostSpeed = "100" = 1.0

SoundProperties()
{
Name("mantis_engine_low_idle_property");
Group("vehicles");
Inherit("me5_flyer_eng_low_template");
Gain(1.0)
SampleList()
{
Sample("a61_engine_low", 1.0);

}
}

SoundProperties()
{
Name("mantis_engine_med_idle_property");
Group("vehicles");
Inherit("me5_flyer_eng_hi-mid_template");
MinDistance(40.0);
Gain(1.0)
SampleList()
{
Sample("a61_engine_mid", 1.0);

}
}

SoundProperties()
{
Name("mantis_engine_high_idle_property");
Group("vehicles");
Inherit("me5_flyer_eng_hi-mid_template");
Rolloff(1.0);
SampleList()
{
Sample("a61_engine_high", 1.0);

}
}

// ------- End Mantis Engine Loops ----------
// TakeOff and Land Layers --------------------------

///// stick something in here eventually :O

// ------- Start Mantis Engine Parametric Graphs -------------------------------------------

ParameterGraph()
{
Name("mantis_engine_low_idle_speed");
ControlPoint(-1.0, 0.8);
ControlPoint(0.0, 0.8);
ControlPoint(0.4, 1.0);
ControlPoint(1.0, 1.0);

}

ParameterGraph()
{
Name("mantis_engine_low_idle_acceleration");
ControlPoint(-1.0, 0.5);
ControlPoint(0.0, 0.6);
ControlPoint(0.4, 0.9);
ControlPoint(1.0, 1.0);
}

ParameterGraph()
{
Name("mantis_engine_med_idle_speed");
ControlPoint(-1.0, 0.5);
ControlPoint(0.0, 0.5);
ControlPoint(0.6, 1.1);
ControlPoint(1.0, 1.3);

}

ParameterGraph()
{
Name("mantis_engine_med_idle_acceleration");
ControlPoint(-1.0, 0.5);
ControlPoint(0.0, 0.6);
ControlPoint(0.4, 0.9);
ControlPoint(1.0, 1.0);
}

ParameterGraph()
{
Name("mantis_engine_high_idle_speed");
ControlPoint(-1.0, 0.5);
ControlPoint(0.0, 0.5);
ControlPoint(0.4, 0.7);
ControlPoint(1.0, 0.9);
}

ParameterGraph()
{
Name("mantis_engine_high_idle_acceleration");
ControlPoint(-1.0, 0.5);
ControlPoint(0.0, 0.6);
ControlPoint(0.4, 0.9);
ControlPoint(1.0, 1.0);
}

ParameterGraph()
{
Name("mantis_engine_boost_idle_gainspeed");
ControlPoint(-1.0, 0.0);
ControlPoint(0.0, 0.0);
ControlPoint(0.66, 0.05); // Contrailz start
ControlPoint(0.9, 1.0);
}

ParameterGraph()
{
Name("mantis_engine_boost_idle_pitchspeed");
ControlPoint(-1.0, 1.0);
ControlPoint(0.0, 1.0);
ControlPoint(0.9, 1.0);
}


SoundLayered()
{
Name("mantis_engine_layered");
Layer("mantis_engine_low_idle", "mantis_engine_low_idle_property", 0.0);
Layer("mantis_engine_med_idle", "mantis_engine_med_idle_property", 0.0);
Layer("mantis_engine_high_idle", "mantis_engine_high_idle_property", 0.0);
}

SoundParameterized()
{
Name("ssv_fly_a61_mantis_gunship_engine_parameterized");
SoundLayered("mantis_engine_layered");

Layer()
{
Name("mantis_engine_low_idle");
ParameterGraph("speed", "mantis_engine_low_idle_speed", "pitch");
ParameterGraph("acceleration", "mantis_engine_low_idle_acceleration","gain");
ParameterGraph("turnontime", "engine_turnon_gain", "gain");
ParameterGraph("turnofftime", "engine_turnoff_gain", "gain");
}
Layer()
{
Name("mantis_engine_med_idle");
ParameterGraph("speed", "mantis_engine_med_idle_speed", "pitch");
ParameterGraph("acceleration", "mantis_engine_med_idle_acceleration","gain");
ParameterGraph("turnontime", "engine_turnon_gain", "gain");
ParameterGraph("turnofftime", "engine_turnoff_gain", "gain");
}
Layer()
{
Name("mantis_engine_high_idle");
ParameterGraph("speed", "mantis_engine_high_idle_speed", "pitch");
ParameterGraph("acceleration", "mantis_engine_high_idle_acceleration","gain");
ParameterGraph("turnontime", "engine_turnon_gain", "gain");
ParameterGraph("turnofftime", "engine_turnoff_gain", "gain");
}

}

// ------- End Mantis Engine Parametric Graphs -------------------------------------------
///// ---A-61 Mantis Gunship End ---[/code]
You'll need a low, mid, and high version (in terms of pitch) of your helicopter's engine sound.

Relevant notes:
Hidden/Spoiler:
[code]ObjectID : SoundLayered
-----------------------

Property | Description
-------------------------------------------------------------------------------
Name | Name of the layered sound
Layer | Layer("layerName", "soundName", playbackDelay, playbackDelayDev,
| playbackTime, playbackTimeDev).
| The layer name is a label which allows the layer to be
| referenced by the application code. The sound name
| references the name of a previously defined Sound()
| which will be used as a layer of the layered sound.
| The playback delay, is the time to delay the sound
| (in seconds) from the time the sound is initially triggered.
| The playback delay deviation (playbackDelayDev) allows
| the playback delay to be randomly varied over a range.
| playbackTime is the time to play the layer, if this is not
| specified the layer will not stop. Finally, playbackTimeDev
| is the deviation of the playback time, if this is not specified
| a deviation of 0.0 is used.
| Any number of SoundLayers can be specified for a layered sound.

A layered sound (SoundLayered) allows multiple Sounds to be played back at the
same time or with some delay between each sound.

For example...

SoundLayered
{
Name("grenade_explode");
Layer("explosion", "grenade_explode", 0.0);
Layer("gasleak", "grenade_gas", 0.5, 0.1);
}

The sound "grenade_explode" will be played when the layered sound
"grenade_explode" is triggered (played). Then 0.4 to 0.6 seconds after the
layered sound "grenade_explode" was triggered, "grenade_gas" will play.


ObjectID : ParameterGraph
-------------------------

Property | Description
-------------------------------------------------------------------------------
Name | Name of the parameter graph
ControlPoint | ControlPoint(inputValue, outputValue).
| Each control point represents a point on a 2D graph. For
| example inputValue is the X axis and outputValue is the Y
| axis. X is related to Y by the relationship defined by
| the ControlPoints. If only the following two control points
| exist on a graph...
| ControlPoint(0.0, 0.0);
| ControlPoint(1.0, 2.0);
| X is 0, Y is 0 and when X is 1, Y is 2. So for the input
| value of 0.5 the output value would be 1.0.

Parameter graphs are used in conjunction with parameterized sounds
(SoundParameterized) to map application (game) values to sound parameters.
For example the acceleration of a object could be mapped to the gain of a
sound.


ObjectID : SoundParameterized
-----------------------------

Property | Description
-------------------------------------------------------------------------------
Name | Name of the layered sound
SoundLayered | Name of the layered sound controlled by this parameterized
| sound.

SoundParameterized.SubObjectID : Layer

Property | Description
-------------------------------------------------------------------------------
Name | Name of the layer within the layered sound (specified by
| SoundParameterized.SoundLayered) which is being controlled.
ParameterGraph | ParameterGraph(input, parameterGraphName, output).
| input is the name of the application parameter which is mapped
| to the sound parameter (output).
| parameterGraphName is the name of parameter graph which
| controls the layer specified by the Name property.
| output is the sound parameter which is controlled by the
| application parameter(input).
| output can be any of the following...
| "Gain"
| "Pitch"
| "Pan"
| "MinDistance"
| "MuteDistance"
| "MaxDistance"
| "RollOff"

A parameterized sound maps game parameters using parameter graphs to control a
layered sound. See ParameterGraph and SoundLayered for more information.[/code]