| View previous topic :: View next topic |
| Author |
Message |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Wed Dec 07, 2005 12:25 pm Post subject: sound stopping |
|
|
| i have a sound clip (.wav) playing. its about 30sec long. problem is i dont know how to stop it. i tried bgmusic:stop() (bgmusic is the var for the file) then it says something to the effect of loop in gettable. i forget exactly what it said. can anyone help me out? |
|
| Back to top |
|
 |
JetSpike
Joined: 19 Sep 2005 Posts: 8
|
Posted: Thu Dec 08, 2005 1:37 pm Post subject: |
|
|
Load your sound file into a variable like this: (use false if you don't want it to loop)
mySound = Sound.load("sound.wav",true)
Then later you can stop it by using:
mySound:stop() |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Fri Dec 09, 2005 10:44 am Post subject: |
|
|
| thats basically what i have. and it gives me this error message "loop in gettable" |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Fri Dec 09, 2005 11:08 am Post subject: |
|
|
Yeah i dont like .wav sounds. you can only have like 45 seconds of it. but im too lazy to do it in a different format. and when you do a 3mb mp3, it goes to a 64mb .wav file. it pretty much sux so you have to put it on a really really bad quality. Mine works fine though. only i have this
| Code: | sound=Sound.load('file.wav', true)
some code goes here
sound = nil |
it works fine. in fact i never even tried sound:stop() because i just use this. |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Sat Dec 10, 2005 12:06 am Post subject: |
|
|
thanks that works. now i have another sound question. i would like music to play during a race. problem is i have sounds for the engine constantly playing. the music plays for about half a second before it is drowned out by the engine. is the problem that the music isnt load enough or that the constant engine sounds override the music?
heres the code i have for the engine. if i take it out the music plays fine. but i still want to have the other sounds. is there anyway to keep them both?
| Code: | if rpm < 1500 then
idle:play() end
if rpm > 1500 and rpm < 2000 then
revlow:play() end
if rpm > 2000 and rpm < 4000 then
revlow2:play() end
if rpm > 4000 and rpm < 6000 then
revmid:play() end
if rpm > 6000 and rpm < 9000 then
revhigh:play() end |
|
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sat Dec 10, 2005 12:07 pm Post subject: |
|
|
you need to load music and not all .wav files. make your engine noise .wav and your music .it(best choice i dont know). then do this:
| Code: | Music.playfile( 'filename.it', true)
if rpm < 1500 then
idle:play() end
if rpm > 1500 and rpm < 2000 then
revlow:play() end
if rpm > 2000 and rpm < 4000 then
revlow2:play() end
if rpm > 4000 and rpm < 6000 then
revmid:play() end
if rpm > 6000 and rpm < 9000 then
revhigh:play() end
Music.stop() |
that is the basic idea. i think LUA player only lets one sound play at a time and .wav files are considered sound in LUA's eyes. but you can have "music" and sound playing at the same time. just get a file converter and make some compatible music. i never used anything off of .it because it came with a game. |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Sat Dec 10, 2005 12:53 pm Post subject: |
|
|
| does anyone know where some good converters are? ive looked a few times but never found any good ones. |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Sat Dec 10, 2005 2:37 pm Post subject: |
|
|
You found a CONVERTER? But it wasnt good??
Look, the MOD format is like MIDI, all composed of beats. .it, .mod, .xm, .s3m, ect are different MOD formats. Search for Modplug Tracker. Thats what I believe to be the best MOD mixer.[/u] |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Dec 11, 2005 12:29 am Post subject: |
|
|
sorry. like i said i only used .wav files. but here are the "music" types supported if you dont know
UNI, IT, XM, S3M, MOD, MTM, STM, DSM, MED, FAR, ULT or 669
but looking around what does this do?
| Code: | | SoundSystem.SFXVolume( number {0-128} ) | ???? does that change the volume of your "sound"? i think it does but im not sure. it would be sweet if lua supported mp3 files. :( while we are on the subject of sound, does lua sound output in stereo or is it just mono? |
|
| Back to top |
|
 |
wekilledbambi03
Joined: 15 Oct 2005 Posts: 31
|
Posted: Sun Dec 11, 2005 3:46 am Post subject: |
|
|
| im not sure about the volume thing but i do believe that the sound is mono. also has anyone noticed that if you write in a new font the sound gets really slow? |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Dec 11, 2005 4:51 am Post subject: |
|
|
if it was stereo you could make a robot! you see here are my master plans. you take psp apart. rewire the cross button, and others for sensors. then the only out put is sound so connect your speaker wires to a headphone amplifier to pump up the signal. then write some code so if one of the sensors get bumbed, play a diffrent sound or no sound.
record a sound so the balance is all on the right for left turns, record a sound so the balance is all on the left for right turns then make a sound so the balance is equal for straight forward driving. then you make a kill switch sensor so if it goes off of stairs or something no sound would be played and your robot would stop moving.
the robot would have to be 2 wheels because there are only two speakers and you would void your warranty. but it sounds practical but you would have to really make the sound signal strong. |
|
| Back to top |
|
 |
Dr. Vegetable
Joined: 14 Nov 2005 Posts: 171 Location: Boston, Massachusetts
|
Posted: Sun Dec 11, 2005 6:41 am Post subject: |
|
|
| ...Or just buy a LEGO Mindstorms set for less than the cost of a PSP and build all the robots you want. |
|
| Back to top |
|
 |
link
Joined: 19 Oct 2005 Posts: 61
|
Posted: Sun Dec 11, 2005 6:47 am Post subject: |
|
|
whats the fun in that? _________________ 00100000 01101001 01101101 00100000 01110010 01101001 01100111 01101000 01110100 00100000 01100010 01100101 01101000 01101001 01101110 01100100 00100000 01111001 01101111 01110101 00100001 |
|
| Back to top |
|
 |
Dr. Vegetable
Joined: 14 Nov 2005 Posts: 171 Location: Boston, Massachusetts
|
Posted: Sun Dec 11, 2005 7:52 am Post subject: |
|
|
| ...Then program your PSP to control your LEGO Mindstorms robots using the IR link. |
|
| Back to top |
|
 |
|