tidal-vis 0.1.2 → 0.1.3
raw patch · 2 files changed
+22/−3 lines, 2 files
Files
- Sound/Tidal/Vis.hs +21/−2
- tidal-vis.cabal +1/−1
Sound/Tidal/Vis.hs view
@@ -8,6 +8,7 @@ import Sound.Tidal.Parse import Sound.Tidal.Pattern import Sound.Tidal.Utils+import Data.Ratio vPDF = v C.withPDFSurface vSVG = v C.withSVGSurface@@ -24,6 +25,25 @@ mapM_ renderEvent (events pat) C.restore ++vLines sf fn (x,y) pat cyclesPerLine nLines = + sf fn x y $ \surf -> do+ C.renderWith surf $ do + C.save + C.scale x (y / (fromIntegral nLines))+ C.setOperator C.OperatorOver+ C.setSourceRGB 0 0 0 + C.rectangle 0 0 1 1+ C.fill+ mapM_ (\x -> do C.save+ C.translate 0 (fromIntegral x)+ drawLine ((cyclesPerLine * (fromIntegral x)) ~> pat)+ C.restore+ ) [0 .. (nLines - 1)]+ C.restore + where drawLine p = mapM_ renderEvent (events (density cyclesPerLine p))++ renderEvent (_, (s,e), (cs)) = do C.save drawBlocks cs 0 C.restore@@ -31,8 +51,7 @@ drawBlocks [] _ = return () drawBlocks (c:cs) n = do let (RGB r g b) = toSRGB c C.setSourceRGBA r g b 1- -- width hack (for rounding errors?)- C.rectangle x y (w +0.1) h+ C.rectangle x y w h C.fill C.stroke drawBlocks cs (n+1)
tidal-vis.cabal view
@@ -1,5 +1,5 @@ name: tidal-vis-version: 0.1.2+version: 0.1.3 synopsis: Visual rendering for Tidal patterns -- description: homepage: http://yaxu.org/tidal/