Alice Community  

Go Back   Alice Community > Alice 2 > Bugs and Troubleshooting

Reply
 
Thread Tools Display Modes
sound cuts off early when looping
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default sound cuts off early when looping - 08-04-2011, 10: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) 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?


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
David B
Senior Member
 
David B's Avatar
 
Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
Default 08-05-2011, 07:44 AM

Quote:
Originally Posted by Dj Tech42 View Post
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) 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.
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default 08-05-2011, 11:17 AM

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?


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default 08-05-2011, 11:37 AM

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:
  1. Set the volume of sound you're playing to a variable (VolumeLevel = World.SoundVolume, for example)
  2. 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)


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389

Last edited by zero00; 08-05-2011 at 11:53 AM.
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default 08-05-2011, 12:40 PM

Quote:
Originally Posted by zero00 View Post
To change volume while the sound is playing:
  1. Set the volume of sound you're playing to a variable (VolumeLevel = World.SoundVolume, for example)
  2. 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?


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default 08-05-2011, 03:14 PM

Can you post the jet engine sound?


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default 08-05-2011, 03: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/jau57a...ine%20Loop.mp3


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default 08-05-2011, 04: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

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.

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! I hope this helps!


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389

Last edited by zero00; 08-05-2011 at 04:30 PM.
   
Reply With Quote
Old
Dj Tech42
Senior Member
 
Dj Tech42's Avatar
 
Status: Offline
Posts: 203
Join Date: Feb 2011
Default 08-05-2011, 04:43 PM

Thanks! This works perfectly! I copied over my "volume-distance formula" and everything works fine. Huge thanks!


Flight Simulator with Dogfight Modes:
http://www.alice.org/community/showthread.php?t=6840
   
Reply With Quote
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default 08-05-2011, 04:44 PM

Glad I could help!


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389
   
Reply With Quote
Reply

Tags
cuts, early, loop, sound

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.