Ask Your Question

How do I play a sound immediately (reset to cycle0)?

asked 2016-09-11 16:41:14 -0500

this post is marked as community wiki

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

Sometimes you want to play a sound IMMEDIATELY starting from the first cycle, which in effect is resetting the current cycle to 0 and starting it immediately. We've discussed this before so what's the best way?

edit retag flag offensive close merge delete


there is a retrig function defined for Emacs. I can't get the definition to work for Atom, but it would be my preferred method to do this. You can look at the Emacs definition:

kindohm gravatar imagekindohm ( 2016-09-11 16:46:47 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2016-09-11 16:45:48 -0500

kindohm gravatar image

One way to do it is by defining something like runnow and using it before the Dirt connection:

let runnow d p = do now <- getNow
                    d $ (nextSam now) ~> p

runnow d1 $ sound "bd sn"

Note: indentation must be kept as shown above.

Just use runnow whenever you wan to reset time back to "zero".

edit flag offensive delete link more

answered 2016-09-11 18:01:01 -0500

bgold gravatar image

This isn't quite the same as "play sound now", but if you stop playback with cps (-1) then when you restart (with a positive cps), the cycle count will begin from zero. So if you evaluate things in this order:

cps (-1)

d1 $ some $ really $ complicated $ pattern

cps 1.0

then when you evaluate the 3rd line it'll start your pattern from the beginning.

edit flag offensive delete link more

answered 2016-09-20 02:53:56 -0500

danielmkarlsson gravatar image

Oooh! Sweet. These are both great. Pretty amazing that the first one does it's thing in time w/ no hickups. If someone (me obviously) still wanted that hickup, rough, immediate, out of time restart feel one would get from just really raw retriggering how would one go about doing that?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-09-11 16:41:14 -0500

Seen: 96 times

Last updated: Sep 20 '16