Ask Your Question

What are some ways to visualise the current patterns being played?

asked 2016-12-29 06:53:47 -0500

pixelpusher gravatar image

Hi people, what are some helpful and clear ways to visualise (or just otherwise debug) the current state of the partterns being executed by tidal? I mean, to print to console or otherwise see what the current pattern(s) is/are that tidal is chunking through? Thanks!

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2016-12-29 06:56:21 -0500

yaxu gravatar image

updated 2016-12-29 06:57:54 -0500

here's a quick go at a live 'visualiser' in textmode, could definitely be improved!

let makeVisualiser = do mv <- newMVar (silence :: ParamPattern)
                        forkIO $ clocked (visTick mv)
                        return (swapMVar mv)
    visTick mv tempo tick = do p <- readMVar mv
                               mapM_ (\(t,v) -> forkIO $ do {threadDelay (floor $ 1000000 * t); putStrLn (show v)}) (values p)
       values p = map (\(t, _, v) -> (toSecs t, v)) $ seqToRelOnsetDeltas (toRational tick, toRational (tick+1)) p
       toSecs t = t / (Sound.Tidal.Tempo.cps tempo)

you might need to import these

import Control.Concurrent
import Control.Concurrent.MVar

you run it like this

vis <- makeVisualiser
vis $ sound "bd sn*2"

I once did a live cyclic visualiser, I'll have to dig the code out for that:

edit flag offensive delete link more


hmmm. I tried running this and got 'Variable not in scope: seqToRelOnsetDeltas'. did the import before. where did I go wrong?

dndrks gravatar imagedndrks ( 2017-01-03 22:54:16 -0500 )edit

answered 2016-12-29 09:39:44 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >1 is welcome to improve it.

Via @lennart: if you have run d1 $ sound "bd sn", you can always omit the d1 and run it to have tidal print the evaluated pattern (first cycle though, if you want another cycle, you have to use arc (x,y) on the pattern where x and y are begin and end cycles.

if you are interested in what it is doing right now you would have to use getNow to get the current beat and then use that information and pass it into arc .... $ sound "bd sn" (not yet sure what to put in the ...)

since getNow is an IO Action this has to be run within a do block, something like:

do now <- getNow; arc (now, now + 1) $ sound "bd sn"

should always print one cycle of events from the pattern starting at the current beat (you can round up now to the upcoming cycle with nextSam)

I may mix up the order of args in arc, check :t arc it may be the other way around

edit flag offensive delete link more

Question Tools


Asked: 2016-12-29 06:53:47 -0500

Seen: 250 times

Last updated: Dec 29 '16