El 7 jul 2018, a las 14:18, amindfv@gmail.com escribió:

Responses inline:

El 7 jul 2018, a las 13:56, Jeffrey Brown <jeffbrown.the@gmail.com> escribió:

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.


Yep! You shouldn't need sclang for anything - Vivid can do anything it can.

But I'm getting this error:

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


Are you running an old version of Vivid? Any version 0.3.* should have it.

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?


Unfortunately/fortunately the SC server doesn't let you change a signal graph at runtime like this.

Your best bet, if you wanted to do a switch, would be to have both the square wave and the saw wave in the graph, and change what you multiply

Something like:

sd (0 :: I "switch") $ do
   s0 <- lfPulse (freq_ 440)
   s1 <- lfSaw (freq_ 440)
   s <- (V::V "switch") ~* s0
        ~+ (1 ~- (V::V "switch")) ~* s1
   ...

Then if you set "switch" to 0 you get all saw wave, and to 1 and you get all square wave. (And, at 0.5 an even mix of each)

You _can_ send strings to the sc server, but I don't know of any time you need to in Vivid. If you need to for some reason there's always the vivid-osc package (which vivid uses)


Sorry, this was overly broad. We send strings to the SC server all the time- eg to load a buffer from a file. What I was talking about was sending strings directly to a synth.

Tom

On Sat, Jul 7, 2018 at 12:21 AM <amindfv@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@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   |   Facebook   |   LinkedIn(spammy, so I often miss messages here)   |   Github   
_______________________________________________
Livecode mailing list -- livecode@we.lurk.org
To unsubscribe send an email to livecode-leave@we.lurk.org
_______________________________________________
Livecode mailing list -- livecode@we.lurk.org
To unsubscribe send an email to livecode-leave@we.lurk.org


--
Jeff Brown | Jeffrey Benjamin Brown
Website   |   Facebook   |   LinkedIn(spammy, so I often miss messages here)   |   Github   
_______________________________________________
Livecode mailing list -- livecode@we.lurk.org
To unsubscribe send an email to livecode-leave@we.lurk.org