Skip to content

Commit

Permalink
swap function
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Dec 19, 2018
1 parent 36759ee commit ac34671
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Sound/Tidal/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1654,3 +1654,7 @@ smooth p = Pattern Analog $ \st@(State a cm) -> tween st a $ query monoP (State
| otherwise = fromRational $ (eventPartStart e - wholeStart e) / (delta' $ whole e)
delta' a = stop a - start a
monoP = mono p

-- | Takes a list of tuples, in order to swap values in the given pattern
swap :: Eq a => [(a, b)] -> Pattern a -> Pattern b
swap things p = filterJust $ (\x -> lookup x things) <$> p

0 comments on commit ac34671

Please sign in to comment.