| View previous topic :: View next topic |
| Author |
Message |
exzantia
Joined: 03 Oct 2005 Posts: 4
|
Posted: Thu Mar 16, 2006 7:45 pm Post subject: Problems loading sound files |
|
|
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! |
|
| Back to top |
|
 |
ShUr1k3n
Joined: 16 Oct 2005 Posts: 42
|
Posted: Fri Mar 17, 2006 5:06 am Post subject: |
|
|
1st -> See if that file exists...(the directory, etc)
2nd -> Is that the only sound that u are loading?
3rd -> The size of the sound (shouldn't be very "large")
Check these 3 steps.
If you still having problems, post here some part of ur code!
Regards,
ShUr1k3n |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Sat Mar 18, 2006 5:02 am Post subject: Re: Problems loading sound files |
|
|
| exzantia wrote: |
Do I need to do something to t he wav file to make it compatible?
|
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. |
|
| Back to top |
|
 |
exzantia
Joined: 03 Oct 2005 Posts: 4
|
Posted: Sun Mar 19, 2006 8:00 pm Post subject: |
|
|
Yay!
That got it working for me :)
Thanks Shine |
|
| Back to top |
|
 |
ZORDAK
Joined: 21 Jan 2006 Posts: 12 Location: Spain
|
Posted: Fri Mar 24, 2006 11:28 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Kameku
Joined: 23 Mar 2006 Posts: 32 Location: Oregon, USA
|
Posted: Fri Mar 24, 2006 12:19 pm Post subject: |
|
|
Couldn't you just toss in an if statement checking to see if it's playing?
Like:
| Code: | if not music:playing() then
music:play()
end |
I dunno.
[EDIT] Just checked the wiki, and you can just put | Code: | | Sound.load(filename, [bool loop]) |
So, maybe
| Code: | | musica = Sound.load("a.wav", true) |
|
|
| Back to top |
|
 |
ZORDAK
Joined: 21 Jan 2006 Posts: 12 Location: Spain
|
Posted: Fri Mar 24, 2006 10:56 pm Post subject: |
|
|
Using the loop works fine, but how i stop the playing?
Using musica.stop() dont work, i getting this "loop in gettable" |
|
| Back to top |
|
 |
Kameku
Joined: 23 Mar 2006 Posts: 32 Location: Oregon, USA
|
Posted: Sat Mar 25, 2006 2:16 am Post subject: |
|
|
| Try using a colon instead of a period. |
|
| Back to top |
|
 |
|