Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Inhilicon on April 12, 2021, 07:12:52 AM

Title: My new mod weapon won't use the sound effect I've included
Post by: Inhilicon on April 12, 2021, 07:12:52 AM
Is there something I'm missing? I've tried pointing to it in various ways via the .weapon file, the standard way appears to be "gun_fire", for example. I've tried including the format; "gun_fire.ogg" and "gun_fire_01" as well as "gun_fire_01.ogg" and nothing seems to work. It does not have the exact same bitrate or audio sample rate as the vanilla sound effects but I don't know if that matters.

What're the general ground rules I should follow to make sound effects play in the game?

EDIT: I realized there is a thread for minor questions that don't warrant their own thread, how do I delete my own thread?
Title: Re: My new mod weapon won't use the sound effect I've included
Post by: lgustavomp on April 12, 2021, 08:22:05 AM
As far as I know, the bit rate does not matter. But the sample must be MONO.

Did you create your "sounds.json" on your data/config folder? if you don't you'll need to make something like this:

Quote
    "my_weapon_fire":
    [
        {"file":"my_sounds_folder/weapon_fire.ogg","pitch":1.00,"volume":1.00},
    ],

then, on your "weapon.wpn" file:

Quote
   "fireSoundTwo":"my_weapon_fire",
Title: Re: My new mod weapon won't use the sound effect I've included
Post by: Inhilicon on April 12, 2021, 08:40:26 AM
I was following the "Intro to Modding" guide on the Starsector fandom site and it entirely glossed over anything to do with audio, so I was veritably left in the dark.

Have not yet created a sounds.json file, that must be the missing step! I really should've looked at the data/config folder of other mods earlier. Whoops.

That should fix everything, thank you very much!
Title: Re: My new mod weapon won't use the sound effect I've included
Post by: AccuracyThruVolume on April 13, 2021, 12:29:46 AM
Hmmm is it possible to make multiple "file" entries to include multiple slightly different sounds that it would choose from? Or would it just play all of them all the time?
Title: Re: My new mod weapon won't use the sound effect I've included
Post by: lgustavomp on April 13, 2021, 04:10:28 AM
Hmmm is it possible to make multiple "file" entries to include multiple slightly different sounds that it would choose from? Or would it just play all of them all the time?

If you want them to be randomly chosen, its simple.

same sample, slightly different pitch:

Quote
    "my_weapon_fire":
    [
        {"file":"my_sounds_folder/weapon_fire.ogg","pitch":1.10,"volume":1.00},
        {"file":"my_sounds_folder/weapon_fire.ogg","pitch":1.00,"volume":1.00},
        {"file":"my_sounds_folder/weapon_fire.ogg","pitch":0.90,"volume":1.00},
    ],

Different sample:

Quote
    "my_weapon_fire":
    [
        {"file":"my_sounds_folder/weapon_fire_01.ogg","pitch":1.00,"volume":1.00},
        {"file":"my_sounds_folder/weapon_fire_02.ogg","pitch":1.00,"volume":1.00},
        {"file":"my_sounds_folder/weapon_fire_03.ogg","pitch":1.00,"volume":1.00},
    ],
Title: Re: My new mod weapon won't use the sound effect I've included
Post by: AccuracyThruVolume on April 14, 2021, 03:18:36 AM
That answers it, thx  ;)

Makes for some interesting possibilities....