def smooth_add(~delay=0.5,~p=0.2,~normal,~special) d = delay fade.final = fade.final(duration=d*2.) fade.initial = fade.initial(duration=d*2.) q = 1. - p c = amplify fallback(track_sensitive=false, [special,normal], transitions=[ fun(normal,special)-> add(normalize=false, [c(p,normal), c(q,fade.final(type="sin",normal)), sequence([blank(duration=d),c(q,special)])]), fun(special,normal)-> add(normalize=false, [c(p,normal), c(q,fade.initial(type="sin",normal))]) ]) end