Looping audio or continuous sounds question...
by Jesse Hall · in Torque Game Builder · 02/01/2006 (8:53 pm) · 6 replies
I am working on getting a thruster sound to work properly in game. I can play the sound as a single shot but would like to loop the last portion continously. Does anyone know of a way to go about this?
Also is there a way to make audio looping seemless? I get a small pause between plays.
- Jesse
Also is there a way to make audio looping seemless? I get a small pause between plays.
- Jesse
About the author
#2
02/02/2006 (4:54 am)
I noticed a gap between loops when playing streamed ogg files, even with a perfectly edited loop. This happens with the music in Little Gods.
#3
@ Jason Yes I get the same issue. I could play a single shot thruster gain and then go into a loop but the gap just sounds horrible.
- Jesse
02/02/2006 (5:19 am)
@ philip Thank you. However I am past that part.@ Jason Yes I get the same issue. I could play a single shot thruster gain and then go into a loop but the gap just sounds horrible.
- Jesse
#4
02/02/2006 (5:47 pm)
Maybe you should use an uncompressed format rather than .oggs for your sound effects. I can't imagine that OGG decompression is free or even cheap. And I wouldn't necessarily expect the system to automatically decompress the file into a buffer internally and read from that (which would be a good idea for short files).
#5
I found out a few things in my research to crush this problem.
first a good website explaining why
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_15854
then I downloaded another sound and looked at the waveform to verify it was seamless. Made sure it was an uncompressed wav and presto seamless thruster.
- Jesse
02/02/2006 (9:21 pm)
Thanks for the tip Smaug.I found out a few things in my research to crush this problem.
first a good website explaining why
http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_15854
then I downloaded another sound and looked at the waveform to verify it was seamless. Made sure it was an uncompressed wav and presto seamless thruster.
- Jesse
#6
02/03/2006 (9:28 am)
If the AudioDescription's isStreaming attribute is set to false, then the whole file gets decompressed into an audio buffer when it is loaded. So, you have a decompression hit when it is loaded, but not when it is played. Ogg files are perfectly fine for sound effects.
Torque Owner Philip Mansfield
Default Studio Name
$EffectAudioType = 0; new AudioDescription(EffectNonLooping) { volume = 1.0; isLooping= false; is3D = false; type = $EffectAudioType; }; new AudioDescription(EffectLooping) { volume = 1.0; isLooping= true; is3D = false; type = $EffectAudioType; };Then define your audio datablocks:// Explosion sfx new AudioProfile(explodeAudio) { filename = "~/client/sounds/explode.ogg"; description = "EffectNonLooping"; preload = false; }; // Thrust sfx new AudioProfile(thrustAudio) { filename = "~/client/sounds/thrust.ogg"; description = "EffectLooping"; preload = false; };Then just play the sound effects as normal. The explosion sfx will play once, the thrust effect will play until explicitly told to stop (which I guess you're doing in the keyUp event).As to seamless looping, you'll nead to just tweak the effect in a sound editor. I use Audacity as it's free and quite simple to use.