If anyone else is interested, I put some explicitly-commented example code
here[1].
Thanks, Tom!
[1]
Can do! The short answer is to set te doneAction to 0 and then use
the
trigger argument to re-start playback. Playback restarts whenever trigger
goes from 0 to any positive number.
Tom
El 2 may 2019, a las 15:50, Jeffrey Brown <jeffbrown.the(a)gmail.com>
escribió:
In a prior thread[1], Tom describes how to trigger a sample in Vivid:
{-# LANGUAGE DataKinds, ExtendedDefaultRules #-}
import Vivid
foo = sd (0 :: I "buf") $ do
let buf = V::V "buf"
s <- playBuf (buf_ buf, rate_ $ bufRateScale buf ~* 3, doneAction_
2)
out 0 [s,s]
main = do
buf <- newBufferFromFile "the_letter.flac"
synth foo (b2i buf :: I "buf")
A couple notes:
- For fun we play it at 3x speed.
- "doneAction_ 2" means when the buffer is done playing the Synth
frees itself.
- "bufRateScale" converts from the samplerate of the file to the
samplerate of the sc server.
Rather than using `doneAction_ 2`, what if you wanted the synth to
persist, producing silence after the sample is done playing, and to
retrigger the sample at a later point in the same synth?x
[1]
https://we.lurk.org/hyperkitty/list/livecode@we.lurk.org/thread/6JD5SHXPQ...
--
Jeff Brown | Jeffrey Benjamin Brown
Website <
https://msu.edu/~brown202/> | Facebook
<
https://www.facebook.com/mejeff.younotjeff> | LinkedIn
<
https://www.linkedin.com/in/jeffreybenjaminbrown>(spammy, so I often
miss messages here) | Github <
https://github.com/jeffreybenjaminbrown>
_______________________________________________
Haskell-art mailing list -- haskell-art(a)we.lurk.org
To unsubscribe send an email to haskell-art-leave(a)we.lurk.org
_______________________________________________
Haskell-art mailing list -- haskell-art(a)we.lurk.org
To unsubscribe send an email to haskell-art-leave(a)we.lurk.org