Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transitions are broken #1045

Open
nkleemann opened this issue Oct 15, 2023 · 1 comment
Open

Transitions are broken #1045

nkleemann opened this issue Oct 15, 2023 · 1 comment

Comments

@nkleemann
Copy link

No matter which orbit a pattern is currently playing on, after using any transition (like xfade or clutch), this pattern get's re-routed to d1.

How to reproduce:

-- plays on second orbit
d2 $ s "bd(3,8)" 

-- bug, now plays on first orbit
xfade 2 $ s "arpy*4" 

However, when orbit is excplicitely given, the bug disappears:

-- plays on second orbit
d2 $ s "bd(3,8)" # orbit 1
-- stays on second orbit, as it should
xfade 2 $ s "arpy*4" # orbit 1

In the Tidal Discord I uploaded a video demo: here

Tidal: 1.9.4
Supercollider: 3.13.0

@Zalastax
Copy link
Collaborator

Zalastax commented Nov 2, 2023

I have found the source of the bug:

The definition of d2 is

d2 = p 2 . (|< orbit 1)

p is just streamReplace

p = streamReplace

And streamReplace replaces a pattern based on it's ID

streamReplace :: Stream -> ID -> ControlPattern -> IO ()
streamReplace s k !pat
= modifyMVar_ (sActionsMV s) (\actions -> return $ (T.StreamReplace k pat) : actions)

The implementation of xfade acts like a streamReplace but during a transition it fades between the patterns. Notice line 76 which is the end state where your new pattern fully replaces the original pattern

xfadeIn :: Time -> Time -> [ControlSignal] -> ControlSignal
xfadeIn _ _ [] = silence
xfadeIn _ _ (pat:[]) = pat
xfadeIn t now (pat:pat':_) = overlay (pat |* gain (now `late` (_slow t envEqR))) (pat' |* gain (now `late` (_slow t (envEq))))

But since your new pattern has not been modified by . (|< orbit 1), the orbit is lost.

I guess the best solution would be if instead of xfade 2 $ pattern you could write xfade $ d2 $ pattern or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants