• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

P3D v5 DSD Sound Gauge Question

Messages
15
Country
unitedstates
Hello,

I've had incredible success using Doug Dawson's 64-bit gauge to make many system sounds on various airplanes.

The thing I was always wondering was why I always get a very short but very noticable gap between sounds that are single-play and looping. Is there a better way for me to code it? It's also worth noting I NEVER have this issue transitioning a loop sound to a single play sound.

Here is a video example, at 5 seconds you can clearly hear the transition from the start sound to the loop sound. Upon shutting down, you can clearly hear it's a very smooth transition and can barely tell that it's two different sound files.

Here's an example of the code I use, could it be better?

<!-- Equipment Cooling Sounds -->

<!-- Equipment cooling / bus powered on Sound -->
(L:AC_POWER_ON,number) 1 ==
(L:EQUIP_FANS_State,number) 0 == and
if{ 1 (>L:INT_EQUIP_FANS_START,number) 1 (>L:EQUIP_FANS_State,number) }

<!-- Check if start sound has been played, then switch sound control state -->
(L:EQUIP_FANS_State,number) 1 ==
(L:INT_EQUIP_FANS_START,number) 0 == and
if{ 2 (>L:EQUIP_FANS_State,number) }

<!-- play the loop sound -->
(L:AC_POWER_ON,number) 1 ==
(L:EQUIP_FANS_State,number) 2 == and
(L:INT_EQUIP_FANS_RUN,number) 0 == and
if{ 2 (>L:INT_EQUIP_FANS_RUN,number) }

<!-- End Loop and play "off" sound when AC power is lost, then reset control variable -->
(L:AC_POWER_ON,number) 0 ==
(L:EQUIP_FANS_State,number) 2 == and
if{ 1 (>L:INT_EQUIP_FANS_STOP,number) 0 (>L:INT_EQUIP_FANS_RUN,number) 0 (>L:EQUIP_FANS_State,number) }
 
Last edited:

DragonflightDesign

Resource contributor
Messages
788
Country
northernireland
If you're loading the sound files from disc before playing them then yes, Doug did say there could be a slight delay. I've confirmed that. To eliminate the delay, load them all into memory when you load the aircraft If that's possible with XML).
 
Messages
15
Country
unitedstates
If you're loading the sound files from disc before playing them then yes, Doug did say there could be a slight delay. I've confirmed that. To eliminate the delay, load them all into memory when you load the aircraft If that's possible with XML).

Thanks for the reply! I totally understand that. One issue: let's say the sound has already played, in theory wouldn't it be in memory until the gauge is reloaded or the sim quit? I'm having this slight delay even after playing a sound mulitple times. Or should I just load them to memory via XML anyways?
 
Messages
15
Country
unitedstates
An update, tried pre-loading the sound using the "12" variable command, but didn't change the issue.
 

DragonflightDesign

Resource contributor
Messages
788
Country
northernireland
If you preload the sounds then they stay in memory until the sim quits. If you load from disc then the buffer is cleared as soon as the sound has finished playing to prevent memory leaks. I have the source code for Doug's DSDSound gauge but what I don't have is the source code for the library he created to drive it. Consequently I can't give you a better answer.
 
Messages
445
Country
austria
As far as i understand you have 3 Sounds.
and the loop sound will played if the start sound is zero. so there is most probably a sound gap.
The DSD sound gauge offers the option to fade in or fade out.
or you use a timer.

btw. very nice sound.
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
As far as i understand you have 3 Sounds.
and the loop sound will played if the start sound is zero. so there is most probably a sound gap.
And for that control reason, there WILL always be a gap between the first and second sound, caused by the scheduling of your XML gauges and the XMLsound gauge.
Depending on that order: min. between 55 and 110 msec; which will be audible.
Reason is the communication between the two gauges via Lvars (and the XML gauge running at max. 18 Hz).
Because in your gauge logic, you start the second sound when the first sound has stopped playing.

So it's not really a problem of the sound allready being in memory or not (although that will help, but not solve it completely).

IMO, the only way to avoid such a cap, is to not use the line
(L:INT_EQUIP_FANS_START,number) 0 ==
to start the second sound, but instead: build in a timer (just a bit shorter than the duration of the first sound).
And:
- Start that timer when you start the first sound.
- When timer elapses (in your XML code), stop the first sound (which is near it's end) AND start the (repetitive) second sound in the same XML gauge code schedule.
Disadvantage of course, is that this timer in the XML gauge now determines the transition (and not the actual duration of the first sound).
So if you ever shorten this duration, you may introduce another cap.

Rob
 
Messages
15
Country
unitedstates
And for that control reason, there WILL always be a gap between the first and second sound, caused by the scheduling of your XML gauges and the XMLsound gauge.
Depending on that order: min. between 55 and 110 msec; which will be audible.
Reason is the communication between the two gauges via Lvars (and the XML gauge running at max. 18 Hz).
Because in your gauge logic, you start the second sound when the first sound has stopped playing.

So it's not really a problem of the sound allready being in memory or not (although that will help, but not solve it completely).

IMO, the only way to avoid such a cap, is to not use the line
(L:INT_EQUIP_FANS_START,number) 0 ==
to start the second sound, but instead: build in a timer (just a bit shorter than the duration of the first sound).
And:
- Start that timer when you start the first sound.
- When timer elapses (in your XML code), stop the first sound (which is near it's end) AND start the (repetitive) second sound in the same XML gauge code schedule.
Disadvantage of course, is that this timer in the XML gauge now determines the transition (and not the actual duration of the first sound).
So if you ever shorten this duration, you may introduce another cap.

Rob

Makes perfect sense, thanks a lot. I will work on this. It will be a fun yet tedious project! haha

I really appreciate you all taking the time to help me.
 

rcbarend

Resource contributor
Messages
435
Country
netherlands
Makes perfect sense, thanks a lot. I will work on this. It will be a fun yet tedious project! haha

I really appreciate you all taking the time to help me.
PS. It also explains why you never have this "gap" problem when you have a repetitive sound followed by single-shot sound.
Because you stop the repetitive sound and start the single-shot sound in the same XML gauge schedule.

And Yes, a challenge to get it perfect ....
But solving this kind of detail makes developping such stuff really interesting (from a designer point-of-view).
Cause I'm willing to make a bet that no-one (except you as designer) would ever have noticed this 'cap. ...LoL


Rob
 
Top