Skip to content

Corrects the scaleWithList function #1193

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tidal-core/src/Sound/Tidal/Scales.hs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,20 @@ scaleWith = getScaleMod scaleTable
{- Variant of @scaleWith@ providing a list of modifier functions instead of a single function
-}
scaleWithList :: (Eq a, Fractional a) => Pattern String -> ([[a] -> [a]]) -> Pattern Int -> Pattern a
scaleWithList sp fs p = slowcat $ map (\f -> scaleWith sp f p) fs
scaleWithList _ [] _ = silence
scaleWithList sp (f : []) p = scaleMod sp f p
scaleWithList sp fs p = Pattern q
where
n = length fs
q st =
concatMap (ff st) $
arcCyclesZW (arc st)
ff st a = query pp $ st {arc = a}
where
f = fs !! i
cyc = (floor $ start a) :: Int
i = cyc `mod` n
pp = (scaleMod sp f p)

{- Variant of @getScale@ used to build the @scaleWith@ function
-}
Expand Down