liquidsoap icon indicating copy to clipboard operation
liquidsoap copied to clipboard

Transitions for fallback does not work as expected

Open smimram opened this issue 3 years ago • 3 comments

Consider the following script:

log.level.set(5)
s = sine(duration=5.)
m = sine(500.)
def f(a, b)
  add(normalize=false, [fade.out(a), fade.in(b)])
end
s = fallback(transition_length=4., transitions=[f, f], [s, m])
output(s)

The source s plays a sine at 440Hz for 5 seconds and the source m plays a sine at 500Hz. We have a fallback between the two with a transition of 4 seconds, which adds s add m respectively faded out and in for 3 seconds (the default duration for the fades). In theory, we should have a nice fade. In practice, here is what we get: Screenshot from 2021-03-24 17-47-32 This is not what I'd call a successful fade.

Since fallback is implemented with switch, I presume that the later is also affected. I also observe the same effect with rotate for which we should really know in advance when we are going to perform a transition...

A similar script using cross is performing as expected:

log.level.set(5)
s = sequence([sine(duration=5.), sine(500.)])
s = amplify(0.5, s)
def f(pa, pb, ma, mb, a, b)
  add(normalize=false, [fade.out(a), fade.in(b)])
end
s = cross(duration=4., f, s)
output(s)

smimram avatar Mar 24 '21 16:03 smimram

On a track_sensitive=true fallback, this is actually the expected transition. It is triggered at the end of the track so there is no more data to fade out. The right way to achieve what you are trying to do is via a crossfade. I'm open to suggestion as to how we could make it better, the old source argument is still useful as it will in fact have data when you do a track_sensitive=false transition..

Maybe something in the logs? "It appear that you are using the old source in a transition involving a switch with track_sensitive=true. You should be aware that in this case, the old source will not have any data to use for the transition"?

toots avatar Mar 28 '21 22:03 toots

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 09:04 stale[bot]

I'm in favor of removing transitions from fallback/switches and using the more generic crossfade functionality. These transitions have limitations that confuses people and also complicates the underlying operator code.

toots avatar Apr 19 '22 01:04 toots