[Csnd] problem with effect, swichted on by a midi controller
| Date | 2013-09-06 16:47 |
| From | Stefan 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 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> |
| Date | 2013-09-06 17:52 |
| From | joachim heintz |
| Subject | Re: [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:
>
> |
| Date | 2013-09-07 09:44 |
| From | Stefan Thomas |
| Subject | Re: [Csnd] problem with effect, swichted on by a midi controller |
Dear Joachim, thanks for Your tipp.instr 1 2013/9/6 joachim heintz <jh@joachimheintz.de> hi stefan - |
| Date | 2013-09-07 09:48 |
| From | Stefan Thomas |
| Subject | Re: [Csnd] problem with effect, swichted on by a midi controller |
Sorry, I made a mistake. The right code is:instr 1 2013/9/7 Stefan Thomas <kontrapunktstefan@gmail.com>
|
| Date | 2013-09-07 10:14 |
| From | Stefan Thomas |
| Subject | Re: [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 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>
|
| Date | 2013-09-07 14:17 |
| From | joachim heintz |
| Subject | Re: [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 |
| Date | 2013-09-07 17:43 |
| From | Stefan Thomas |
| Subject | Re: [Csnd] problem with effect, swichted on by a midi controller |
Dear Joachim, I did as You've suggested.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) 2013/9/7 joachim heintz <jh@joachimheintz.de> hi stefan - |
| Date | 2013-09-07 21:10 |
| From | joachim heintz |
| Subject | Re: [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 |