[livecode] Re: Vivid: Send a string (specifically a filesystem path) to a synth?

From: Jeffrey Brown <jeffbrown.the_at_gmail.com>
Date: Sat, 7 Jul 2018 12:56:33 -0500

Awesome! I hadn't realized you could create and free synths from Vivid.
That'll be really helpful -- it means I won't have to keep a giant bank of
synths that mostly aren't doing anything.

But I'm getting this error:

   • Variable not in scope: b2i :: BufferId -> I "buf"
   • Perhaps you meant ‘b2_’ (imported from Vivid)

Also, suppose I really wanted to pass a string to SC, for instance to
switch some oscillator from a square wave to a sine wave. Is it possible?

On Sat, Jul 7, 2018 at 12:21 AM <amindfv_at_gmail.com> wrote:

> There are quicker ways to do it (e.g. check out the "play" function), but
> here's how to do it with lots of configurability:
>
>
> {-# 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.
> - We can make a Buffer from lots of file formats, but notably not mp3.
> This is the SC server's limitation, as it can't use the patented mp3
> decoder. ".wav" works, as does .flac, .ogg, and others.
>
> Tom
>
>
> El 6 jul 2018, a las 21:38, Jeffrey Brown <jeffbrown.the_at_gmail.com>
> escribió:
>
> I'm imagining asking a synth to play some sample from a collection. Is it
> possible?
>
> --
> 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>
>
>
> _______________________________________________
> Livecode mailing list -- livecode_at_we.lurk.org
> To unsubscribe send an email to livecode-leave_at_we.lurk.org
>
> _______________________________________________
> Livecode mailing list -- livecode_at_we.lurk.org
> To unsubscribe send an email to livecode-leave_at_we.lurk.org
>


-- 
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>


_______________________________________________
Livecode mailing list -- livecode_at_we.lurk.org
To unsubscribe send an email to livecode-leave_at_we.lurk.org
Received on Sat Jul 07 2018 - 17:56:55 BST

This archive was generated by hypermail 2.4.0 : Sun Aug 20 2023 - 16:02:23 BST