Skip to content

Commit

Permalink
calculate tactus from the first cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Apr 18, 2024
1 parent 2e7f02c commit 4f344b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Sound/Tidal/Stepwise.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ s_contract = s_patternify _s_contract

s_patternify :: (a -> Pattern b -> Pattern c) -> (Pattern a -> Pattern b -> Pattern c)
s_patternify f (Pattern _ _ (Just a)) b = f a b
s_patternify f pa p = keepTactus p $ stepJoin $ (`f` p) <$> pa
s_patternify f pa p = stepJoin $ (`f` p) <$> pa

stepJoin :: Pattern (Pattern a) -> Pattern a
stepJoin pp = Pattern q Nothing Nothing
stepJoin pp = Pattern q first_t Nothing
where q st@(State a c) = query (timecat $ retime $ slices $ query (rotL (sam $ start a) pp) (st {arc = Arc 0 1})) st

Check warning on line 125 in src/Sound/Tidal/Stepwise.hs

View workflow job for this annotation

GitHub Actions / build (9.0.1, 3.4.0.0)

Defined but not used: ‘c’

Check warning on line 125 in src/Sound/Tidal/Stepwise.hs

View workflow job for this annotation

GitHub Actions / build (9.0.1, 3.4.0.0)

Defined but not used: ‘c’

Check warning on line 125 in src/Sound/Tidal/Stepwise.hs

View workflow job for this annotation

GitHub Actions / build (9.0.1, 3.4.0.0)

Defined but not used: ‘c’
first_t :: Maybe Rational
first_t = tactus $ timecat $ retime $ slices $ queryArc pp (Arc 0 1)
retime :: [(Time, Pattern a)] -> [(Time, Pattern a)]
retime xs = map (\(dur, pat) -> adjust dur pat) xs
where occupied_perc = sum $ map fst $ filter (isJust . tactus . snd) xs
Expand Down

0 comments on commit 4f344b4

Please sign in to comment.