Fade out + skip on the same source, plus voice + bg music #2582
ArvyRogerio
started this conversation in
User Support
Replies: 1 comment 1 reply
-
Hi! Have you tried using s = ... # main source
voice = ... # added voice
s = smooth_add(normal=s, special=voice) If the operator doesn't exactly fit your need you can look at its code and see if you can adapt it: # Mixes two streams, with faded transitions between the state when only the
# normal stream is available and when the special stream gets added on top of
# it.
# @category Source / Track Processing
# @flag extra
# @param ~duration Duration of the fade in seconds.
# @param ~p Portion of amplitude of the normal source in the mix.
# @param ~normal The normal source, which could be called the carrier too.
# @param ~special The special source.
def smooth_add(~duration=1., ~p=getter(0.2), ~normal, ~special)
p = getter.function(p)
last_p = ref(p())
def c(fn,s) =
def v() =
fn = !fn
fn()
end
fade.scale(v,s)
end
special_volume = ref(fun () -> 0.)
special = c(special_volume,special)
normal_volume = ref(fun () -> 1.)
normal = c(normal_volume,normal)
def to_special(_,special) =
last_p := p()
q = 1. - !last_p
normal_volume := mkfade(start=1.,stop=!last_p,duration=duration,normal)
special_volume := mkfade(stop=q,duration=duration,special)
special
end
def to_blank(special,b)
normal_volume := mkfade(start=!last_p,duration=duration,normal)
special_volume := mkfade(start=1.-!last_p,duration=duration,special)
sequence([special,b])
end
special = fallback(track_sensitive=false,
transitions=[to_special,to_blank],
[special,blank()])
add(normalize=false,[normal,special])
end |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there! I'm working on a .liq script for some months, and now it's almost done (and amazing). Except for one little thing, that I still cannot do, even I've tried a lot of things :(
My script works this way, basically:
Works great, but, sometimes, I want to insert a pre-recorded voiceover ("acapella"), that has not a fixed length. And I have a 5 minute bg music, that I need to fade out when the voice is over.
My ideia:
thread.run(delay=3.,fun() -> source2.push.uri(!voicefile))
(before I've defined: source1 = add(normalize=false,[source2,source1]))
fade out -> source1 skip (after ~5s of fade out)
Everything is working! But I don't know how to fade out in the current source, and keep on it.
Using source.skip(source1) works perfectly, but I want to fade out the bg music before the skip...
Something like:
def trigger_source2_fadeout() =
get_new_song()
----fade---- here is the problem
source.skip(source1)
()
end
def trigger_source2(m) =
thread.run(delay=source2.remaining()+5.,trigger_source2_fadeout)
end
and: source2.on_track(trigger_source2)
Any ideas?
Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions