[Csnd] Filter value problem
Date | 2024-10-08 06:08 |
From | Jean Basile Sosa |
Subject | [Csnd] Filter value problem |
Hello Csound, I seem to have a problem with the initialisation of a variable... In the following code, the value of kfilt (instrument 1) is always the same (=7), but the result (in audio) is always different between the first execution of instrument 1 and the following ones... Could you please tell me where my error is? Have a nice day |
Date | 2024-10-08 06:35 |
From | Steven Yi |
Subject | Re: [Csnd] Filter value problem |
Hi Jean Basille, My guess is it is the i() statements that are causing problems. I think it would be simpler if you took the code marked as "/////////Here maybe is the problem ?" and make that its own instrument that is also fired off by schedulek. That would allow you to use the kvals from the array in a straightforward way from schedulek, and in the new gkcf cutoff modulation instrument, it can read those as init-time p-fields and the logic of it should be a little clearer. (Or perhaps better, have instr 2 just have a local kcf and pass the relevant values as additional pfields). Hope that helps! Steven On Tue, Oct 8, 2024 at 1:08 AM Jean Basile Sosa <sosa.jeanbasile@gmail.com> wrote: Hello Csound, |
Date | 2024-10-08 07:45 |
From | Jean-Basile Sosa <000011b88457506e-dmarc-request@LISTSERV.HEANET.IE> |
Subject | Re: [Csnd] Filter value problem |
Hi Steven, Thank you very much, even if I understand (I believe...) the global logic, I don't solve the problem.. Now the first note only of the first instrument 1 execution is ignore in this code modification :( <CsoundSynthesizer> <CsOptions> -odac </CsOptions> <CsInstruments> sr = 44100 ksmps = 32 nchnls = 2 0dbfs = 1 instr 1 kArr[] init ftlen(100) copyf2array kArr,100 iLenArray = lenarray(kArr) kArrDur[] init iLenArray/3 kArrDur slicearray kArr, 0, iLenArray-1, 3 kArrNote[] init iLenArray/3 kArrNote slicearray kArr, 1, iLenArray-1, 3 kArrVol[] init iLenArray/3 kArrVol slicearray kArr, 2, iLenArray-1, 3 kTrig = metro:k(60/60) kCpt init 0 if kTrig == 1 then kCpt += 1 kdur = kArrDur[kCpt-1] kamp = kArrVol[kCpt-1] kcps = kArrNote[kCpt-1]
schedulek(2,0,kdur,kamp,mtof(kcps)) schedulek(3,0,kdur,kamp,mtof(kcps))
elseif kCpt == iLenArray/3 then kCpt = 0 endif
endin instr 2 gkcf = expseg:k(p5+(60*p4),p3,p5,1,p5) kfilt = 7 gkcf = limit:k(mtof(gkcf+(12*kfilt)),20,20000)
endin instr 3
asig = poscil:a(p4,p5,7) asig += poscil:a(p4,p5*0.5,7) asig += poscil:a(p4,p5*0.75, 7) asig += poscil:a(p4,p5*1.5,7 )
acut = expon:a(i(gkcf), p3, 200) aout = diode_ladder(asig, acut, 3, 1, 4) aout *= expseg:a(1.0, p3 - 0.05, 1.0, 0.05, 0.001) aout = limit(aout, -1.0, 1.0) outs aout, aout endin </CsInstruments> <CsScore> f0 3600 f7 0 4097 7 -1 4096 1 f 100 0 24 -2 4.8 52. 0.12 2.84 67. 0.104 1.46 98. 0. 1.78 71. 0.092 0.14 33. 0. 3.12 45. 0.08 1.4 76. 0.152 0.36 59. 0. i1 0 5 i1 6 5 i1 12 5 </CsScore> </CsoundSynthesizer> I think I have to read again the manual... But if you have an idea to help me again... Have a good day, Jean-Basile Le mar. 8 oct. 2024 à 07:35, Steven Yi <stevenyi@gmail.com> a écrit :
|