Can anyone help me out with loading sound files in Lua? Every time I attempt to load a sound file it just gives me an error:
"error: index.lua:142: error loading sound"
142: a_sound = Sound.load("a.wav")
Do I need to do something to t he wav file to make it compatible?
I amn't too sure of what I am doing but I would really appricatite some help, this is for a graded project and I need to have sounds working in 4 days!
Problems loading sound files
Moderators: Shine, Insert_witty_name
Re: Problems loading sound files
Yes, save it as normal PCM (you can convert it e.g. with the Windows sound recorder). Any special Microsoft codecs or other formats are not supported.exzantia wrote: Do I need to do something to t he wav file to make it compatible?
hi
Im using a 1.3 wav file pcm 8 bit mono, i getting this error trying to load it.
LuaPlayer's Mikmod has a critical error:
_mm_critical 0
_mm_errno 14
Unknown module format 3 [unknown (0x7C4)] luaplayer 840 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION 450 [unknown (0x7C4)] luaplayer 840 open_stackdumpfile: Dumping stack trace to luaplayer.exe.stackdump
The problem is when i use
Music.volume(128)
Music.playFile("Data/Mus/track.wav", true)
Using wav files it crashed but if i use the play method ...
musica= Sound.load("Data/Mus/track.wav")
musica:play()
it sound fine, the problem is that i want use the wav file for a background music, and i cant get it looping infinite and stopping when i want.
How i can solve this?
Thanks in advance.
Im using a 1.3 wav file pcm 8 bit mono, i getting this error trying to load it.
LuaPlayer's Mikmod has a critical error:
_mm_critical 0
_mm_errno 14
Unknown module format 3 [unknown (0x7C4)] luaplayer 840 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION 450 [unknown (0x7C4)] luaplayer 840 open_stackdumpfile: Dumping stack trace to luaplayer.exe.stackdump
The problem is when i use
Music.volume(128)
Music.playFile("Data/Mus/track.wav", true)
Using wav files it crashed but if i use the play method ...
musica= Sound.load("Data/Mus/track.wav")
musica:play()
it sound fine, the problem is that i want use the wav file for a background music, and i cant get it looping infinite and stopping when i want.
How i can solve this?
Thanks in advance.
Couldn't you just toss in an if statement checking to see if it's playing?
Like:
I dunno.
[EDIT] Just checked the wiki, and you can just put
So, maybe
Like:
Code: Select all
if not music:playing() then
music:play()
end
[EDIT] Just checked the wiki, and you can just put
Code: Select all
Sound.load(filename, [bool loop])
Code: Select all
musica = Sound.load("a.wav", true)