[Csnd] control-signal change based on other control-signal (no switch/trigger)

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

[Csnd] control-signal change based on other control-signal (no switch/trigger)

Jeanette C.
Hey hey,
I have the following challenge, to which I haven't found an elegant solution
yet. Perhaps you know one?

I have a moving signal (ksrc) and when the signal reaches a certain value a
momentary dip or permanent change needs to be applied to another signal kdest.
Since I discovered that control signals might just pass through an exact value
that I like a proximity would better do. :) So:
if ksrc approx changevalue
   apply change to kdest
endif

A dip can be created with line/expon, I guess, so I'd rather start the change
in time before the event. So:
if (ksrc + delta) approx changevalue

Is there something clever/simple to be done about it?

Best wishes,

jeanette

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

Don't, don't let me be the last to know
Don't hold back, just let it go <3
(Britney Spears)

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

thorin kerr
Not sure I completely understand the scenario...

Is this the idea?

if ((ksrc < (khello + ktolerate)) && (ksrc > (khello - ktolerate))) then
    kdest = kdest - 1/kr ; or whatever dipping code you need

Thorin

On Fri, 5 Oct. 2018, 3:42 am Jeanette C., <[hidden email]> wrote:
Hey hey,
I have the following challenge, to which I haven't found an elegant solution
yet. Perhaps you know one?

I have a moving signal (ksrc) and when the signal reaches a certain value a
momentary dip or permanent change needs to be applied to another signal kdest.
Since I discovered that control signals might just pass through an exact value
that I like a proximity would better do. :) So:
if ksrc approx changevalue
   apply change to kdest
endif

A dip can be created with line/expon, I guess, so I'd rather start the change
in time before the event. So:
if (ksrc + delta) approx changevalue

Is there something clever/simple to be done about it?

Best wishes,

jeanette

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

Don't, don't let me be the last to know
Don't hold back, just let it go <3
(Britney Spears)

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

joachim-3
the problem might be that in this +/- ktolerate range you probably get
more than one k-cycle where it becomes true.

if the ksrc signal is not jumping, and it is not about "reaching" but
"crossing" a line (or threshold), i would compare the ksrc in this
k-cycle with the previous one, for instance:

instr SignalSensor
  kSig poscil 1, 1
  kPrevSig init 0
  if kSig >= 0.9 && kPrevSig < 0.9 then
   event "i", "Pling", 0, 1
  endif
  kPrevSig = kSig
endin
schedule "SignalSensor", 0, 5

instr Pling
aOut poscil transeg:a(.2,p3,-6,0), random:i(400,800)
out aOut, aOut
endin

        joachim



On 05/10/18 01:41, thorin kerr wrote:

> Not sure I completely understand the scenario...
>
> Is this the idea?
>
> if ((ksrc < (khello + ktolerate)) && (ksrc > (khello - ktolerate))) then
>     kdest = kdest - 1/kr ; or whatever dipping code you need
>
> Thorin
>
> On Fri, 5 Oct. 2018, 3:42 am Jeanette C., <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hey hey,
>     I have the following challenge, to which I haven't found an elegant
>     solution
>     yet. Perhaps you know one?
>
>     I have a moving signal (ksrc) and when the signal reaches a certain
>     value a
>     momentary dip or permanent change needs to be applied to another
>     signal kdest.
>     Since I discovered that control signals might just pass through an
>     exact value
>     that I like a proximity would better do. :) So:
>     if ksrc approx changevalue
>        apply change to kdest
>     endif
>
>     A dip can be created with line/expon, I guess, so I'd rather start
>     the change
>     in time before the event. So:
>     if (ksrc + delta) approx changevalue
>
>     Is there something clever/simple to be done about it?
>
>     Best wishes,
>
>     jeanette
>
>     --
>       * Website: http://juliencoder.de - for summer is a state of sound
>       * SoundCloud: https://soundcloud.com/jeanette_c
>       * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>       * GitHub: https://github.com/jeanette-c
>       * Twitter: https://twitter.com/jeanette_c_s
>
>     Don't, don't let me be the last to know
>     Don't hold back, just let it go <3
>     (Britney Spears)
>
>     Csound mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     Send bugs reports to
>             https://github.com/csound/csound/issues
>     Discussions of bugs and features can be posted here
>
> Csound mailing list [hidden email]
> <mailto:[hidden email]>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

Jeanette C.
Hi Joachim and Thorin,
Oct 5 2018, joachim heintz has written:

> the problem might be that in this +/- ktolerate range you probably get more
> than one k-cycle where it becomes true.
Alas yes.
>
> if the ksrc signal is not jumping, and it is not about "reaching" but
> "crossing" a line (or threshold), i would compare the ksrc in this k-cycle
> with the previous one, for instance:
...
That's what I've been doing, but it didn't look elegant. I thought I was
missing a clever point. It seems I'm stuck with it, if I want to do it
that way.

Best wishes,

Jeanette

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

You should never try to change me
I can be nobody else
And I like the way I am <3
(Britney Spears)

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

Jeanette C.
In reply to this post by thorin kerr
Oct 5 2018, thorin kerr has written:
...
> if ((ksrc < (khello + ktolerate)) && (ksrc > (khello - ktolerate))) then
>    kdest = kdest - 1/kr ; or whatever dipping code you need
That isn't a good formula for triggering, but as one generally can't
easly estimate the signal points of ksrc, this brought up another idea:
kdelta = abs(khello - ksrc)
if kdelta < threshold
   kdest = kdelta * scale
That could also be:
   kdest = kdelta * (threshold - scale)
Still, a lot to do, but certainly two working starting points.

Thanks both of you again,

Jeanette

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

You should never try to change me
I can be nobody else
And I like the way I am <3
(Britney Spears)

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

Vincent
In reply to this post by joachim-3
For this kind of mechanism:

kPrevSig init 0
  if kSig >= 0.9 && kPrevSig < 0.9 then
   event "i", "Pling", 0, 1
  endif
  kPrevSig = kSig

you can also use the opcode trigger  with kmode = 1

On Fri, Oct 5, 2018 at 9:49 AM joachim heintz <[hidden email]> wrote:
the problem might be that in this +/- ktolerate range you probably get
more than one k-cycle where it becomes true.

if the ksrc signal is not jumping, and it is not about "reaching" but
"crossing" a line (or threshold), i would compare the ksrc in this
k-cycle with the previous one, for instance:

instr SignalSensor
  kSig poscil 1, 1
  kPrevSig init 0
  if kSig >= 0.9 && kPrevSig < 0.9 then
   event "i", "Pling", 0, 1
  endif
  kPrevSig = kSig
endin
schedule "SignalSensor", 0, 5

instr Pling
aOut poscil transeg:a(.2,p3,-6,0), random:i(400,800)
out aOut, aOut
endin

        joachim



On 05/10/18 01:41, thorin kerr wrote:
> Not sure I completely understand the scenario...
>
> Is this the idea?
>
> if ((ksrc < (khello + ktolerate)) && (ksrc > (khello - ktolerate))) then
>     kdest = kdest - 1/kr ; or whatever dipping code you need
>
> Thorin
>
> On Fri, 5 Oct. 2018, 3:42 am Jeanette C., <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hey hey,
>     I have the following challenge, to which I haven't found an elegant
>     solution
>     yet. Perhaps you know one?
>
>     I have a moving signal (ksrc) and when the signal reaches a certain
>     value a
>     momentary dip or permanent change needs to be applied to another
>     signal kdest.
>     Since I discovered that control signals might just pass through an
>     exact value
>     that I like a proximity would better do. :) So:
>     if ksrc approx changevalue
>        apply change to kdest
>     endif
>
>     A dip can be created with line/expon, I guess, so I'd rather start
>     the change
>     in time before the event. So:
>     if (ksrc + delta) approx changevalue
>
>     Is there something clever/simple to be done about it?
>
>     Best wishes,
>
>     jeanette
>
>     --
>       * Website: http://juliencoder.de - for summer is a state of sound
>       * SoundCloud: https://soundcloud.com/jeanette_c
>       * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>       * GitHub: https://github.com/jeanette-c
>       * Twitter: https://twitter.com/jeanette_c_s
>
>     Don't, don't let me be the last to know
>     Don't hold back, just let it go <3
>     (Britney Spears)
>
>     Csound mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     Send bugs reports to
>             https://github.com/csound/csound/issues
>     Discussions of bugs and features can be posted here
>
> Csound mailing list [hidden email]
> <mailto:[hidden email]>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

joachim-3
very nice, thanks!  actually i didn't know about trigger opcode ...

i think in this case it is kmode=0, but this doesn't matter.

so the code would be:
  kSig poscil 1, 1
  if trigger(kSig,.9,0)==1 then
   event "i", "Pling", 0, 1
  endif

cheers -
        joachim


On 05/10/18 10:17, Vincent Michalke wrote:

> For this kind of mechanism:
>
>     kPrevSig init 0
>       if kSig >= 0.9 && kPrevSig < 0.9 then
>        event "i", "Pling", 0, 1
>       endif
>       kPrevSig = kSig
>
>
> you can also use the opcode /trigger/  with kmode = 1
>
> On Fri, Oct 5, 2018 at 9:49 AM joachim heintz <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     the problem might be that in this +/- ktolerate range you probably get
>     more than one k-cycle where it becomes true.
>
>     if the ksrc signal is not jumping, and it is not about "reaching" but
>     "crossing" a line (or threshold), i would compare the ksrc in this
>     k-cycle with the previous one, for instance:
>
>     instr SignalSensor
>       kSig poscil 1, 1
>       kPrevSig init 0
>       if kSig >= 0.9 && kPrevSig < 0.9 then
>        event "i", "Pling", 0, 1
>       endif
>       kPrevSig = kSig
>     endin
>     schedule "SignalSensor", 0, 5
>
>     instr Pling
>     aOut poscil transeg:a(.2,p3,-6,0), random:i(400,800)
>     out aOut, aOut
>     endin
>
>             joachim
>
>
>
>     On 05/10/18 01:41, thorin kerr wrote:
>     > Not sure I completely understand the scenario...
>     >
>     > Is this the idea?
>     >
>     > if ((ksrc < (khello + ktolerate)) && (ksrc > (khello -
>     ktolerate))) then
>     >     kdest = kdest - 1/kr ; or whatever dipping code you need
>     >
>     > Thorin
>     >
>     > On Fri, 5 Oct. 2018, 3:42 am Jeanette C., <[hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>     >
>     >     Hey hey,
>     >     I have the following challenge, to which I haven't found an
>     elegant
>     >     solution
>     >     yet. Perhaps you know one?
>     >
>     >     I have a moving signal (ksrc) and when the signal reaches a
>     certain
>     >     value a
>     >     momentary dip or permanent change needs to be applied to another
>     >     signal kdest.
>     >     Since I discovered that control signals might just pass through an
>     >     exact value
>     >     that I like a proximity would better do. :) So:
>     >     if ksrc approx changevalue
>     >        apply change to kdest
>     >     endif
>     >
>     >     A dip can be created with line/expon, I guess, so I'd rather start
>     >     the change
>     >     in time before the event. So:
>     >     if (ksrc + delta) approx changevalue
>     >
>     >     Is there something clever/simple to be done about it?
>     >
>     >     Best wishes,
>     >
>     >     jeanette
>     >
>     >     --
>     >       * Website: http://juliencoder.de - for summer is a state of
>     sound
>     >       * SoundCloud: https://soundcloud.com/jeanette_c
>     >       * Youtube:
>     https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>     >       * GitHub: https://github.com/jeanette-c
>     >       * Twitter: https://twitter.com/jeanette_c_s
>     >
>     >     Don't, don't let me be the last to know
>     >     Don't hold back, just let it go <3
>     >     (Britney Spears)
>     >
>     >     Csound mailing list
>     >     [hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>
>     >     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     >     Send bugs reports to
>     >             https://github.com/csound/csound/issues
>     >     Discussions of bugs and features can be posted here
>     >
>     > Csound mailing list [hidden email]
>     <mailto:[hidden email]>
>     > <mailto:[hidden email] <mailto:[hidden email]>>
>     > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
>     > https://github.com/csound/csound/issues Discussions of bugs and
>     features
>     > can be posted here
>
>     Csound mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>     Send bugs reports to
>             https://github.com/csound/csound/issues
>     Discussions of bugs and features can be posted here
>
> Csound mailing list [hidden email]
> <mailto:[hidden email]>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to
> https://github.com/csound/csound/issues Discussions of bugs and features
> can be posted here

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

joachim-3
In reply to this post by Jeanette C.
hi jeanette -

i have to disagree here.  this code is *very* elegant =)

best -
        joachim



On 05/10/18 10:01, Jeanette C. wrote:

> Hi Joachim and Thorin,
> Oct 5 2018, joachim heintz has written:
>
>> the problem might be that in this +/- ktolerate range you probably get
>> more than one k-cycle where it becomes true.
> Alas yes.
>>
>> if the ksrc signal is not jumping, and it is not about "reaching" but
>> "crossing" a line (or threshold), i would compare the ksrc in this
>> k-cycle with the previous one, for instance:
> ...
> That's what I've been doing, but it didn't look elegant. I thought I was
> missing a clever point. It seems I'm stuck with it, if I want to do it
> that way.
>
> Best wishes,
>
> Jeanette
>

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

Jeanette C.
Oct 5 2018, joachim heintz has written:

> hi jeanette -
>
> i have to disagree here.  this code is *very* elegant =)
Seeing that it's you, there's nothing but to bow to the master. You've written
some very nice code.

>
> best -
> joachim
>
>
>
> On 05/10/18 10:01, Jeanette C. wrote:
>> Hi Joachim and Thorin,
>> Oct 5 2018, joachim heintz has written:
>>
>>> the problem might be that in this +/- ktolerate range you probably get
>>> more than one k-cycle where it becomes true.
>> Alas yes.
>>>
>>> if the ksrc signal is not jumping, and it is not about "reaching" but
>>> "crossing" a line (or threshold), i would compare the ksrc in this
>>> k-cycle with the previous one, for instance:
>> ...
>> That's what I've been doing, but it didn't look elegant. I thought I was
>> missing a clever point. It seems I'm stuck with it, if I want to do it
>> that way.
>>
>> Best wishes,
>>
>> Jeanette
>>
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>       https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

--
  * Website: http://juliencoder.de - for summer is a state of sound
  * SoundCloud: https://soundcloud.com/jeanette_c
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * GitHub: https://github.com/jeanette-c
  * Twitter: https://twitter.com/jeanette_c_s

You should never try to change me
I can be nobody else
And I like the way I am <3
(Britney Spears)

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] control-signal change based on other control-signal (no switch/trigger)

joachim-3
thanks very much for your honest compliments =)



On 05/10/18 10:39, Jeanette C. wrote:

> Oct 5 2018, joachim heintz has written:
>
>> hi jeanette -
>>
>> i have to disagree here.  this code is *very* elegant =)
> Seeing that it's you, there's nothing but to bow to the master. You've
> written some very nice code.
>>
>> best -
>>     joachim
>>
>>
>>
>> On 05/10/18 10:01, Jeanette C. wrote:
>>> Hi Joachim and Thorin,
>>> Oct 5 2018, joachim heintz has written:
>>>
>>>> the problem might be that in this +/- ktolerate range you probably get
>>>> more than one k-cycle where it becomes true.
>>> Alas yes.
>>>>
>>>> if the ksrc signal is not jumping, and it is not about "reaching" but
>>>> "crossing" a line (or threshold), i would compare the ksrc in this
>>>> k-cycle with the previous one, for instance:
>>> ...
>>> That's what I've been doing, but it didn't look elegant. I thought I was
>>> missing a clever point. It seems I'm stuck with it, if I want to do it
>>> that way.
>>>
>>> Best wishes,
>>>
>>> Jeanette
>>>
>>
>> Csound mailing list
>> [hidden email]
>> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
>> Send bugs reports to
>>       https://github.com/csound/csound/issues
>> Discussions of bugs and features can be posted here
>>
>

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here