[Csnd] Explanation on a simple ADSR code.

Hello. I'm studying and italian book from Luca Bimbi.

Introducing the ADSR, the author provides this example:

instr envadsr
iampiezza = ampdbfs(p4)
kenv adsr 0.1, 0.5, 1, 0.8
kfreq linseg p5, p3*0.2, p5*1.5, p3*0.8, p5/2
asig oscili kenv*iampiezza, kfreq ; usa inviluppo creato mediante linen
out asig, asig
endin
schedule("envadsr",0, 5, -18, 440)

The <CsScore> section is empty.

So my questions:

1. where do the script take the p3...p5 parameters?

2. Why 0.5 as decay if sustain is 1? According to my knoledge it is a non-sense value, isn'it?

Thanks.

Gabe.

Hi Gabe,
the p-values are parameters to the instruments, usually passed in the score. But there are many values to "play" an instrument. In this example schedule has been used:
schedule("envadsr",0, 5, -18, 440)
That says: schedule/play the instrument called "envadsr" immediately, 0, and have it play for 5 seconds. p4 and p5 are then -18, 440.

As for your seconds question: yes other values might have been chosen for decay. Depending on the envelope generator, I noticed that some do not accept 0. 0 is always a bad idea if you have an exponential generator. In general: chooose a very low value like
.0001
or something and you will be fine with all the envelope generators. That goes for attack, decay and release, if you don't need any of them.

I hope this helps.

Best wishes,

Jeanette

A lot, many tnx.

Gabe.

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        GitHub · Where software is built
Discussions of bugs and features can be posted here