One more quick follow up, I've rewritten my `samphold` implementation as
follows:

samphold(c, x) = select2(t, x , _) ~ _ with {
> t = (c : mem) < c;
> };


This is closer to the included `ba.sAndH` implementation but still matches
the behavior of PureData's `samphold~`. With this implementation I have
results working as expected.

I'm still not quite sure why the previous implementation was not working,
but I'm happy with this!


On Sat, Jul 22, 2017 at 10:14 AM, Nick Thompson <[email protected]> wrote:

> I've been digging into this a little more, it seems I can reproduce the
> unexpected behavior with just the following lines.
>
>
>> samphold(c, x) = x * s : + ~ *(1-s) with {
>>   s = (c' < c);
>> };
>>
>
>
>> master = os.phasor(1.0, masterFreq); // masterFreq is something like 4Hz
>
> process = abs(no.noise) : samphold(master);
>
>
> When I compile this with the `plot.cpp` architecture and look at the
> output samples, it's effectively just an abs noise stream. So obviously,
> something seems wrong with my `samphold` implementation.
>
> I'm comparing again to PureData's `samphold~` implementation, and Faust's
> `ba.latch':
> https://github.com/pure-data/pure-data/blob/07a14c540630bc2344a80da3046440
> 5900d556fb/src/d_filter.c#L533
> https://github.com/grame-cncm/faust/blob/master-dev/
> libraries/basics.lib#L723
>
> And oddly enough, my `samphold` implementation there is working as
> expected in the other parts of my dsp. So now I'm really confused by it!
>
> Would love to hear your thoughts if you see what I'm doing wrong.
>
> Thanks,
> Nick
>
> On Thu, Jul 20, 2017 at 10:22 AM, Nick Thompson <[email protected]>
> wrote:
>
>> Hi all,
>>
>> I'm working on a project similar to the Granulator effect in the Faust
>> Playground modules:
>> https://github.com/grame-cncm/faustplayground/blob/master/fa
>> ust-modules/effects/Granulator.dsp
>>
>> But I'm struggling to adapt what I see in the Granulator implementation
>> to fit my use case. Specifically, I have an audio stream, and a "master
>> clock" phasor, and what I want is that on every new cycle of the master
>> phasor, a gate for the audio stream either opens or closes randomly (i.e.
>> multiply by 1.0 or 0.0).
>>
>> Here are the important bits of my implementation:
>>
>> samphold(c, x) = x * s : + ~ *(1-s) with {
>>>   s = (c' < c);
>>> };
>>>
>>
>>
>>> master = os.phasor(1.0, masterFreq); // masterFreq is something like 4Hz
>>>
>>
>>
>>> ratio_env = 0.4;
>>> pulsar = ((master < ratio_env) : @(100)) * (probability > (abs(no.noise)
>>> : samphold(master)));
>>> process = myStream * pulsar;
>>
>>
>> The `pulsar` line is borrowed almost verbatim from the Granulator.dsp
>> file, except that I use the `master` phasor here explicitly instead of the
>> `pulsar` input stream. Also, Granulator.dsp uses `ba.latch` where I'm using
>> my own `samphold` implementation that more closely matches PureData's
>> implementation, as I've had success with this patch in PD but not in Faust.
>>
>> With my implementation here, the output result is basically `myStream`
>> mixed with noise, and I don't understand why? I have a similar result when
>> I just use `pulsar = (probability > (abs(no.noise) : samphold(master)))` as
>> well... why would that not work alone? What is the other part, `((master <
>> ratio_env) : @(100))` supposed to be doing in Granulator.dsp anyway? I
>> don't really understand that part.
>>
>> Any help here would be greatly appreciated!
>>
>> Thank you,
>> Nick
>>
>>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to