Author Topic: Seamless sound looping  (Read 2846 times)

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Seamless sound looping
« on: November 20, 2017, 03:25:25 AM »
When using samples in a (VoiceAttack action-based)loop, for example as an alarm or even background system noise, there is a noticeable gap between the sample ending, and starting again.

The most likely solution I can see to this would be to have the built-in audio system(s) loop a file natively, if it is possible.

Such an action would have to run asynchronously(and be mutually exclusive with "Wait until sound completes before continuing command"), so would currently only end when the "Stop Sounds" action, or the "This completes all other currently-playing sound" option are called.

If there is a way to make a specific sound loop stop without stopping all other sounds/loops, that would of course be handy.
A "Loop sound while" action, for example, which would monitor a variable the same way a regular while loop does; Though that would likely necessitate an additional watchdog loop per looping sound to monitor said variable, unless the engine raises an event when the loop comes around.
On the other hand, an external loop could possibly allow for a "fade out when loop ends" option that can stop the sound immediately mid-playback(very useful for samples longer than a few seconds).

Technomancer

  • Jr. Member
  • **
  • Posts: 98
  • I have a bad feeling about this...
Re: Seamless sound looping
« Reply #1 on: August 13, 2018, 11:50:40 PM »
Bumping this, as I was going to request it also.

I decided to read through and see if anyone else had requested it, and lo and behold, Pfeil beat me to it by "a bit" :P

Technomancer

  • Jr. Member
  • **
  • Posts: 98
  • I have a bad feeling about this...
Re: Seamless sound looping
« Reply #2 on: August 16, 2018, 05:29:19 PM »
Found a "workaround" to the gap in the sound when you loop (assuming you're using "Wait until this sound completes..." to pause the loop before restarting it):

Don't check "Wait until this sound completes...", instead use a pause that has to be roughly .4 to .5 seconds longer than the sound (not sure why, I found I had to use a pause that is longer than the sound. Possibly, Windows is not reporting fractions of a second in the Properties of the file).

It takes a couple of minutes to get the timing just right, but I've used it on some "Battle Music" sounds (using "Here they come!" from Star Wars as my Elite Dangerous dogfight music) and it's almost perfect.

I know Gary will add this request in his next beta  ;)   :P  but this will work for now.

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2832
Re: Seamless sound looping
« Reply #3 on: August 16, 2018, 06:28:15 PM »
I have it on my list to add sound file caching, so, I'm thinking that would help at least somewhat.

Technomancer

  • Jr. Member
  • **
  • Posts: 98
  • I have a bad feeling about this...
Re: Seamless sound looping
« Reply #4 on: August 16, 2018, 09:14:18 PM »
YAAAAAAAAY!!!  ;D