Csound Csound-dev Csound-tekno Search About

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

Date2009-09-29 16:34
From"Art Hunkins"
Subject[Csnd] Re: Re: different pitches during a live-midi performance
Then, at the start of each "real" instrument, put:
ileftpedal = i(gkleftpedal)
imiddlepedal = i(gkmiddlepedal)

if this is what you want.

Art Hunkins

----- Original Message ----- 
From: "Oeyvind Brandtsegg" 
To: 
Sent: Tuesday, September 29, 2009 7:51 AM
Subject: [Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: 
different pitches during a live-midi performance


Yes,
the following instrument should be "always on",
like this in the score:
i1 0 9999 ; play for 9999 seconds

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
printk2 gkleftpedal, 0
printk2 gkmiddlepedal , 10
; the number 10 in the line above,
; makes 10 spaces  at the start of the printed line,
; so it's easier to differentiate between the two prints
endin

Hope this helps
best
Oeyvind



2009/9/29 Stefan Thomas :
> Dear Oeyvind,
> thanks for Your fast reply!
> You told me
>>
>> Then you could also put a prinktk2 statement
>> in the always-on-midi-input instrument to see if the signal from the
>> middle pedal is consistent.
>
> Could You be please so kind and give me an short code-example, how I can 
> do
> this?
> The other things, I guess, I've understand. I will try co create a second
> instrument, consisting only of the three pedals
>
> 2009/9/29 Oeyvind Brandtsegg 
>>
>> It seems there might be an "override" if both pedals are down, the
>> middle pedal signal will be ignored, as you use if ..elseif. Maybe
>> this is not a problem in practice.
>> You could also try putting the ctrl7 opcodes in a separate instrument
>> (always on), maybe this is safer than turning the midi input on and
>> off with the instrument. Then you could also put a prinktk2 statement
>> in the always-on-midi-input instrument to see if the signal from the
>> middle pedal is consistent.
>>
>> best
>> Oeyvind
>>
>> 2009/9/29 Stefan Thomas :
>> > Dear community,
>> > unfortunately I have still problems with my idea of changing the pitch
>> > with
>> > the pressure of the left or the sostenuto-pedal.
>> > When I use the left pedal, I'd never had problems with changing the
>> > pitch,
>> > but the when I using the middle-pedal, it works only sometimes, and 
>> > most
>> > of
>> > the time the desired change of pitch doesn't appear.
>> > I'm quite aware of the fact, that it could be a mechanical problem with
>> > the
>> > midi pedal, but, before I buy I new one, I want to kindly ask You, if
>> > You
>> > could have a look on the code. Maybee the problem is here, but I can't
>> > see.
>> > Here the file:
>> >
>> > 
>> > 
>> > -odevaudio -M0 -b400 -m0d
>> > 
>> > 
>> >
>> > 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
>> >
>> >
>> >
>> > ;;;;;;; defining the 1st instrument ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>> > instr 1
>> > 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 = 11 ;choose tuningtable number 11, if the left pedal is
>> > down
>> > elseif (imiddlepedal>0) then
>> > ituningtable = 12
>> > else
>> > ituningtable = 10 ; when the left and the mittle pedal are 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 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
>> > ;making a softer amplitude envelope with linenr
>> > ;klinen linenr 1, 0.2, 0, 0.01
>> > ;outs klinen*a1, klinen*a1
>> > outs a1, a1
>> > 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 60 ;play one minute
>> >
>> >
>> > 
>> >
>> >
>> >
>> >
>> >
>>
>>
>> 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"= 


Date2009-09-29 17:58
FromStefan Thomas
Subject[Csnd] Re: Re: Re: different pitches during a live-midi performance
AttachmentsbartokaufCundFes.cps  bartokaufCundGis.cps  bartokaufGisundDisis.cps  
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>