Created
October 29, 2017 15:33
-
-
Save kindohm/6b03370dba4800aefd4f41483af3d1aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Sound.Tidal.Utils | |
let fillIn p' p = struct (splitQueries $ Pattern (f p)) p' | |
f p (s,e) = removeTolerance (s,e) $ invert (s-tolerance, e+tolerance) $ arc p (s-tolerance, e+tolerance) | |
invert (s,e) es = map arcToEvent $ foldr remove [(s,e)] (map snd' es) | |
remove (s,e) xs = concatMap (remove' (s, e)) xs | |
remove' (s,e) (s',e') | s > s' && e < e' = [(s',s),(e,e')] -- inside | |
| s > s' && s < e' = [(s',s)] -- cut off right | |
| e > s' && e < e' = [(e,e')] -- cut off left | |
| s <= s' && e >= e' = [] -- swallow | |
| otherwise = [(s',e')] -- miss | |
arcToEvent a = (a,a,"x") | |
removeTolerance (s,e) es = concatMap (expand) $ mapSnds' f es | |
where f (a) = concatMap (remove' (e,e+tolerance)) $ remove' (s-tolerance,s) a | |
expand (a,xs,c) = map (\x -> (a,x,c)) xs | |
tolerance = 0.01 | |
d1 $ (n $ every 4 (fillIn "4") "0 [~ 5] ~ [3 ~] ~ 2 [5 ~]") # s "feel" | |
# speed 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment