sound help please.

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

sound help please.

Post by Ryeath_Greystalk »

I'm trying to get my custom gong to work in game but I am having an issue with the sound.

I have a define sound in my .lua file
SpoilerShow
defineSound{
name = "gong_hit",
filename = "mod_assets/RG_assets/RG_gong/sounds/gong.wav",
loop = false,
volume = 2,
minDistance = 2,
maxDistance = 10,
}


Then I put a lua script activated by a wall button that opens a door and playSound("gong_hit"). That works ok, door opens and sound plays fine.
In my gong definition I have a function call onDamage which calls the lua script and again the door opens and the gong sound plays.
SpoilerShow
defineObject{
name = "RG_gong",
class = "Blockage",
model = "mod_assets/RG_assets/RG_gong/models/RG_gong.fbx",
brokenModel = "mod_assets/RG_assets/RG_gong/models/RG_gong.fbx",
placement = "floor",
health = 300000,
evasion = -10000,
-- hitSound = "barrel_hit",
-- hitEffect = "hit_wood",
onDamage = function(self)
gong.soundGong()
end,
editorIcon = 56,
}
When I take out the dashes in front of the hitSound parameter (and edit out the playSound() in the lua script) then the barrel_hit sound plays whenever the party hits the the gong.

Everything is great to this point. But when I change the hitSound to hitSound = "gong_hit" as soon as I hit the gong the game crashes to desktop with no error report generated. I have gone over my typing a dozen times looking for something but can't find anything.

In summary gong_hit sound works in a playSound() lua script, gong calls the function when hit, gong plays stock sound ok but when it tries to play the custom sound (which works in a playSound() script) game crashes without error report.

Any ideas?
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: sound help please.

Post by JohnWordsworth »

One thing to check is the format of the Wav file to be played. I know that Grimrock can be very picky with audio files. I've had success with 44,100 Hz, Mono saved as a 16-bit Wav file. I don't know anything about the hitSound, but I would just do a quick sanity check to make sure the file format is correct.

Other things that might help... In your mod's "init.lua" file, make sure that the line import "mod_assets/scripts/sounds.lua" comes before "mod_assets/scripts/objects.lua". Not 100% sure of the names off the top of my head, and I can't imagine that it would matter - but just incase it does, this makes sure the relevant defineSound comes before the defineObject for your object.

No other ideas immediately - let me know how you get on with the above!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Ryeath_Greystalk
Posts: 366
Joined: Tue Jan 15, 2013 3:26 am
Location: Oregon

Re: sound help please.

Post by Ryeath_Greystalk »

Downloaded Audacity and checked and it was a stereo file. Changed it to mono and it's working now.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: sound help please.

Post by JohnWordsworth »

Brilliant! For future notice, if anyone else if making wav files for Grimrock, here's a Guide on the Grimwiki to making custom sounds.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Post Reply