Csound Csound-dev Csound-tekno Search About

[Csnd] Re: Re: Re: Re: different pitches during a live-midi performance

Date2009-09-29 18:13
From"Art Hunkins"
Subject[Csnd] Re: Re: Re: Re: different pitches during a live-midi performance
Stefan,
 
Your two ctrl7 lines (in instr 2) need to be in instr 1, replacing
ileftpedal = i(gkleftpedal)
imiddlepedal = i(gkmiddlepedal)
Art Hunkins
----- Original Message -----
Sent: Tuesday, September 29, 2009 12:58 PM
Subject: [Csnd] Re: Re: Re: different pitches during a live-midi performance

Dear community,
I tried it now with the following file, but without success. I can hear sound, but the pitch doesn't change.

<CsoundSynthesizer>
<CsOptions>
-odevaudio -M2 -b400 -m0d
</CsOptions>
<CsInstruments>

sr     = 48000
kr     = 2400
ksmps  = 20
nchnls = 2
gkleftpedal init 0
gkmiddlepedal init 0
 ipch = 8.02
  iequal = 12

 

massign    0, 1              ; assign all midi events to instr 1,
pgmassign  0, 1              ; also all program changes
instr 1
ileftpedal = i(gkleftpedal)
imiddlepedal = i(gkmiddlepedal)
gkleftpedal init 0
gkmiddlepedal init 0
 
gasend1 init 0
gasend2 init 0
 

 imnn    notnum
 indx    =  imnn * 2 + 1   ; values in table alternate between
                           ; Midi note nums and frequencies
ituningtable = 10
 icps    table  indx, ituningtable
  iamp    ampmidi        10000
     
icar = 1
imod = 1;
;kndx = iamp/3000 ; the louder, the more index it will have
kndx = iamp/2000 ; the louder, the more index it will have

; making the overall amplitude envelope
kampenv mxadsr 100/iamp, 0.0402, 0.785, 0.102, 0.001
;the envelope for the fmindex
;        att,  decay,    isl, ausklingzeit
;kindexenv madsr 3000/iamp, 3, 0.2, 0.111, 0
kindexenv madsr 4000/iamp, 3, 0.2, 0.111, 0
; and now the whole sound
a1   foscil iamp*kampenv, icps, icar, imod, kndx*kindexenv, 1
      outs a1, a1
asend1 = gasend1+a1
gasend2 = gasend2+a1
      endin 
   instr 2 ; modifies the pitch via the left and the right pedal
ituningtable = 10
gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal
ileftpedal = i(gkleftpedal)
gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal
imiddlepedal = i(gkmiddlepedal)
if (ileftpedal>0) then
ituningtable = ituningtable+1 ;choose tuningtable number 11, if the left pedal is down
elseif (imiddlepedal>0) then
ituningtable = ituningtable+2
else
ituningtable = ituningtable ; when the left pedal is not used, use tuningtable numer 10
endif
endin

  instr 3 ;RECORDS ALL SOUND
;RECORD A Stereo 16 BIT SOUND FILE
fout    "soneartklarinette.wav", 4, gasend1, gasend2
;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
gasend1 = 0
gasend2 = 0
endin

 
</CsInstruments>
; die Partiturereignisse werden definiert
<CsScore>
f1  0   8193  10   1
f 10  0 256 -23 "bartokaufCundGis.cps"
f 11  0 256 -23 "bartokaufCundFes.cps"   
f 12  0 256 -23 "bartokaufGisundDisis.cps"   

i1   0  600 
i2   0    600


</CsScore>





Date2009-10-01 10:03
FromStefan Thomas
Subject[Csnd] Re: Re: Re: Re: Re: different pitches during a live-midi performance
Dear community,
sorry for bothering You all, but I still have the same problem.
I have to admit, that I don't understand, how I can
try putting the ctrl7 opcodes in a separate instrument
I tried it with the following code, but without succes:
<CsoundSynthesizer>
<CsOptions>
-odevaudio -M0 -b400 -m0d
</CsOptions>
<CsInstruments>

sr     = 48000
kr     = 2400
ksmps  = 20
nchnls = 2
 ipch = 8.02
  iequal = 12

 

massign    0, 1              ; assign all midi events to instr 1,
pgmassign  0, 1              ; also all program changes
instr 1
gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal
gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal
gkleftpedal init 0
gkmiddlepedal init 0
 
gasend1 init 0
gasend2 init 0
 

 imnn    notnum
 indx    =  imnn * 2 + 1   ; values in table alternate between
                           ; Midi note nums and frequencies
ituningtable init  10
 icps    table  indx, ituningtable
  iamp    ampmidi        10000
     
icar = 1
imod = 1;
kndx = iamp/2000 ; the louder, the more index it will have

; making the overall amplitude envelope
kampenv mxadsr 100/iamp, 0.0402, 0.785, 0.102, 0.001
;the envelope for the fmindex
;        att,  decay,    isl, ausklingzeit
kindexenv madsr 4000/iamp, 3, 0.2, 0.111, 0
; and now the whole sound
a1   foscil iamp*kampenv, icps, icar, imod, kndx*kindexenv, 1
      outs a1, a1
asend1 = gasend1+a1
gasend2 = gasend2+a1
      endin 
   instr 2 ; modifies the pitch via the left and the right pedal
ileftpedal = i(gkleftpedal)
imiddlepedal = i(gkmiddlepedal)
if (ileftpedal>0) then
ituningtable = 11 ;choose tuningtable number 11, if the left pedal is down
elseif (imiddlepedal>0) then
ituningtable = 12
else
ituningtable = 10 ; when the left pedal is not used, use tuningtable numer 10
endif
endin

  instr 3 ;RECORDS ALL SOUND
;RECORD A Stereo 16 BIT SOUND FILE
fout    "soneartklarinette.wav", 4, gasend1, gasend2
;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
gasend1 = 0
gasend2 = 0
endin

 
</CsInstruments>
<CsScore>
f1  0   8193  10   1
f 10  0 256 -23 "bartokaufCundGis.cps"
f 11  0 256 -23 "bartokaufCundFes.cps"   
f 12  0 256 -23 "bartokaufGisundDisis.cps"   

i1   0  15 
i2   0    15


</CsScore>

 

Date2009-10-01 11:11
FromOeyvind Brandtsegg
Subject[Csnd] Re: Re: Re: Re: Re: Re: different pitches during a live-midi performance
I tried to move stuff around a bit in your example, to set it up the
way I described earlier.
Beware, I haven't tested this code. Let's hope it runs at all. Anyway,
it should provide a hint of what I did mean.
Note that the only thing happening in instr 1 is the ctrl7 inputs,
writing to global signals. This instrument should be "always on".
Instr 2 should not be always on as it is triggered from midi.

best
Oeyvind



-odevaudio -M0 -b400 -m0d




sr     = 48000
kr     = 2400
ksmps  = 20
nchnls = 2

 ipch = 8.02
 iequal = 12



massign    0, 2              ; assign all midi events to instr 1,
;pgmassign  0, 1              ; also all program changes

gkleftpedal init 0
gkmiddlepedal init 0

gasend1 init 0
gasend2 init 0

;*******************
instr 1

gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal

gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal

endin
;********************

   instr 2 ; modifies the pitch via the left and the right pedal

ileftpedal = i(gkleftpedal)
imiddlepedal = i(gkmiddlepedal)

ituningtable init  10

if (ileftpedal>0) then
ituningtable = 11 ;choose tuningtable number 11, if the left pedal is down
elseif (imiddlepedal>0) then
ituningtable = 12
else
ituningtable = 10 ; when the left pedal is not used, use tuningtable numer 10

endif

 imnn    notnum
 indx    =  imnn * 2 + 1   ; values in table alternate between
                           ; Midi note nums and frequencies

 icps    table  indx, ituningtable
  iamp    ampmidi        10000

icar = 1
imod = 1;

kndx = iamp/2000 ; the louder, the more index it will have

; making the overall amplitude envelope
kampenv mxadsr 100/iamp, 0.0402, 0.785, 0.102, 0.001
;the envelope for the fmindex
;        att,  decay,    isl, ausklingzeit

kindexenv madsr 4000/iamp, 3, 0.2, 0.111, 0
; and now the whole sound
a1   foscil iamp*kampenv, icps, icar, imod, kndx*kindexenv, 1
      outs a1, a1
asend1 = gasend1+a1
gasend2 = gasend2+a1
      endin


  instr 3 ;RECORDS ALL SOUND
;RECORD A Stereo 16 BIT SOUND FILE
fout    "soneartklarinette.wav", 4, gasend1, gasend2
;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
gasend1 = 0
gasend2 = 0
endin





f1  0   8193  10   1
f 10  0 256 -23 "bartokaufCundGis.cps"
f 11  0 256 -23 "bartokaufCundFes.cps"
f 12  0 256 -23 "bartokaufGisundDisis.cps"


i1   0  15




Date2009-10-01 20:50
FromStefan Thomas
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: different pitches during a live-midi performance
Dear Oeyvind,
thanks for Your support.
I tried it, but, unfortunately, I still have problems.
The left pedal works all the time, but the sostenuto-Pedal only sometimes.
Maybee it is a problem with the pedal itself.
I guess, I will try a different one, to see what will happen.

2009/10/1 Oeyvind Brandtsegg <obrandts@gmail.com>
I tried to move stuff around a bit in your example, to set it up the
way I described earlier.
Beware, I haven't tested this code. Let's hope it runs at all. Anyway,
it should provide a hint of what I did mean.
Note that the only thing happening in instr 1 is the ctrl7 inputs,
writing to global signals. This instrument should be "always on".
Instr 2 should not be always on as it is triggered from midi.

best
Oeyvind

<CsoundSynthesizer>
<CsOptions>
-odevaudio -M0 -b400 -m0d

</CsOptions>
<CsInstruments>

sr     = 48000
kr     = 2400
ksmps  = 20
nchnls = 2

 ipch = 8.02
 iequal = 12



massign    0, 2              ; assign all midi events to instr 1,
;pgmassign  0, 1              ; also all program changes

gkleftpedal init 0
gkmiddlepedal init 0

gasend1 init 0
gasend2 init 0

;*******************
instr 1

gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal

gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal

endin
;********************

  instr 2 ; modifies the pitch via the left and the right pedal

ileftpedal = i(gkleftpedal)
imiddlepedal = i(gkmiddlepedal)

ituningtable init  10

if (ileftpedal>0) then
ituningtable = 11 ;choose tuningtable number 11, if the left pedal is down
elseif (imiddlepedal>0) then
ituningtable = 12
else
ituningtable = 10 ; when the left pedal is not used, use tuningtable numer 10

endif

 imnn    notnum
 indx    =  imnn * 2 + 1   ; values in table alternate between
                          ; Midi note nums and frequencies

 icps    table  indx, ituningtable
 iamp    ampmidi        10000

icar = 1
imod = 1;

kndx = iamp/2000 ; the louder, the more index it will have

; making the overall amplitude envelope
kampenv mxadsr 100/iamp, 0.0402, 0.785, 0.102, 0.001
;the envelope for the fmindex
;        att,  decay,    isl, ausklingzeit

kindexenv madsr 4000/iamp, 3, 0.2, 0.111, 0
; and now the whole sound
a1   foscil iamp*kampenv, icps, icar, imod, kndx*kindexenv, 1
     outs a1, a1
asend1 = gasend1+a1
gasend2 = gasend2+a1
     endin


 instr 3 ;RECORDS ALL SOUND
;RECORD A Stereo 16 BIT SOUND FILE
fout    "soneartklarinette.wav", 4, gasend1, gasend2
;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
gasend1 = 0
gasend2 = 0
endin


</CsInstruments>

<CsScore>
f1  0   8193  10   1
f 10  0 256 -23 "bartokaufCundGis.cps"
f 11  0 256 -23 "bartokaufCundFes.cps"
f 12  0 256 -23 "bartokaufGisundDisis.cps"


i1   0  15


</CsScore>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2009-10-01 22:12
FromOeyvind Brandtsegg
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: different pitches during a live-midi performance
Ok,
did you try sticking in some print statements in instr 1?

Like this
gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal
gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal
printk2 gkleftpedal
printk2 gkmiddlepedal, 20

The argument with value 20 to printk2 offsets the printing 20 spaces,
so it's easier to differentiate between the two printing actions.

If it prints correctly according to your actions on the pedal, then
the pedal is fine.

all best
Oeyvind

2009/10/1 Stefan Thomas :
> Dear Oeyvind,
> thanks for Your support.
> I tried it, but, unfortunately, I still have problems.
> The left pedal works all the time, but the sostenuto-Pedal only sometimes.
> Maybee it is a problem with the pedal itself.
> I guess, I will try a different one, to see what will happen.
>
> 2009/10/1 Oeyvind Brandtsegg 
>>
>> I tried to move stuff around a bit in your example, to set it up the
>> way I described earlier.
>> Beware, I haven't tested this code. Let's hope it runs at all. Anyway,
>> it should provide a hint of what I did mean.
>> Note that the only thing happening in instr 1 is the ctrl7 inputs,
>> writing to global signals. This instrument should be "always on".
>> Instr 2 should not be always on as it is triggered from midi.
>>
>> best
>> Oeyvind
>>
>> 
>> 
>> -odevaudio -M0 -b400 -m0d
>>
>> 
>> 
>>
>> sr     = 48000
>> kr     = 2400
>> ksmps  = 20
>> nchnls = 2
>>
>>  ipch = 8.02
>>  iequal = 12
>>
>>
>>
>> massign    0, 2              ; assign all midi events to instr 1,
>> ;pgmassign  0, 1              ; also all program changes
>>
>> gkleftpedal init 0
>> gkmiddlepedal init 0
>>
>> gasend1 init 0
>> gasend2 init 0
>>
>> ;*******************
>> instr 1
>>
>> gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal
>>
>> gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal
>>
>> endin
>> ;********************
>>
>>   instr 2 ; modifies the pitch via the left and the right pedal
>>
>> ileftpedal = i(gkleftpedal)
>> imiddlepedal = i(gkmiddlepedal)
>>
>> ituningtable init  10
>>
>> if (ileftpedal>0) then
>> ituningtable = 11 ;choose tuningtable number 11, if the left pedal is down
>> elseif (imiddlepedal>0) then
>> ituningtable = 12
>> else
>> ituningtable = 10 ; when the left pedal is not used, use tuningtable numer
>> 10
>>
>> endif
>>
>>  imnn    notnum
>>  indx    =  imnn * 2 + 1   ; values in table alternate between
>>                           ; Midi note nums and frequencies
>>
>>  icps    table  indx, ituningtable
>>  iamp    ampmidi        10000
>>
>> icar = 1
>> imod = 1;
>>
>> kndx = iamp/2000 ; the louder, the more index it will have
>>
>> ; making the overall amplitude envelope
>> kampenv mxadsr 100/iamp, 0.0402, 0.785, 0.102, 0.001
>> ;the envelope for the fmindex
>> ;        att,  decay,    isl, ausklingzeit
>>
>> kindexenv madsr 4000/iamp, 3, 0.2, 0.111, 0
>> ; and now the whole sound
>> a1   foscil iamp*kampenv, icps, icar, imod, kndx*kindexenv, 1
>>      outs a1, a1
>> asend1 = gasend1+a1
>> gasend2 = gasend2+a1
>>      endin
>>
>>
>>  instr 3 ;RECORDS ALL SOUND
>> ;RECORD A Stereo 16 BIT SOUND FILE
>> fout    "soneartklarinette.wav", 4, gasend1, gasend2
>> ;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
>> gasend1 = 0
>> gasend2 = 0
>> endin
>>
>>
>> 
>>
>> 
>> f1  0   8193  10   1
>> f 10  0 256 -23 "bartokaufCundGis.cps"
>> f 11  0 256 -23 "bartokaufCundFes.cps"
>> f 12  0 256 -23 "bartokaufGisundDisis.cps"
>>
>>
>> i1   0  15
>>
>>
>> 
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>


Date2009-10-02 08:52
FromStefan Thomas
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: different pitches during a live-midi performance
Dear Oeyvind,
thanks again for Your support.
I did as You suggested.
I could see, that the message for the sostenuto pedal goes sometimes to number zero, although my foot still stays on the pedal.
I'm quite sure now, that it is a mechanical problem of the pedal itself.
But the code itself seems to work perfectly!

2009/10/1 Oeyvind Brandtsegg <obrandts@gmail.com>
Ok,
did you try sticking in some print statements in instr 1?

Like this
gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal
gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal
printk2 gkleftpedal
printk2 gkmiddlepedal, 20

The argument with value 20 to printk2 offsets the printing 20 spaces,
so it's easier to differentiate between the two printing actions.

If it prints correctly according to your actions on the pedal, then
the pedal is fine.

all best
Oeyvind

2009/10/1 Stefan Thomas <kontrapunktstefan@googlemail.com>:
> Dear Oeyvind,
> thanks for Your support.
> I tried it, but, unfortunately, I still have problems.
> The left pedal works all the time, but the sostenuto-Pedal only sometimes.
> Maybee it is a problem with the pedal itself.
> I guess, I will try a different one, to see what will happen.
>
> 2009/10/1 Oeyvind Brandtsegg <obrandts@gmail.com>
>>
>> I tried to move stuff around a bit in your example, to set it up the
>> way I described earlier.
>> Beware, I haven't tested this code. Let's hope it runs at all. Anyway,
>> it should provide a hint of what I did mean.
>> Note that the only thing happening in instr 1 is the ctrl7 inputs,
>> writing to global signals. This instrument should be "always on".
>> Instr 2 should not be always on as it is triggered from midi.
>>
>> best
>> Oeyvind
>>
>> <CsoundSynthesizer>
>> <CsOptions>
>> -odevaudio -M0 -b400 -m0d
>>
>> </CsOptions>
>> <CsInstruments>
>>
>> sr     = 48000
>> kr     = 2400
>> ksmps  = 20
>> nchnls = 2
>>
>>  ipch = 8.02
>>  iequal = 12
>>
>>
>>
>> massign    0, 2              ; assign all midi events to instr 1,
>> ;pgmassign  0, 1              ; also all program changes
>>
>> gkleftpedal init 0
>> gkmiddlepedal init 0
>>
>> gasend1 init 0
>> gasend2 init 0
>>
>> ;*******************
>> instr 1
>>
>> gkleftpedal ctrl7 1, 67, 0, 1 ; controller 67 is the left pedal
>>
>> gkmiddlepedal ctrl7 1, 66, 0, 1 ; controller 66 is the middle pedal
>>
>> endin
>> ;********************
>>
>>   instr 2 ; modifies the pitch via the left and the right pedal
>>
>> ileftpedal = i(gkleftpedal)
>> imiddlepedal = i(gkmiddlepedal)
>>
>> ituningtable init  10
>>
>> if (ileftpedal>0) then
>> ituningtable = 11 ;choose tuningtable number 11, if the left pedal is down
>> elseif (imiddlepedal>0) then
>> ituningtable = 12
>> else
>> ituningtable = 10 ; when the left pedal is not used, use tuningtable numer
>> 10
>>
>> endif
>>
>>  imnn    notnum
>>  indx    =  imnn * 2 + 1   ; values in table alternate between
>>                           ; Midi note nums and frequencies
>>
>>  icps    table  indx, ituningtable
>>  iamp    ampmidi        10000
>>
>> icar = 1
>> imod = 1;
>>
>> kndx = iamp/2000 ; the louder, the more index it will have
>>
>> ; making the overall amplitude envelope
>> kampenv mxadsr 100/iamp, 0.0402, 0.785, 0.102, 0.001
>> ;the envelope for the fmindex
>> ;        att,  decay,    isl, ausklingzeit
>>
>> kindexenv madsr 4000/iamp, 3, 0.2, 0.111, 0
>> ; and now the whole sound
>> a1   foscil iamp*kampenv, icps, icar, imod, kndx*kindexenv, 1
>>      outs a1, a1
>> asend1 = gasend1+a1
>> gasend2 = gasend2+a1
>>      endin
>>
>>
>>  instr 3 ;RECORDS ALL SOUND
>> ;RECORD A Stereo 16 BIT SOUND FILE
>> fout    "soneartklarinette.wav", 4, gasend1, gasend2
>> ;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
>> gasend1 = 0
>> gasend2 = 0
>> endin
>>
>>
>> </CsInstruments>
>>
>> <CsScore>
>> f1  0   8193  10   1
>> f 10  0 256 -23 "bartokaufCundGis.cps"
>> f 11  0 256 -23 "bartokaufCundFes.cps"
>> f 12  0 256 -23 "bartokaufGisundDisis.cps"
>>
>>
>> i1   0  15
>>
>>
>> </CsScore>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"