PDA

View Full Version : sound cuts off early when looping


Dj Tech42
08-04-2011, 11:04 PM
I have a certain sound I want looped in my world, and I have made sure that the sound doesn't cut off when I am editing it. But, in Alice, it keeps cutting off before starting the sound again. (It goes through the sound, then there is a pause, and then it starts it again) :confused: Is it cutting off because it is loading the sound? If so, is there a way I can set it up so it doesn't have to load the sound over and over again?

David B
08-05-2011, 08:44 AM
I have a certain sound I want looped in my world, and I have made sure that the sound doesn't cut off when I am editing it. But, in Alice, it keeps cutting off before starting the sound again. (It goes through the sound, then there is a pause, and then it starts it again) :confused: Is it cutting off because it is loading the sound? If so, is there a way I can set it up so it doesn't have to load the sound over and over again?

Your lucky! Most people can't even get sound to play in Alice in the first place. The only way that I know how to fix this is to use Audacity to smash the sound together. I recommend doing it five times. This way the sound will cut off every five times instead. It doesn't fix the problem, but makes it less obvious.

Dj Tech42
08-05-2011, 12:17 PM
That is a good solution. However, I want the sound to change volume according to the distance from the camera to the object. If I made the sound longer, the volume wouldn't "refresh" frequently enough. (The volume wouldn't change until the play sound method is run again) Is there a way the sound can change volume while playing?

zero00
08-05-2011, 12:37 PM
I did an experiment like that once. I'll post it when I find it.

Edit: I can't find it. Perhaps this will help?

To change volume while the sound is playing:

Set the volume of sound you're playing to a variable (VolumeLevel = World.SoundVolume, for example)
As the sound plays, you can change the variable and the volume will change accordingly (If you set "SoundVolume" to 0.5, the sound will play at half its volume)


As for changing volume based on range, multiply that "SoundVolume" variable by a percentage of how close you are to something. If you're 50% within range, multiply the variable by 0.5 (or 0.25 if you're 75% away from the object)

Dj Tech42
08-05-2011, 01:40 PM
To change volume while the sound is playing:

Set the volume of sound you're playing to a variable (VolumeLevel = World.SoundVolume, for example)
As the sound plays, you can change the variable and the volume will change accordingly (If you set "SoundVolume" to 0.5, the sound will play at half its volume)


As for changing volume based on range, multiply that "SoundVolume" variable by a percentage of how close you are to something. If you're 50% within range, multiply the variable by 0.5 (or 0.25 if you're 75% away from the object)

Well, I understand how to do that. It's in my flight simulator if you want to see (Flight Simulator with AI thread). I did it with the gunshots, which was okay because they don't loop and the sound is very short. But, I also want to add a jet engine sound, which is longer. If I change the variable, it doesn't change the volume while the sound is playing. It does when the sound stops and plays again. That's the problem.

It also keeps pausing before starting again. I'm guessing it has to do with the sound loading again. Is there any way to program it so it doesn't load the sound over and over again?

zero00
08-05-2011, 04:14 PM
Can you post the jet engine sound?

Dj Tech42
08-05-2011, 04:20 PM
Yeah. It will sound weird because it is meant for looping. I have made sure that there is no space at the end of the file.

http://www.mediafire.com/file/jau57ah4u338y18/Jet%20Engine%20Loop.mp3

zero00
08-05-2011, 05:23 PM
Personally, I would recommend looping it in Audacity first. I would repeat the sound enough times to last several minutes.
I tried to loop the sound, but I couldn't do it in a way that sounded good. It still looped though :D

I have altered your world slightly so a sound plays as your ship moves. If you think it sounds a bit weird, its because I decided to just mangle the sound and put it into a loop. :rolleyes:

The sound you gave me had a very brief pauses at the beginning and end. You would need to cut those (and likely a little of the sound) for the loop to sound more seamless.

I'm uploading the modified world into my mediafire account. One moment...

Edit: Here it is! (http://www.mediafire.com/file/51rjz5lfqchllmq/Flight%20Simulator%206.5%20-%20Zero00.a2w) I hope this helps! :D

Dj Tech42
08-05-2011, 05:43 PM
Thanks! This works perfectly! I copied over my "volume-distance formula" and everything works fine. Huge thanks!

zero00
08-05-2011, 05:44 PM
Glad I could help! :D