[flocking] How to trigger an envelope from JavaScript?

aBe abe at hamoid.com
Thu Apr 14 20:37:23 UTC 2016


Thanks, I'll share code when I have some :)

I've seen the mouse click event. But I had no idea how to apply that to
be able to play a sound when I receive events via web-sockets.

To make a more specific question, how would you change this example:

https://github.com/colinbdclark/Flocking/blob/master/demos/playground/demos/custom-envelope.js

so I'm able to trigger that envelope once every time I receive a
web-socket event? (or just any event coming from my JavaScript code).

Should I create a new synth for each event, play it, and destroy it?

Or let the synth sit there instead, and just restart the envelope each
time I receive an event?

Thank you!

aBe

On 04/14/2016 09:38 PM, Meta wrote:
> ahh yes I know the feeling, I am super newb as well :D
> 
> If you share some more information or better still some code I could
> spend some time trying help you to approach this in an efficient way.
> 
> But from what I understand you want to achieve this particular example
> has the basic functionality you want so maybe could be the base for your
> synth?
> http://flockingjs.org/next/demos/playground/#mouse-click
> 
> also what exactly do you mean by "start a quick and short amplitude
> envelope from JavaScript"??
> 
> B
> 
> 
> On 14/04/2016 22:02, aBe wrote:
>> Hi! Thanks for answering so quick.
>>
>> In one sentence, I have no idea what I'm doing :) I'm comfortable with
>> SuperCollider, but I'm still trying to understand how Flocking works.
>>
>> I did not know I could play individual sounds, because the Playground
>> examples I've seen play one synth forever.
>>
>> Based on your response, I assume I could create (and destroy) synths on
>> the fly? I thought it would be more efficient to just create one synth,
>> and then manipulate all the envelope values. But I'm open to try any
>> approaches.
>>
>> What I'm trying to do is to create some kind of bird like sounds. The
>> sounds last about 3 seconds and have 15 envelope points for amplitudes
>> and frequencies.
>>
>> ps. I don't have much (Flocking) code to show yet, I've been just trying
>> to tweak the existing examples before I port the SuperCollider code.
>>
>> Cheers!
>>
>> a
>>
>>
>>
>> On 04/14/2016 08:50 PM, Meta wrote:
>>> Hello there,
>>>
>>> I am sure someone with better understanding will answer you soon but in
>>> the mean time can I ask for some code example and why exactly you take
>>> this approach?
>>> For example you could trigger multiple sounds individually, why keep one
>>> particular sound muted but "running" using an envelop?
>>>
>>> B
>>>
>>> On 14/04/2016 21:43, aBe wrote:
>>>> Hi hi,
>>>>
>>>> I'm preparing a mobile based collaborative sound installation using
>>>> Flocking, which I hope it's ready next Friday :)
>>>>
>>>> I need to play sounds with fast envelopes based on JavaScript events. In
>>>> the Flocking repo I see examples for:
>>>>
>>>> * Automatic regular retriggering of envelopes (custom-envelope.js, uses
>>>> lfPulse on a gate).
>>>> * Playing sounds on mouse click events.
>>>> * Using valueChangeTrigger, but that seems to be for playing buffers only.
>>>>
>>>> How can I start a quick and short amplitude envelope from JavaScript,
>>>> and then keep it silent, until another event happens?
>>>>
>>>> Is there something like a "valueChangeGate"?
>>>>
>>>> Thank you!
>>>>
>>>> aBe
>>>> _______________________________________________
>>>> flocking mailing list
>>>> flocking at lists.idrc.ocad.ca
>>>> http://lists.idrc.ocad.ca/mailman/listinfo/flocking
>>>>
>>> _______________________________________________
>>> flocking mailing list
>>> flocking at lists.idrc.ocad.ca
>>> http://lists.idrc.ocad.ca/mailman/listinfo/flocking
>>>
>> _______________________________________________
>> flocking mailing list
>> flocking at lists.idrc.ocad.ca
>> http://lists.idrc.ocad.ca/mailman/listinfo/flocking
>>
> 
> _______________________________________________
> flocking mailing list
> flocking at lists.idrc.ocad.ca
> http://lists.idrc.ocad.ca/mailman/listinfo/flocking
> 


More information about the flocking mailing list