Csound Csound-dev Csound-tekno Search About

Re: sustain pedal with -+row_controller_mode=1

Date2017-07-15 13:52
FromAndrea Strappa
SubjectRe: sustain pedal with -+row_controller_mode=1
Yes! Thank you, Guillermo.
Now I'll study Csound arrays to adapt your solution to my goals.
Thank you very much.
Andrea S.

----- Original Message ----- 
From: "Guillermo Senna" 
To: 
Sent: Friday, July 14, 2017 11:52 PM
Subject: Re: [Csnd] sustain pedal with -+row_controller_mode=1


I see what you mean. Why not arrays then? You could adapt the following
to your modular ftable approach:

gkKeyPressed[] init 128
gkSustainPedalStatus init 0

massign 1, 2

alwayson 1
instr 1
    gkSustainPedalStatus ctrl7 1, 64, 0, 127
endin

instr 2 ; no sustain
    iCps cpsmidi
    iAmp ampmidi .3
    iNoteNum notnum
    gkKeyPressed[k(iNoteNum)] = 1
    event_i "i", 3+iNoteNum/1000, 0, -1, iAmp, iCps, iNoteNum
    if release() == 1 then
        gkKeyPressed[k(iNoteNum)] = 0
    endif
    aOut poscil iAmp, iCps
    outs aOut, aOut
endin

instr 3 ; sustain
    if gkKeyPressed[k(p6)] == 0 && gkSustainPedalStatus != 127 then
        turnoff
    endif
    aOut poscil p4, p5 * 3 / 2
    outs aOut, aOut
endin


On 14/07/17 16:38, Andrea Strappa wrote:
> Hi Guillermo,
> It does not seem to me to be my goal matches your solution.
> I'm close to solution, I attach a file.
> I use this 'if' statment:
> kstatus, kchan, kdata1, kdata2 midiin
> if (kstatus==176)&&(kdata1==64)&&(kdata2>63) then ;sustain pedal ON
> gksus_ped = 1000 ;**************
> elseif (kstatus==176)&&(kdata1==64)&&(kdata2<64) then ;sustain pedal OFF
> gksus_ped = 0 ;**************
> endif
> I would like play two instruments with a key (poly mode).
> In my example, the instr 3, play a sound without sustain pedal
> sensitivity.
> The instr 2 play the upper fifth of instr 3, and it should be sustain
> pedal sensitivity.
> One the two responds to sustain pedal, an other not.
> The solution that I find is almost complete, but there's a case where
> it does not work:
> 1) I press sustain pedal;
> 2) I press and hold down a key (C4, for example);
> 3) I press and lift a key (D4, for xample);
> 4) I lift the sustain pedal;
> 5) C4 key sound is stopped, instead it should  continue, because the
> key is still pressed.
>
> In this case I can not store an indipendent variable for every note
> like: i_jump_stop_note = 1 or 0
> If I lift a key, every variable of every sound go to '1'.
>
> I would like find a solution for a keyboard with a midi channel only,
> plug and play.
> Andrea S.
>
> ----- Original Message ----- From: "Guillermo Senna" 
> To: 
> Sent: Friday, July 14, 2017 2:45 PM
> Subject: Re: [Csnd] sustain pedal with -+row_controller_mode=1
>
>
> Hi Andrea,
>
> Something like this? Use with -+raw_controller_mode=yes
>
> instr 1
>    iCps cpsmidi
>    iAmp ampmidi .3
>    aOut poscil iAmp, iCps
>    outs aOut, aOut
> endin
>
> instr 2
>    kval ctrl7 1, 64, 0, 127
>    printk2 kval
> endin
>
> 
> 
> f 0 z
> i2 0 -1
> 
>
>
> On 14/07/17 08:32, Andrea Strappa wrote:
>> thank you Victor,
>>
>> perhaps you are now in a high and ispired philanthropic moment...
>> higher than your average, I mean.
>>
>> Do you know a way to make a sustain pedal active for an instrument,
>> but not for another?
>>
>> Andrea S.
>>
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> 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
> Csound@listserv.heanet.ie
> 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
>
> ---
> Questa e-mail è stata controllata per individuare virus con Avast
> antivirus.
> https://www.avast.com/antivirus
>
> Csound mailing list
> Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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 


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
https://www.avast.com/antivirus

Csound mailing list
Csound@listserv.heanet.ie
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