Csound Csound-dev Csound-tekno Search About

[Csnd] Explanation on a simple ADSR code.

Date2025-01-17 13:47
FromGabriele Battaglia <0000013f12e4daf0-dmarc-request@LISTSERV.HEANET.IE>
Subject[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  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.


-- 
Gabriele Battaglia (IZ4APU)
--... ...--  -.. .  .. --.. ....- .- .--. ..-  - ..-  . .
Sent from my Giant Desktop PC

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

Date2025-01-17 13:57
From"Jeanette C."
SubjectRe: [Csnd] Explanation on a simple ADSR code.
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

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

If there's nothing missing in my life
Then why do these tears come at night <3
(Britney Spears)

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

Date2025-01-17 14:28
FromGabriele Battaglia <0000013f12e4daf0-dmarc-request@LISTSERV.HEANET.IE>
SubjectRe: [Csnd] Explanation on a simple ADSR code.
Il 17/01/2025 14:57, Jeanette C. ha scritto:
> [...] I hope this helps.


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
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here