Work Around Repeat Metadata with Smart Crossfade and Default Action #2339
Kerosel
started this conversation in
Show and tell
Replies: 1 comment
-
Thanks for the feedback and glad you found a way to make it work. Forcing the type to source is unfortunately something that is currently needed when mixing sources with different methods so you did the right thing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So this is a continuation of #2153... @toots I thank you for your work on that issue, but I'm using 2.0.4-preview and I feel like the cure has more problems than the original disease. I've actually started using deduplicate=false in the crossfade now to go back to the way it was. But I did some experimentation and ginned up a work-around. It feels like a kludge, but maybe it'll inspire someone to find a better solution.
I realized early on that the duplication only happened with the default crossfade and that the default uses sequence() while the rest of the crossfade actions use add(). I think Toots told me the problem and I didn't grasp it until now: sequence() relays the metadata from each source as it runs. And that makes sense. In my experimenting I was looking at the metadata immediately after the transition and see the repeat metadata from the old source. Then 5 seconds later (when sequence() kicked over to the new source) I'd see the metadata for the new source.
And then I Read The Fine Manual about add() and it says right there: "Only relay metadata from the first source that is effectively summed." If you use "add(a,b)", it will only relay metadata from the "a" source. All the adds in the crossfade are "add(b,a)", the second source is first in the add() statement and therefore only the metadata from the new source is relayed. No repeat of the old source ("a") metadata.
After much fiddling, I came up with this for a default crossfade:
(I don't usually program in strictly-typed languages and I spent way too much time banging my head against type errors. Hence, each piece being strictly typed as a source. Probably a better way to do it, but this works)
What we have here is 5 seconds of blank, sequenced with the new source, effectively making a 5-second delay before the source starts. Then add() that to the existing source (new delayed source first) and this is a sequence statement that doesn't relay the old metadata because it uses add() to join the sources together.
I can write "default=dcross" in the crossfade statement to make it use this new (and debateably improved) default action for no crossfade. The five seconds are hard-coded for testing, but if should be equal to the "duration" variable of the crossfade.
I spent all of today listening to the stream with this new default action and nothing caught my ear as sounding out of place. Default crossfades ran in sequence just like they did before. And no duplicated metadata entries.
Like I said, this feels kludgy, but it works and I'll use it (and perhaps refine it over time). My hope is this can inspire others to improve on it if it's something they need as well.
Cheers!
Beta Was this translation helpful? Give feedback.
All reactions