hold a value Server Side

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

hold a value Server Side

DDGG
dear list,

Does it exists a UGen which allows to store value in order to compare it
with the following incoming one?
Something like this in the language:
(
fork{
        var oldNumber = 5;
       
        inf.do({
                var newNumber = 10.rand;
                [oldNumber, newNumber].post;
                if(newNumber < oldNumber, {-1.postln}, {1.postln});
                oldNumber = newNumber;
                0.1.wait;
        })
}
)
I guess that the structure should be similar to:
(
SynthDef(\compare,{
        var  
        aNumber = LFNoise0.kr(10, 10),
        stored = //past aNumber value
        Select.kr(aNumber < stored, [1,-1]).poll;
        0;
}).play
)

but I'm missing the UGen and the consequent order of execution. Any
suggestion?
thanks
ddgg




--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: hold a value Server Side

Josh Parmenter
I usually do this with delays... for instance, on the output of Amplitude, I’ll check the current value against a delayed version to look for spikes.
Delays and Latch combos may also do what you want.
Hope that helps
Josh

/*
Josh Parmenter
www.realizedsound.net/josh
*/

> On Feb 12, 2018, at 06:33, [hidden email] wrote:
>
> dear list,
>
> Does it exists a UGen which allows to store value in order to compare it
> with the following incoming one?
> Something like this in the language:
> (
> fork{
>    var oldNumber = 5;
>    
>    inf.do({
>        var newNumber = 10.rand;
>        [oldNumber, newNumber].post;
>        if(newNumber < oldNumber, {-1.postln}, {1.postln});
>        oldNumber = newNumber;
>        0.1.wait;
>    })
> }
> )
> I guess that the structure should be similar to:
> (
> SynthDef(\compare,{
>    var  
>    aNumber = LFNoise0.kr(10, 10),
>    stored = //past aNumber value
>    Select.kr(aNumber < stored, [1,-1]).poll;
>    0;    
> }).play
> )
>
> but I'm missing the UGen and the consequent order of execution. Any
> suggestion?
> thanks
> ddgg
>
>
>
>
> --
> Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Aw: [sc-users] hold a value Server Side

daniel-mayer
In reply to this post by DDGG
To compare on a per-sample base, see HPZ1 and Slope.
If you want to store and compare at certain (triggered) points in time, as Josh said, see Latch.

Regards

Daniel

-------------------------
http://daniel-mayer.at
-------------------------


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: hold a value Server Side

DDGG
In reply to this post by Josh Parmenter
absolutely!
this should work then:

(
SynthDef(\hold,{
        var
        in = SinOsc.kr(0.5),
        prev = Delay1.kr(in),
        hold = Latch.kr(prev, Impulse.kr(ControlRate.ir)),
        comparison = Select.kr(hold < in, [-1, 1]);
        comparison.poll;
        0;
}).play
)

right?
thank you josh
ddgg



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: hold a value Server Side

Josh Parmenter
Yep! I think so. If it doesn’t quite work, let us know what seems off and we can go from there.
Josh


> On Feb 12, 2018, at 7:17 AM, [hidden email] wrote:
>
> absolutely!
> this should work then:
>
> (
> SynthDef(\hold,{
> var
> in = SinOsc.kr(0.5),
> prev = Delay1.kr(in),
> hold = Latch.kr(prev, Impulse.kr(ControlRate.ir)),
> comparison = Select.kr(hold < in, [-1, 1]);
> comparison.poll;
> 0;
> }).play
> )
>
> right?
> thank you josh
> ddgg
>
>
>
> --
> Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Aw: [sc-users] hold a value Server Side

DDGG
In reply to this post by daniel-mayer
Reply | Threaded
Open this post in threaded view
|

Re: hold a value Server Side

DDGG
In reply to this post by Josh Parmenter
Actually I'm not sure whether the Impulse.kr(ControlRate.ir) is working...
hold is outputting 0s...



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Aw: [sc-users] Re: hold a value Server Side

daniel-mayer

> Gesendet: Montag, 12. Februar 2018 um 16:40 Uhr
> Von: [hidden email]
> An: [hidden email]
> Betreff: [sc-users] Re: hold a value Server Side
>
> Actually I'm not sure whether the Impulse.kr(ControlRate.ir) is working...
> hold is outputting 0s...

In that case you don't have a trigger anymore (no zeros),

Greetings

Daniel

-------------------------
http://daniel-mayer.at
-------------------------


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|

Re: Aw: [sc-users] Re: hold a value Server Side

DDGG
Reply | Threaded
Open this post in threaded view
|

Re: hold a value Server Side

julian.rohrhuber
In reply to this post by DDGG
this seems pretty close to what LastValue does.


> On 12.02.2018, at 16:17, [hidden email] wrote:
>
> absolutely!
> this should work then:
>
> (
> SynthDef(\hold,{
> var
> in = SinOsc.kr(0.5),
> prev = Delay1.kr(in),
> hold = Latch.kr(prev, Impulse.kr(ControlRate.ir)),
> comparison = Select.kr(hold < in, [-1, 1]);
> comparison.poll;
> 0;
> }).play
> )
>
> right?
> thank you josh
> ddgg
>
>
>
> --
> Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


signature.asc (849 bytes) Download Attachment