Problems loading sound files

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
exzantia
Posts: 4
Joined: Mon Oct 03, 2005 3:09 am

Problems loading sound files

Post by exzantia »

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!
ShUr1k3n
Posts: 42
Joined: Sun Oct 16, 2005 9:04 pm

Post by ShUr1k3n »

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
Shine
Posts: 728
Joined: Fri Dec 03, 2004 12:10 pm
Location: Germany

Re: Problems loading sound files

Post by Shine »

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.
exzantia
Posts: 4
Joined: Mon Oct 03, 2005 3:09 am

Post by exzantia »

Yay!

That got it working for me :)

Thanks Shine
ZORDAK
Posts: 12
Joined: Sat Jan 21, 2006 9:58 am
Location: Spain
Contact:

Post by ZORDAK »

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.
Kameku
Posts: 32
Joined: Thu Mar 23, 2006 12:17 pm
Location: Oregon, USA

Post by Kameku »

Couldn't you just toss in an if statement checking to see if it's playing?

Like:

Code: Select all

if not music:playing() then
 music:play()
end
I dunno.

[EDIT] Just checked the wiki, and you can just put

Code: Select all

Sound.load(filename, [bool loop])
So, maybe

Code: Select all

musica = Sound.load("a.wav", true)
ZORDAK
Posts: 12
Joined: Sat Jan 21, 2006 9:58 am
Location: Spain
Contact:

Post by ZORDAK »

Using the loop works fine, but how i stop the playing?

Using musica.stop() dont work, i getting this "loop in gettable"
Kameku
Posts: 32
Joined: Thu Mar 23, 2006 12:17 pm
Location: Oregon, USA

Post by Kameku »

Try using a colon instead of a period.
Post Reply