Csound Csound-dev Csound-tekno Search About

[Csnd] problem with effect, swichted on by a midi controller

Date2013-09-06 16:47
FromStefan Thomas
Subject[Csnd] problem with effect, swichted on by a midi controller
Dear community,
I want to switch on and off a delay-instrument with a midi controller.
I can hear a delay effect in the below quoted code, when the number, sended by the modwheel, is larger than 0, but the delay effect sounds different, if I leave out the lines
    if (gkmodwheel > 0 ) then
    turnon 101
    else turnoff2 101,0,1
    endif
Has someone an idea how I can do it better?
Here is my example of code:

<CsoundSynthesizer>
<CsOptions>
 -Ma -m0d  -odac
</CsOptions>
; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
massign 0,2
pgmassign 0,2

alwayson 1
alwayson 2
alwayson 101

instr 1
    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

endin



instr 2
    if (gkmodwheel > 0 ) then
    turnon 101
    else turnoff2 101,0,1
    endif

    gadelay init 0
    icps     cpsmidi
    iamp    ampmidi 0.1
    aenv     linsegr 0,0.01,1,2,0,0.1,0
    asig    poscil iamp*aenv,icps,gisine
    outs     asig, asig
    gadelay = asig+gadelay   
endin


instr 101 ; delay
    aBufOut delayr   2           ; read audio end buffer
    aTap1   deltap   0.4                 ; delay tap 1
    aTap2   deltap   0.7                 ; delay tap 2
    aTap3   deltap   1.1                 ; delay tap 3
        delayw   gadelay + (aTap3*0.4)     ; write audio into buffer

; send audio to the output (mix the input signal with the delayed signals)
        aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
    outs     aout, aout   
    gadelay = 0
endin

</CsInstruments>
; ==============================================
<CsScore>


</CsScore>
</CsoundSynthesizer>






Date2013-09-06 17:52
Fromjoachim heintz
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
hi stefan -

my first thought is this:

in the lines
         if (gkmodwheel > 0 ) then
         turnon 101
         else turnoff2 101,0,1
         endif
you ask in a k-rate condition, but the first part of your conclusion 
(turnon 101) is i-rate. so in fact, you will turn on instrument 101 only 
once (and *not* depending on the condition at all).

so i think, you must clarify first in which case exactly you want to 
trigger instrument 101. (i guess it might be something like "if 
gkmodwheel has changed its value".) then you can trigger is with the 
event opcode, perhaps in conjunction with the changed opcode.

best -

	joachim



Am 06.09.2013 17:47, schrieb Stefan Thomas:
> Dear community,
> I want to switch on and off a delay-instrument with a midi controller.
> I can hear a delay effect in the below quoted code, when the number,
> sended by the modwheel, is larger than 0, but the delay effect sounds
> different, if I leave out the lines
>
>          if (gkmodwheel > 0 ) then
>          turnon 101
>          else turnoff2 101,0,1
>          endif
>
> Has someone an idea how I can do it better?
> Here is my example of code:
>
> 
> 
>   -Ma -m0d  -odac
> 
> ; ==============================================
> 
>
> sr    =    44100
> ksmps     =     100
> nchnls    =    2
> 0dbfs    =    1
> gisine ftgen 0,0,2^13, 10, 1
> massign 0,2
> pgmassign 0,2
>
> alwayson 1
> alwayson 2
> alwayson 101
>
> instr 1
>      ichan = 1
>      imin = 0
>      imax = 127
>      icontrlnum = 1 ; mod wheel
>      gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
> endin
>
>
>
> instr 2
>      if (gkmodwheel > 0 ) then
>      turnon 101
>      else turnoff2 101,0,1
>      endif
>
>      gadelay init 0
>      icps     cpsmidi
>      iamp    ampmidi 0.1
>      aenv     linsegr 0,0.01,1,2,0,0.1,0
>      asig    poscil iamp*aenv,icps,gisine
>      outs     asig, asig
>      gadelay = asig+gadelay
> endin
>
>
> instr 101 ; delay
>      aBufOut delayr   2           ; read audio end buffer
>      aTap1   deltap   0.4                 ; delay tap 1
>      aTap2   deltap   0.7                 ; delay tap 2
>      aTap3   deltap   1.1                 ; delay tap 3
>          delayw   gadelay + (aTap3*0.4)     ; write audio into buffer
>
> ; send audio to the output (mix the input signal with the delayed signals)
>          aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
>      outs     aout, aout
>      gadelay = 0
> endin
>
> 
> ; ==============================================
> 
>
>
> 
> 
>
>
>
>
>

Date2013-09-07 09:44
FromStefan Thomas
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
Dear Joachim,
thanks for Your tipp.
My plan is:
to switch on the delay effect on the end of the performance.
I don't have to stop the delay instrument.
The following code works for me, but exactly but completely contrarious tomy expectance.
When the mode-wheel is 0, I do hear delay, and when it is more then 0, the effect is stopped.
I would like to know, why csound acts in this way.
Here the code of the controller instrument:

instr 1
    gkmodwheel init 0
    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

    if (gkmodwheel > 0 ) goto bequiet
    event "i",101,0,-1
    bequiet:
    gkmodwheel = 0;

endin






2013/9/6 joachim heintz <jh@joachimheintz.de>
hi stefan -

my first thought is this:

in the lines

        if (gkmodwheel > 0 ) then
        turnon 101
        else turnoff2 101,0,1
        endif
you ask in a k-rate condition, but the first part of your conclusion (turnon 101) is i-rate. so in fact, you will turn on instrument 101 only once (and *not* depending on the condition at all).

so i think, you must clarify first in which case exactly you want to trigger instrument 101. (i guess it might be something like "if gkmodwheel has changed its value".) then you can trigger is with the event opcode, perhaps in conjunction with the changed opcode.

best -

        joachim



Am 06.09.2013 17:47, schrieb Stefan Thomas:

Dear community,
I want to switch on and off a delay-instrument with a midi controller.
I can hear a delay effect in the below quoted code, when the number,
sended by the modwheel, is larger than 0, but the delay effect sounds
different, if I leave out the lines

         if (gkmodwheel > 0 ) then
         turnon 101
         else turnoff2 101,0,1
         endif

Has someone an idea how I can do it better?
Here is my example of code:

<CsoundSynthesizer>
<CsOptions>
  -Ma -m0d  -odac
</CsOptions>
; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
massign 0,2
pgmassign 0,2

alwayson 1
alwayson 2
alwayson 101

instr 1
     ichan = 1
     imin = 0
     imax = 127
     icontrlnum = 1 ; mod wheel
     gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

endin



instr 2
     if (gkmodwheel > 0 ) then
     turnon 101
     else turnoff2 101,0,1
     endif

     gadelay init 0
     icps     cpsmidi
     iamp    ampmidi 0.1
     aenv     linsegr 0,0.01,1,2,0,0.1,0
     asig    poscil iamp*aenv,icps,gisine
     outs     asig, asig
     gadelay = asig+gadelay
endin


instr 101 ; delay
     aBufOut delayr   2           ; read audio end buffer
     aTap1   deltap   0.4                 ; delay tap 1
     aTap2   deltap   0.7                 ; delay tap 2
     aTap3   deltap   1.1                 ; delay tap 3
         delayw   gadelay + (aTap3*0.4)     ; write audio into buffer

; send audio to the output (mix the input signal with the delayed signals)
         aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
     outs     aout, aout
     gadelay = 0
endin

</CsInstruments>
; ==============================================
<CsScore>


</CsScore>
</CsoundSynthesizer>







Send bugs reports to the Sourceforge bug trackers
csound6:
           https://sourceforge.net/p/csound/tickets/
csound5:
           https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-09-07 09:48
FromStefan Thomas
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
Sorry, I made a mistake.
The right code is:
instr 1
    gkmodwheel init 0
    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

    if (gkmodwheel == 0 ) goto bequiet
    event "i",101,0,-1
    bequiet:
    gkmodwheel = 0;

endin




2013/9/7 Stefan Thomas <kontrapunktstefan@gmail.com>
Dear Joachim,
thanks for Your tipp.
My plan is:
to switch on the delay effect on the end of the performance.
I don't have to stop the delay instrument.
The following code works for me, but exactly but completely contrarious tomy expectance.
When the mode-wheel is 0, I do hear delay, and when it is more then 0, the effect is stopped.
I would like to know, why csound acts in this way.
Here the code of the controller instrument:

instr 1
    gkmodwheel init 0

    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

    if (gkmodwheel > 0 ) goto bequiet
    event "i",101,0,-1
    bequiet:
    gkmodwheel = 0;

endin






2013/9/6 joachim heintz <jh@joachimheintz.de>
hi stefan -

my first thought is this:

in the lines

        if (gkmodwheel > 0 ) then
        turnon 101
        else turnoff2 101,0,1
        endif
you ask in a k-rate condition, but the first part of your conclusion (turnon 101) is i-rate. so in fact, you will turn on instrument 101 only once (and *not* depending on the condition at all).

so i think, you must clarify first in which case exactly you want to trigger instrument 101. (i guess it might be something like "if gkmodwheel has changed its value".) then you can trigger is with the event opcode, perhaps in conjunction with the changed opcode.

best -

        joachim



Am 06.09.2013 17:47, schrieb Stefan Thomas:

Dear community,
I want to switch on and off a delay-instrument with a midi controller.
I can hear a delay effect in the below quoted code, when the number,
sended by the modwheel, is larger than 0, but the delay effect sounds
different, if I leave out the lines

         if (gkmodwheel > 0 ) then
         turnon 101
         else turnoff2 101,0,1
         endif

Has someone an idea how I can do it better?
Here is my example of code:

<CsoundSynthesizer>
<CsOptions>
  -Ma -m0d  -odac
</CsOptions>
; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
massign 0,2
pgmassign 0,2

alwayson 1
alwayson 2
alwayson 101

instr 1
     ichan = 1
     imin = 0
     imax = 127
     icontrlnum = 1 ; mod wheel
     gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

endin



instr 2
     if (gkmodwheel > 0 ) then
     turnon 101
     else turnoff2 101,0,1
     endif

     gadelay init 0
     icps     cpsmidi
     iamp    ampmidi 0.1
     aenv     linsegr 0,0.01,1,2,0,0.1,0
     asig    poscil iamp*aenv,icps,gisine
     outs     asig, asig
     gadelay = asig+gadelay
endin


instr 101 ; delay
     aBufOut delayr   2           ; read audio end buffer
     aTap1   deltap   0.4                 ; delay tap 1
     aTap2   deltap   0.7                 ; delay tap 2
     aTap3   deltap   1.1                 ; delay tap 3
         delayw   gadelay + (aTap3*0.4)     ; write audio into buffer

; send audio to the output (mix the input signal with the delayed signals)
         aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
     outs     aout, aout
     gadelay = 0
endin

</CsInstruments>
; ==============================================
<CsScore>


</CsScore>
</CsoundSynthesizer>







Send bugs reports to the Sourceforge bug trackers
csound6:
           https://sourceforge.net/p/csound/tickets/
csound5:
           https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2013-09-07 10:14
FromStefan Thomas
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
Sorry,
to much confusion.
Please forget the last two mails.
My controller instrument works now as I want, but I don't unterstand why.
The condition is:
if (gkmodwheel == 0 ) then
    event "i",101,0,-1
    endif

But when the modwheel is not 0, instrument 101 is switched on. How this can be possible?
Here, once again, the controller instrument 1:

instr 1
    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
   if (gkmodwheel == 0 ) then
    event "i",101,0,-1
    endif
endin



2013/9/7 Stefan Thomas <kontrapunktstefan@gmail.com>
Sorry, I made a mistake.
The right code is:
instr 1
    gkmodwheel init 0
    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

    if (gkmodwheel == 0 ) goto bequiet

    event "i",101,0,-1
    bequiet:
    gkmodwheel = 0;

endin




2013/9/7 Stefan Thomas <kontrapunktstefan@gmail.com>
Dear Joachim,
thanks for Your tipp.
My plan is:
to switch on the delay effect on the end of the performance.
I don't have to stop the delay instrument.
The following code works for me, but exactly but completely contrarious tomy expectance.
When the mode-wheel is 0, I do hear delay, and when it is more then 0, the effect is stopped.
I would like to know, why csound acts in this way.
Here the code of the controller instrument:

instr 1
    gkmodwheel init 0

    ichan = 1
    imin = 0
    imax = 127
    icontrlnum = 1 ; mod wheel
    gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

    if (gkmodwheel > 0 ) goto bequiet
    event "i",101,0,-1
    bequiet:
    gkmodwheel = 0;

endin






2013/9/6 joachim heintz <jh@joachimheintz.de>
hi stefan -

my first thought is this:

in the lines

        if (gkmodwheel > 0 ) then
        turnon 101
        else turnoff2 101,0,1
        endif
you ask in a k-rate condition, but the first part of your conclusion (turnon 101) is i-rate. so in fact, you will turn on instrument 101 only once (and *not* depending on the condition at all).

so i think, you must clarify first in which case exactly you want to trigger instrument 101. (i guess it might be something like "if gkmodwheel has changed its value".) then you can trigger is with the event opcode, perhaps in conjunction with the changed opcode.

best -

        joachim



Am 06.09.2013 17:47, schrieb Stefan Thomas:

Dear community,
I want to switch on and off a delay-instrument with a midi controller.
I can hear a delay effect in the below quoted code, when the number,
sended by the modwheel, is larger than 0, but the delay effect sounds
different, if I leave out the lines

         if (gkmodwheel > 0 ) then
         turnon 101
         else turnoff2 101,0,1
         endif

Has someone an idea how I can do it better?
Here is my example of code:

<CsoundSynthesizer>
<CsOptions>
  -Ma -m0d  -odac
</CsOptions>
; ==============================================
<CsInstruments>

sr    =    44100
ksmps     =     100
nchnls    =    2
0dbfs    =    1
gisine ftgen 0,0,2^13, 10, 1
massign 0,2
pgmassign 0,2

alwayson 1
alwayson 2
alwayson 101

instr 1
     ichan = 1
     imin = 0
     imax = 127
     icontrlnum = 1 ; mod wheel
     gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

endin



instr 2
     if (gkmodwheel > 0 ) then
     turnon 101
     else turnoff2 101,0,1
     endif

     gadelay init 0
     icps     cpsmidi
     iamp    ampmidi 0.1
     aenv     linsegr 0,0.01,1,2,0,0.1,0
     asig    poscil iamp*aenv,icps,gisine
     outs     asig, asig
     gadelay = asig+gadelay
endin


instr 101 ; delay
     aBufOut delayr   2           ; read audio end buffer
     aTap1   deltap   0.4                 ; delay tap 1
     aTap2   deltap   0.7                 ; delay tap 2
     aTap3   deltap   1.1                 ; delay tap 3
         delayw   gadelay + (aTap3*0.4)     ; write audio into buffer

; send audio to the output (mix the input signal with the delayed signals)
         aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
     outs     aout, aout
     gadelay = 0
endin

</CsInstruments>
; ==============================================
<CsScore>


</CsScore>
</CsoundSynthesizer>







Send bugs reports to the Sourceforge bug trackers
csound6:
           https://sourceforge.net/p/csound/tickets/
csound5:
           https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






Date2013-09-07 14:17
Fromjoachim heintz
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
hi stefan -

for a better understanding, i'd suggest you use this in the line with 
the event opcode:
     event "i",101,0,-1, gkmodwheel

and you start your instr 101 with this line:
     print p4

what is your output?

	joachim


Am 07.09.2013 11:14, schrieb Stefan Thomas:
> Sorry,
> to much confusion.
> Please forget the last two mails.
> My controller instrument works now as I want, but I don't unterstand why.
> The condition is:
>
>     if (gkmodwheel == 0 ) then
>          event "i",101,0,-1
>          endif
>
>
> But when the modwheel is not 0, instrument 101 is switched on. How this
> can be possible?
> Here, once again, the controller instrument 1:
>
> instr 1
>      ichan = 1
>      imin = 0
>      imax = 127
>      icontrlnum = 1 ; mod wheel
>      gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>     if (gkmodwheel == 0 ) then
>      event "i",101,0,-1
>      endif
> endin
>
>
>
> 2013/9/7 Stefan Thomas  >
>
>     Sorry, I made a mistake.
>     The right code is:
>
>         instr 1
>              gkmodwheel init 0
>              ichan = 1
>              imin = 0
>              imax = 127
>              icontrlnum = 1 ; mod wheel
>              gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
>              if (gkmodwheel == 0 ) goto bequiet
>
>              event "i",101,0,-1
>              bequiet:
>              gkmodwheel = 0;
>
>         endin
>
>
>
>
>
>     2013/9/7 Stefan Thomas      >
>
>         Dear Joachim,
>         thanks for Your tipp.
>         My plan is:
>         to switch on the delay effect on the end of the performance.
>         I don't have to stop the delay instrument.
>         The following code works for me, but exactly but completely
>         contrarious tomy expectance.
>         When the mode-wheel is 0, I do hear delay, and when it is more
>         then 0, the effect is stopped.
>         I would like to know, why csound acts in this way.
>         Here the code of the controller instrument:
>
>             instr 1
>                  gkmodwheel init 0
>
>                  ichan = 1
>                  imin = 0
>                  imax = 127
>                  icontrlnum = 1 ; mod wheel
>                  gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
>                  if (gkmodwheel > 0 ) goto bequiet
>                  event "i",101,0,-1
>                  bequiet:
>                  gkmodwheel = 0;
>
>             endin
>
>
>
>
>
>
>
>         2013/9/6 joachim heintz          >
>
>             hi stefan -
>
>             my first thought is this:
>
>             in the lines
>
>                      if (gkmodwheel > 0 ) then
>                      turnon 101
>                      else turnoff2 101,0,1
>                      endif
>             you ask in a k-rate condition, but the first part of your
>             conclusion (turnon 101) is i-rate. so in fact, you will turn
>             on instrument 101 only once (and *not* depending on the
>             condition at all).
>
>             so i think, you must clarify first in which case exactly you
>             want to trigger instrument 101. (i guess it might be
>             something like "if gkmodwheel has changed its value".) then
>             you can trigger is with the event opcode, perhaps in
>             conjunction with the changed opcode.
>
>             best -
>
>                      joachim
>
>
>
>             Am 06.09.2013 17:47, schrieb Stefan Thomas:
>
>                 Dear community,
>                 I want to switch on and off a delay-instrument with a
>                 midi controller.
>                 I can hear a delay effect in the below quoted code, when
>                 the number,
>                 sended by the modwheel, is larger than 0, but the delay
>                 effect sounds
>                 different, if I leave out the lines
>
>                           if (gkmodwheel > 0 ) then
>                           turnon 101
>                           else turnoff2 101,0,1
>                           endif
>
>                 Has someone an idea how I can do it better?
>                 Here is my example of code:
>
>                 
>                 
>                    -Ma -m0d  -odac
>                 
>                 ; ==============================__================
>                 
>
>                 sr    =    44100
>                 ksmps     =     100
>                 nchnls    =    2
>                 0dbfs    =    1
>                 gisine ftgen 0,0,2^13, 10, 1
>                 massign 0,2
>                 pgmassign 0,2
>
>                 alwayson 1
>                 alwayson 2
>                 alwayson 101
>
>                 instr 1
>                       ichan = 1
>                       imin = 0
>                       imax = 127
>                       icontrlnum = 1 ; mod wheel
>                       gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
>                 endin
>
>
>
>                 instr 2
>                       if (gkmodwheel > 0 ) then
>                       turnon 101
>                       else turnoff2 101,0,1
>                       endif
>
>                       gadelay init 0
>                       icps     cpsmidi
>                       iamp    ampmidi 0.1
>                       aenv     linsegr 0,0.01,1,2,0,0.1,0
>                       asig    poscil iamp*aenv,icps,gisine
>                       outs     asig, asig
>                       gadelay = asig+gadelay
>                 endin
>
>
>                 instr 101 ; delay
>                       aBufOut delayr   2           ; read audio end buffer
>                       aTap1   deltap   0.4                 ; delay tap 1
>                       aTap2   deltap   0.7                 ; delay tap 2
>                       aTap3   deltap   1.1                 ; delay tap 3
>                           delayw   gadelay + (aTap3*0.4)     ; write
>                 audio into buffer
>
>                 ; send audio to the output (mix the input signal with
>                 the delayed signals)
>                           aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
>                       outs     aout, aout
>                       gadelay = 0
>                 endin
>
>                 
>                 ; ==============================__================
>                 
>
>
>                 
>                 
>
>
>
>
>
>
>
>             Send bugs reports to the Sourceforge bug trackers
>             csound6:
>             https://sourceforge.net/p/__csound/tickets/
>             
>             csound5:
>             https://sourceforge.net/p/__csound/bugs/
>             
>             Discussions of bugs and features can be posted here
>             To unsubscribe, send email sympa@lists.bath.ac.uk
>              with body "unsubscribe csound"
>
>
>
>
>

Date2013-09-07 17:43
FromStefan Thomas
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
Dear Joachim,
I did as You've suggested.
The output of p4 is:
(nothing, after start)
then, after moving the modwheel:
instr 101: p4 = 19.000 (it shows this message many times)
and, after moving it again:
instr 101:  p4 = 17.000 (it shows this message many times)
instr 101:  p4 = 12.000 (it shows this message many times)
instr 101:  p4 = 5.000 (it shows this message many times)
instr 101:  p4 = 2.000 (it shows this message many times)
At the beginning I couln't hear the delay, also after the first move.
The second move caused delay.



2013/9/7 joachim heintz <jh@joachimheintz.de>
hi stefan -

for a better understanding, i'd suggest you use this in the line with the event opcode:
    event "i",101,0,-1, gkmodwheel

and you start your instr 101 with this line:
    print p4

what is your output?

        joachim


Am 07.09.2013 11:14, schrieb Stefan Thomas:
Sorry,
to much confusion.
Please forget the last two mails.
My controller instrument works now as I want, but I don't unterstand why.
The condition is:

    if (gkmodwheel == 0 ) then
         event "i",101,0,-1
         endif


But when the modwheel is not 0, instrument 101 is switched on. How this
can be possible?
Here, once again, the controller instrument 1:

instr 1
     ichan = 1
     imin = 0
     imax = 127
     icontrlnum = 1 ; mod wheel
     gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
    if (gkmodwheel == 0 ) then
     event "i",101,0,-1
     endif
endin



2013/9/7 Stefan Thomas <kontrapunktstefan@gmail.com
<mailto:kontrapunktstefan@gmail.com>>


    Sorry, I made a mistake.
    The right code is:

        instr 1
             gkmodwheel init 0
             ichan = 1
             imin = 0
             imax = 127
             icontrlnum = 1 ; mod wheel
             gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

             if (gkmodwheel == 0 ) goto bequiet

             event "i",101,0,-1
             bequiet:
             gkmodwheel = 0;

        endin





    2013/9/7 Stefan Thomas <kontrapunktstefan@gmail.com
    <mailto:kontrapunktstefan@gmail.com>>


        Dear Joachim,
        thanks for Your tipp.
        My plan is:
        to switch on the delay effect on the end of the performance.
        I don't have to stop the delay instrument.
        The following code works for me, but exactly but completely
        contrarious tomy expectance.
        When the mode-wheel is 0, I do hear delay, and when it is more
        then 0, the effect is stopped.
        I would like to know, why csound acts in this way.
        Here the code of the controller instrument:

            instr 1
                 gkmodwheel init 0

                 ichan = 1
                 imin = 0
                 imax = 127
                 icontrlnum = 1 ; mod wheel
                 gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

                 if (gkmodwheel > 0 ) goto bequiet
                 event "i",101,0,-1
                 bequiet:
                 gkmodwheel = 0;

            endin







        2013/9/6 joachim heintz <jh@joachimheintz.de
        <mailto:jh@joachimheintz.de>>


            hi stefan -

            my first thought is this:

            in the lines

                     if (gkmodwheel > 0 ) then
                     turnon 101
                     else turnoff2 101,0,1
                     endif
            you ask in a k-rate condition, but the first part of your
            conclusion (turnon 101) is i-rate. so in fact, you will turn
            on instrument 101 only once (and *not* depending on the
            condition at all).

            so i think, you must clarify first in which case exactly you
            want to trigger instrument 101. (i guess it might be
            something like "if gkmodwheel has changed its value".) then
            you can trigger is with the event opcode, perhaps in
            conjunction with the changed opcode.

            best -

                     joachim



            Am 06.09.2013 17:47, schrieb Stefan Thomas:

                Dear community,
                I want to switch on and off a delay-instrument with a
                midi controller.
                I can hear a delay effect in the below quoted code, when
                the number,
                sended by the modwheel, is larger than 0, but the delay
                effect sounds
                different, if I leave out the lines

                          if (gkmodwheel > 0 ) then
                          turnon 101
                          else turnoff2 101,0,1
                          endif

                Has someone an idea how I can do it better?
                Here is my example of code:

                <CsoundSynthesizer>
                <CsOptions>
                   -Ma -m0d  -odac
                </CsOptions>
                ; ==============================__================

                <CsInstruments>

                sr    =    44100
                ksmps     =     100
                nchnls    =    2
                0dbfs    =    1
                gisine ftgen 0,0,2^13, 10, 1
                massign 0,2
                pgmassign 0,2

                alwayson 1
                alwayson 2
                alwayson 101

                instr 1
                      ichan = 1
                      imin = 0
                      imax = 127
                      icontrlnum = 1 ; mod wheel
                      gkmodwheel ctrl7   ichan, icontrlnum, 0, 127

                endin



                instr 2
                      if (gkmodwheel > 0 ) then
                      turnon 101
                      else turnoff2 101,0,1
                      endif

                      gadelay init 0
                      icps     cpsmidi
                      iamp    ampmidi 0.1
                      aenv     linsegr 0,0.01,1,2,0,0.1,0
                      asig    poscil iamp*aenv,icps,gisine
                      outs     asig, asig
                      gadelay = asig+gadelay
                endin


                instr 101 ; delay
                      aBufOut delayr   2           ; read audio end buffer
                      aTap1   deltap   0.4                 ; delay tap 1
                      aTap2   deltap   0.7                 ; delay tap 2
                      aTap3   deltap   1.1                 ; delay tap 3
                          delayw   gadelay + (aTap3*0.4)     ; write
                audio into buffer

                ; send audio to the output (mix the input signal with
                the delayed signals)
                          aout    =   gadelay + ((aTap1+aTap2+aTap3)*0.4)
                      outs     aout, aout
                      gadelay = 0
                endin

                </CsInstruments>
                ; ==============================__================

                <CsScore>


                </CsScore>
                </CsoundSynthesizer>







            Send bugs reports to the Sourceforge bug trackers
            csound6:
            https://sourceforge.net/p/__csound/tickets/
            <https://sourceforge.net/p/csound/tickets/>
            csound5:
            https://sourceforge.net/p/__csound/bugs/

            <https://sourceforge.net/p/csound/bugs/>
            Discussions of bugs and features can be posted here
            To unsubscribe, send email sympa@lists.bath.ac.uk
            <mailto:sympa@lists.bath.ac.uk> with body "unsubscribe csound"







Send bugs reports to the Sourceforge bug trackers
csound6:
           https://sourceforge.net/p/csound/tickets/
csound5:
           https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-09-07 21:10
Fromjoachim heintz
SubjectRe: [Csnd] problem with effect, swichted on by a midi controller
seems a bit strange for me -- i cannot see how the lines

     if (gkmodwheel == 0 ) then
          event "i",101,0,-1, gkmodwheel
          endif

can cause this output. but perhaps someone has an idea. if you like, 
post the complete code. best -

	joachim



Am 07.09.2013 18:43, schrieb Stefan Thomas:
> Dear Joachim,
> I did as You've suggested.
> The output of p4 is:
> (nothing, after start)
> then, after moving the modwheel:
> instr 101: p4 = 19.000 (it shows this message many times)
> and, after moving it again:
> instr 101:  p4 = 17.000 (it shows this message many times)
> instr 101:  p4 = 12.000 (it shows this message many times)
> instr 101:  p4 = 5.000 (it shows this message many times)
> instr 101:  p4 = 2.000 (it shows this message many times)
> At the beginning I couln't hear the delay, also after the first move.
> The second move caused delay.
>
>
>
> 2013/9/7 joachim heintz >
>
>     hi stefan -
>
>     for a better understanding, i'd suggest you use this in the line
>     with the event opcode:
>          event "i",101,0,-1, gkmodwheel
>
>     and you start your instr 101 with this line:
>          print p4
>
>     what is your output?
>
>              joachim
>
>
>     Am 07.09.2013 11:14, schrieb Stefan Thomas:
>
>         Sorry,
>         to much confusion.
>         Please forget the last two mails.
>         My controller instrument works now as I want, but I don't
>         unterstand why.
>         The condition is:
>
>              if (gkmodwheel == 0 ) then
>                   event "i",101,0,-1
>                   endif
>
>
>         But when the modwheel is not 0, instrument 101 is switched on.
>         How this
>         can be possible?
>         Here, once again, the controller instrument 1:
>
>         instr 1
>               ichan = 1
>               imin = 0
>               imax = 127
>               icontrlnum = 1 ; mod wheel
>               gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>              if (gkmodwheel == 0 ) then
>               event "i",101,0,-1
>               endif
>         endin
>
>
>
>         2013/9/7 Stefan Thomas          
>                  >>
>
>
>              Sorry, I made a mistake.
>              The right code is:
>
>                  instr 1
>                       gkmodwheel init 0
>                       ichan = 1
>                       imin = 0
>                       imax = 127
>                       icontrlnum = 1 ; mod wheel
>                       gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
>                       if (gkmodwheel == 0 ) goto bequiet
>
>                       event "i",101,0,-1
>                       bequiet:
>                       gkmodwheel = 0;
>
>                  endin
>
>
>
>
>
>              2013/9/7 Stefan Thomas          
>                       >>
>
>
>                  Dear Joachim,
>                  thanks for Your tipp.
>                  My plan is:
>                  to switch on the delay effect on the end of the
>         performance.
>                  I don't have to stop the delay instrument.
>                  The following code works for me, but exactly but completely
>                  contrarious tomy expectance.
>                  When the mode-wheel is 0, I do hear delay, and when it
>         is more
>                  then 0, the effect is stopped.
>                  I would like to know, why csound acts in this way.
>                  Here the code of the controller instrument:
>
>                      instr 1
>                           gkmodwheel init 0
>
>                           ichan = 1
>                           imin = 0
>                           imax = 127
>                           icontrlnum = 1 ; mod wheel
>                           gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
>                           if (gkmodwheel > 0 ) goto bequiet
>                           event "i",101,0,-1
>                           bequiet:
>                           gkmodwheel = 0;
>
>                      endin
>
>
>
>
>
>
>
>                  2013/9/6 joachim heintz          
>                  >>
>
>
>                      hi stefan -
>
>                      my first thought is this:
>
>                      in the lines
>
>                               if (gkmodwheel > 0 ) then
>                               turnon 101
>                               else turnoff2 101,0,1
>                               endif
>                      you ask in a k-rate condition, but the first part
>         of your
>                      conclusion (turnon 101) is i-rate. so in fact, you
>         will turn
>                      on instrument 101 only once (and *not* depending on the
>                      condition at all).
>
>                      so i think, you must clarify first in which case
>         exactly you
>                      want to trigger instrument 101. (i guess it might be
>                      something like "if gkmodwheel has changed its
>         value".) then
>                      you can trigger is with the event opcode, perhaps in
>                      conjunction with the changed opcode.
>
>                      best -
>
>                               joachim
>
>
>
>                      Am 06.09.2013 17:47, schrieb Stefan Thomas:
>
>                          Dear community,
>                          I want to switch on and off a delay-instrument
>         with a
>                          midi controller.
>                          I can hear a delay effect in the below quoted
>         code, when
>                          the number,
>                          sended by the modwheel, is larger than 0, but
>         the delay
>                          effect sounds
>                          different, if I leave out the lines
>
>                                    if (gkmodwheel > 0 ) then
>                                    turnon 101
>                                    else turnoff2 101,0,1
>                                    endif
>
>                          Has someone an idea how I can do it better?
>                          Here is my example of code:
>
>                          
>                          
>                             -Ma -m0d  -odac
>                          
>                          ;
>         ==============================____================
>
>                          
>
>                          sr    =    44100
>                          ksmps     =     100
>                          nchnls    =    2
>                          0dbfs    =    1
>                          gisine ftgen 0,0,2^13, 10, 1
>                          massign 0,2
>                          pgmassign 0,2
>
>                          alwayson 1
>                          alwayson 2
>                          alwayson 101
>
>                          instr 1
>                                ichan = 1
>                                imin = 0
>                                imax = 127
>                                icontrlnum = 1 ; mod wheel
>                                gkmodwheel ctrl7   ichan, icontrlnum, 0, 127
>
>                          endin
>
>
>
>                          instr 2
>                                if (gkmodwheel > 0 ) then
>                                turnon 101
>                                else turnoff2 101,0,1
>                                endif
>
>                                gadelay init 0
>                                icps     cpsmidi
>                                iamp    ampmidi 0.1
>                                aenv     linsegr 0,0.01,1,2,0,0.1,0
>                                asig    poscil iamp*aenv,icps,gisine
>                                outs     asig, asig
>                                gadelay = asig+gadelay
>                          endin
>
>
>                          instr 101 ; delay
>                                aBufOut delayr   2           ; read audio
>         end buffer
>                                aTap1   deltap   0.4                 ;
>         delay tap 1
>                                aTap2   deltap   0.7                 ;
>         delay tap 2
>                                aTap3   deltap   1.1                 ;
>         delay tap 3
>                                    delayw   gadelay + (aTap3*0.4)     ;
>         write
>                          audio into buffer
>
>                          ; send audio to the output (mix the input
>         signal with
>                          the delayed signals)
>                                    aout    =   gadelay +
>         ((aTap1+aTap2+aTap3)*0.4)
>                                outs     aout, aout
>                                gadelay = 0
>                          endin
>
>                          
>                          ;
>         ==============================____================
>
>                          
>
>
>                          
>                          
>
>
>
>
>
>
>
>                      Send bugs reports to the Sourceforge bug trackers
>                      csound6:
>         https://sourceforge.net/p/____csound/tickets/
>         
>                               >
>                      csound5:
>         https://sourceforge.net/p/____csound/bugs/
>         
>
>                               >
>                      Discussions of bugs and features can be posted here
>                      To unsubscribe, send email sympa@lists.bath.ac.uk
>         
>                               __> with body "unsubscribe csound"
>
>
>
>
>
>
>
>     Send bugs reports to the Sourceforge bug trackers
>     csound6:
>     https://sourceforge.net/p/__csound/tickets/
>     
>     csound5:
>     https://sourceforge.net/p/__csound/bugs/
>     
>     Discussions of bugs and features can be posted here
>     To unsubscribe, send email sympa@lists.bath.ac.uk
>      with body "unsubscribe csound"
>
>
>