Csound Csound-dev Csound-tekno Search About

Re: [Csnd] Filter value problem

Date2024-10-09 17:49
FromJean Basile Sosa
SubjectRe: [Csnd] Filter value problem
Thank you very much Steven,

Thanks to your advice, my little piece of code is now functional... In fact, it's the basis of a step sequencer that allows me to trigger different control values step by step (in this case duration, amplitude and frequency).

If you'd like to have a quick look at all this, and tell me if the logic isn't too catastrophic... I'd love to hear any advice!

See you soon!

Jean-Basile




-odac



sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

;gkcf init 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(70/60)

kCpt init 0

if kTrig == 1 then

	kCpt += 1

	gkdur = kArrDur[kCpt-1]
	gkamp = kArrVol[kCpt-1]
	gkcps = kArrNote[kCpt-1]

schedulek(2,0,gkdur,gkamp,gkcps)

elseif kCpt == iLenArray/3 then

	kCpt = 0

endif

endin

instr 2

gkcf = expseg:k(p5+(60*p4),p3,p5,1,p5)
kfilt = 120
gkcf = limit:k(gkcf+(12*kfilt),20,20000)
schedule(3,0,i(gkdur),i(gkamp),mtof(i(gkcps)))

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





f0 3600
f7 0 4097 7 -1 4096 1

f 100 0 24 -2 4.8 52. 0.8 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 60





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

Date2024-10-09 17:58
From"Dr. Richard Boulanger"
SubjectRe: [Csnd] Filter value problem
Dark - Brooding - Lovely

- Dr.B


Dr. Richard Boulanger

Professor

Electronic Production and Design

Berklee College of Music

Professional Writing & Technology Division



On Wed, Oct 9, 2024 at 12:49 PM Jean Basile Sosa <sosa.jeanbasile@gmail.com> wrote:
Thank you very much Steven,

Thanks to your advice, my little piece of code is now functional... In fact, it's the basis of a step sequencer that allows me to trigger different control values step by step (in this case duration, amplitude and frequency).

If you'd like to have a quick look at all this, and tell me if the logic isn't too catastrophic... I'd love to hear any advice!

See you soon!

Jean-Basile


<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

;gkcf init 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(70/60)

kCpt init 0

if kTrig == 1 then

        kCpt += 1

        gkdur = kArrDur[kCpt-1]
        gkamp = kArrVol[kCpt-1]
        gkcps = kArrNote[kCpt-1]

schedulek(2,0,gkdur,gkamp,gkcps)

elseif kCpt == iLenArray/3 then

        kCpt = 0

endif

endin

instr 2

gkcf = expseg:k(p5+(60*p4),p3,p5,1,p5)
kfilt = 120
gkcf = limit:k(gkcf+(12*kfilt),20,20000)
schedule(3,0,i(gkdur),i(gkamp),mtof(i(gkcps)))

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.8 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 60

</CsScore>

</CsoundSynthesizer>

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