How to make custom sound ?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

How to make custom sound ?

Post by Rougecorne »

Hello all !
How to make custom sound in Legend of Grimrock 2 ?

So, i create my audio file in OGG format. I create this script in sounds.lua

defineSound{
name = "introdungeon",
filename = "mod_assets/sounds/2007.ogg",
loop = false,
volume = 1.0,
}

But, when i reload my project, i have this message:

[string "SoundSystem.lua"] :0: Not a RIFF file.

Why ? :(
User avatar
Prozail
Posts: 158
Joined: Mon Oct 27, 2014 3:36 pm

Re: How to make custom sound ?

Post by Prozail »

i suspect it expects a .wav file.

All ingame "sounds" are .wav and all "AmbientTracks" (ie music) is ogg.
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: How to make custom sound ?

Post by Rougecorne »

Ok thank you
I don't have the error message, now.
But... why i can't play this sound in-game ? :x

It's strange
User avatar
gambit37
Posts: 218
Joined: Fri Mar 02, 2012 3:40 pm

Re: How to make custom sound ?

Post by gambit37 »

Dungeon sounds need to be in WAV format, 16-bit 44.1Khz, mono. Do you have a sound converter to convert your OGG into the right format?
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: How to make custom sound ?

Post by Rougecorne »

I convert mp3 to this format (Wav, 16-bit 44.1Khz, mono).

What is the script to have the sound in-game ? :(
User avatar
Jouki
Posts: 127
Joined: Fri Oct 24, 2014 12:57 pm

Re: How to make custom sound ?

Post by Jouki »

Rougecorne wrote:I convert mp3 to this format (Wav, 16-bit 44.1Khz, mono).

What is the script to have the sound in-game ? :(
are you trying play that soiund by script or sound item?
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: How to make custom sound ?

Post by Rougecorne »

Yes, but the editor don't find the sound :/

The script for play sound is:

playSound(sound) or playSoundAt(sound, level, x, y), right ? :/
User avatar
Lark
Posts: 178
Joined: Wed Sep 19, 2012 4:23 pm
Location: Springfield, MO USA

Re: How to make custom sound ?

Post by Lark »

Some of this is probably a repeat of what you already know, but to add a sound effect to the game, do this:
  • Create your sound effect and make it a 16-bit 44.1Khz, mono .wav file and put it in your mod_assets\sounds directory under the dungeon you are editing.
  • Edit your mod_assets\scripts\sounds.lua.
  • Add the sound definition (see below) and save the file.
  • In your script, use playSound("woodCollapse") (in my example below). The name you use to play the sound must match the name in the definition, including case.
  • Trigger the script when you want the sound to play. That's all it takes!

Code: Select all

defineSound{
  name = "woodCollapse",
  filename = "mod_assets/sounds/woodCollapse.wav",
  loop = false,
  volume = 3,
  minDistance = 1,
  maxDistance = 1,
  }
I hope this helps, -Lark
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: How to make custom sound ?

Post by Rougecorne »

Thank you ! :D
It's work !

My problem is, when i make this script: "playSound("woodCollapse")", i write a bad name of sound.
Big thank you Lark !

But, i have an other question:

In this script:

playSoundAt("introdungeon", 1, 12, 18), 1 = what ? Because, i can't write '0' (For H)
User avatar
Rougecorne
Posts: 34
Joined: Wed Oct 29, 2014 1:52 am

Re: How to make custom sound ?

Post by Rougecorne »

It's okay, i try this script :

function playCoolSound()
playSound("cool_sound")
end

And it work with an activator.
Post Reply