Ask Your Question

How can I show the cycle no. every cycle start?

asked 2016-09-15 18:01:06 -0500

docaroo gravatar image

Hey guys,

I can evaluate

getNow >>= putStrLn . show . floor

to show the cycle number ...

Is there a way I can loop this so that it runs every time the cycle number changes? Basically it would act as a metronome in the console to show me the cycle number which I use for arranging a piece!


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-09-15 18:20:39 -0500

yaxu gravatar image

Hi docaroo,

You can use clocked to run a function every cycle. Here's an example, paste it into a file called metro.hs(or you could download it from, and run it with runhaskell metro.hs

import Sound.Tidal.Tempo
main = clocked onTick
onTick tempo tick =
  putStr $ "cps: " ++ show (cps tempo) ++ " cycle: " ++ show tick ++ "   \r"
edit flag offensive delete link more


Hello! Thanks so much for your reply... that sounds great - just one question - where do I need to have that metro.hs file? I put it in the same folder as my Tidal script but it doesn't work - I'm guessing it needs to be in the Haskell install folder somewherE? Thanks again!

docaroo gravatar imagedocaroo ( 2016-09-15 18:48:57 -0500 )edit

Sorry only just saw your reply.. I think you should be able to put it anywhere. What error do you get when you try to run it?

yaxu gravatar imageyaxu ( 2016-09-18 16:19:47 -0500 )edit

Question Tools


Asked: 2016-09-15 18:01:06 -0500

Seen: 193 times

Last updated: Sep 15 '16