Csound Csound-dev Csound-tekno Search About

[Csnd] Getting Started

Date2019-09-14 18:33
FromChris Wade-Evans
Subject[Csnd] Getting Started
Hi perhaps someone can shed some light on a problem that I am having. I am working through the Getting Started page on csound.com and when I add the kEnv madsr iAtt, iDec, iSus, iRel  line to my file even without using kEnv I start getting extra spurious notes being triggered. If I switch to adsr instead these go away.

I have attached my csd file and below are the two different Output Console results. My apologies if this is not the correct way to send the information

1) With kenv madsr ...  line commented out

SECTION 1:
new alloc for instr 1:
B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281
B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.23354  0.23354
B  4.000 ..  6.000 T  6.000 TT  6.000 M:  0.23290  0.23290
Score finished in csoundPerformKsmps() with 2.
inactive allocs returned to freespace
end of score.		   overall amps:  0.23354  0.23354
	   overall samples out of range:        0        0
0 errors in performance

2) With kEnv madsr ... line uncommented

SECTION 1:
new alloc for instr 1:
B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281
new alloc for instr 1:
B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.46638  0.46638
B  4.000 ..  4.700 T  4.700 TT  4.700 M:  0.46641  0.46641
B  4.700 ..  6.000 T  6.000 TT  6.000 M:  0.23290  0.23290
B  6.000 ..  6.700 T  6.700 TT  6.700 M:  0.23291  0.23291
Score finished in csoundPerformKsmps() with 2.
inactive allocs returned to freespace
end of score.		   overall amps:  0.46641  0.46641
	   overall samples out of range:        0        0
0 errors in performance



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





sr = 44100
nchnls = 2
0dbfs = 1.0

instr 1
iFreq = p4
iAmp = p5
iAtt = 0.1
iDec = 0.4
iSus = 0.6
iRel = 0.7
kEnv madsr iAtt, iDec, iSus, iRel 

aOut vco2 iAmp, iFreq

out aOut, aOut
endin




i1 0 2 100 0.2
i1 2 2 200 0.2
i1 4 2 300 0.2




 
 
 100
 100
 320
 240
 true
 
 
  255
  255
  255
 






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

Date2019-09-14 18:48
Fromjoachim heintz
SubjectRe: [Csnd] Getting Started
hi chris -

i think what happens is that madsr actually makes the notes longer, so 
that you have an overlapping part.  this is not the case with adsr.

madsr is made for a real time midi keyboard situation: you press the 
key, and the release segment of the envelope begins when the "turnoff" 
has been received.  this means that the instrument instance actually 
becomes longer than written in the score.

i think adsr is the correct choice here, when you use a traditional 
score and not a midi keyboard.

best -
	joachim



On 14/09/19 19:33, Chris Wade-Evans wrote:
> Hi perhaps someone can shed some light on a problem that I am having. I am working through the Getting Started page on csound.com and when I add the kEnv madsr iAtt, iDec, iSus, iRel  line to my file even without using kEnv I start getting extra spurious notes being triggered. If I switch to adsr instead these go away.
>
> I have attached my csd file and below are the two different Output Console results. My apologies if this is not the correct way to send the information
>
> 1) With kenv madsr ...  line commented out
>
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281
> B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.23354  0.23354
> B  4.000 ..  6.000 T  6.000 TT  6.000 M:  0.23290  0.23290
> Score finished in csoundPerformKsmps() with 2.
> inactive allocs returned to freespace
> end of score.		   overall amps:  0.23354  0.23354
> 	   overall samples out of range:        0        0
> 0 errors in performance
>
> 2) With kEnv madsr ... line uncommented
>
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281
> new alloc for instr 1:
> B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.46638  0.46638
> B  4.000 ..  4.700 T  4.700 TT  4.700 M:  0.46641  0.46641
> B  4.700 ..  6.000 T  6.000 TT  6.000 M:  0.23290  0.23290
> B  6.000 ..  6.700 T  6.700 TT  6.700 M:  0.23291  0.23291
> Score finished in csoundPerformKsmps() with 2.
> inactive allocs returned to freespace
> end of score.		   overall amps:  0.46641  0.46641
> 	   overall samples out of range:        0        0
> 0 errors in performance
>
>
>
> 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

Date2019-09-15 13:22
FromChris Wade-Evans
SubjectRe: [Csnd] Getting Started
Joachim

Thanks very much for taking the time to reply.

I am assuming that the Getting Started tutorial uses madsr rather than adsr because it is going to introduce the keyboard midi control a little later.

When I was originally working through the Getting Started tutorial and got to the kEnv madsr ... section and the sounds started going wrong I thought that it might be because the total time value of the parameters to kEnv was longer than the one second note times in the score so I lengthened the notes to two seconds and changed their start times. This didn't fix things so then I removed the kEnv variable from the line below

out aOut * kEnv

changing it back to just

out aOut

So in my file, attached to my original post, the kEnv madsr ... variable is being declared but is not being actually used to modify anything else and it is still causing spurious notes if it is not commented out.

I did wonder if the second instance of "new alloc for instr 1:" in the odd sounding performance output is a clue to what is going wrong. Again this doesn't happen if you declare kEnv as adsr rather than madsr.

Thanks again for trying to help me out with this.

Chris 
_______________________

Chris Wade-Evans
Tel: +44 (0)20 7565 8235
Mob: +44 (0)7768 891733
Email: wevans@cix.co.uk

-----Original Message-----
From: A discussion list for users of Csound  On Behalf Of joachim heintz
Sent: 14 September 2019 18:49
To: CSOUND@LISTSERV.HEANET.IE
Subject: Re: [Csnd] Getting Started

hi chris -

i think what happens is that madsr actually makes the notes longer, so that you have an overlapping part.  this is not the case with adsr.

madsr is made for a real time midi keyboard situation: you press the key, and the release segment of the envelope begins when the "turnoff" 
has been received.  this means that the instrument instance actually becomes longer than written in the score.

i think adsr is the correct choice here, when you use a traditional score and not a midi keyboard.

best -
	joachim



On 14/09/19 19:33, Chris Wade-Evans wrote:
> Hi perhaps someone can shed some light on a problem that I am having. I am working through the Getting Started page on csound.com and when I add the kEnv madsr iAtt, iDec, iSus, iRel  line to my file even without using kEnv I start getting extra spurious notes being triggered. If I switch to adsr instead these go away.
>
> I have attached my csd file and below are the two different Output 
> Console results. My apologies if this is not the correct way to send 
> the information
>
> 1) With kenv madsr ...  line commented out
>
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281 B  2.000 ..  
> 4.000 T  4.000 TT  4.000 M:  0.23354  0.23354 B  4.000 ..  6.000 T  
> 6.000 TT  6.000 M:  0.23290  0.23290 Score finished in 
> csoundPerformKsmps() with 2.
> inactive allocs returned to freespace
> end of score.		   overall amps:  0.23354  0.23354
> 	   overall samples out of range:        0        0
> 0 errors in performance
>
> 2) With kEnv madsr ... line uncommented
>
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281 new alloc 
> for instr 1:
> B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.46638  0.46638 B  4.000 ..  
> 4.700 T  4.700 TT  4.700 M:  0.46641  0.46641 B  4.700 ..  6.000 T  
> 6.000 TT  6.000 M:  0.23290  0.23290 B  6.000 ..  6.700 T  6.700 TT  
> 6.700 M:  0.23291  0.23291 Score finished in csoundPerformKsmps() with 
> 2.
> inactive allocs returned to freespace
> end of score.		   overall amps:  0.46641  0.46641
> 	   overall samples out of range:        0        0
> 0 errors in performance
>
>
>
> 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

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

Date2019-09-15 13:43
FromChris Wade-Evans
SubjectRe: [Csnd] Getting Started
Joachim

Sorry I keep referring to the Getting Started tutorial. I actually mean the Get Started tutorial which is under the Learning tab on csound.com 

Thanks

Chris

_______________________

Chris Wade-Evans
Tel: +44 (0)20 7565 8235
Mob: +44 (0)7768 891733
Email: wevans@cix.co.uk

-----Original Message-----
From: A discussion list for users of Csound  On Behalf Of joachim heintz
Sent: 14 September 2019 18:49
To: CSOUND@LISTSERV.HEANET.IE
Subject: Re: [Csnd] Getting Started

hi chris -

i think what happens is that madsr actually makes the notes longer, so that you have an overlapping part.  this is not the case with adsr.

madsr is made for a real time midi keyboard situation: you press the key, and the release segment of the envelope begins when the "turnoff" 
has been received.  this means that the instrument instance actually becomes longer than written in the score.

i think adsr is the correct choice here, when you use a traditional score and not a midi keyboard.

best -
	joachim



On 14/09/19 19:33, Chris Wade-Evans wrote:
> Hi perhaps someone can shed some light on a problem that I am having. I am working through the Getting Started page on csound.com and when I add the kEnv madsr iAtt, iDec, iSus, iRel  line to my file even without using kEnv I start getting extra spurious notes being triggered. If I switch to adsr instead these go away.
>
> I have attached my csd file and below are the two different Output 
> Console results. My apologies if this is not the correct way to send 
> the information
>
> 1) With kenv madsr ...  line commented out
>
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281 B  2.000 ..  
> 4.000 T  4.000 TT  4.000 M:  0.23354  0.23354 B  4.000 ..  6.000 T  
> 6.000 TT  6.000 M:  0.23290  0.23290 Score finished in 
> csoundPerformKsmps() with 2.
> inactive allocs returned to freespace
> end of score.		   overall amps:  0.23354  0.23354
> 	   overall samples out of range:        0        0
> 0 errors in performance
>
> 2) With kEnv madsr ... line uncommented
>
> SECTION 1:
> new alloc for instr 1:
> B  0.000 ..  2.000 T  2.000 TT  2.000 M:  0.23281  0.23281 new alloc 
> for instr 1:
> B  2.000 ..  4.000 T  4.000 TT  4.000 M:  0.46638  0.46638 B  4.000 ..  
> 4.700 T  4.700 TT  4.700 M:  0.46641  0.46641 B  4.700 ..  6.000 T  
> 6.000 TT  6.000 M:  0.23290  0.23290 B  6.000 ..  6.700 T  6.700 TT  
> 6.700 M:  0.23291  0.23291 Score finished in csoundPerformKsmps() with 
> 2.
> inactive allocs returned to freespace
> end of score.		   overall amps:  0.46641  0.46641
> 	   overall samples out of range:        0        0
> 0 errors in performance
>
>
>
> 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

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

Date2019-09-15 20:57
Fromjohn
SubjectRe: [Csnd] Getting Started
In madsr the instrument length is extended by the release segment as 
default, so in your example each note is 2 seconds long plus the 0.7 you 
give as iRel.  It does not matter if the kEnv is used as the extra time is 
added in the initialisation of madsr because it is calculated.

I hear (and see in audacity) no distortion but the notes overlapping. 
Changing the score to 3 seconds between the onset and again there is no 
overlap as 2.7s is less than 3.

So you got what you asked fr, not what ypu thought you were asking for!

==John ff

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

Date2019-09-16 14:44
FromChris Wade-Evans
SubjectRe: [Csnd] Getting Started
John

Thanks for taking the time to reply. That makes sense now.

I had a look at the manual page for linsegr as well as the one for madsr and
that helped too. 

Also the manual page for madsr says "Please note that the release time
cannot be longer than 32767/kr seconds." But the linsegr manual page says
"For Csound versions prior to 5.00, the release time cannot be longer than
32767/kr seconds. This limit has been extended to (2^31-1)/kr." Purely out
of curiosity, does this mean that the limit has been extended for madsr as
well?

Thanks again 

Chris

_______________________

Chris Wade-Evans
Tel: +44 (0)20 7565 8235
Mob: +44 (0)7768 891733
Email: wevans@cix.co.uk

-----Original Message-----
From: A discussion list for users of Csound  On
Behalf Of john
Sent: 15 September 2019 20:57
To: CSOUND@LISTSERV.HEANET.IE
Subject: Re: [Csnd] Getting Started

In madsr the instrument length is extended by the release segment as
default, so in your example each note is 2 seconds long plus the 0.7 you
give as iRel.  It does not matter if the kEnv is used as the extra time is
added in the initialisation of madsr because it is calculated.

I hear (and see in audacity) no distortion but the notes overlapping. 
Changing the score to 3 seconds between the onset and again there is no
overlap as 2.7s is less than 3.

So you got what you asked fr, not what ypu thought you were asking for!

==John ff

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

Date2019-09-16 14:51
FromVictor Lazzarini
SubjectRe: [Csnd] Getting Started
Without looking at the code, I'd say what applies to linsegr applies to madsr, since this 
one is just a wrap over the other.

Prof. Victor Lazzarini
Maynooth University
Ireland

> On 16 Sep 2019, at 14:46, Chris Wade-Evans  wrote:
> 
> John
> 
> Thanks for taking the time to reply. That makes sense now.
> 
> I had a look at the manual page for linsegr as well as the one for madsr and
> that helped too. 
> 
> Also the manual page for madsr says "Please note that the release time
> cannot be longer than 32767/kr seconds." But the linsegr manual page says
> "For Csound versions prior to 5.00, the release time cannot be longer than
> 32767/kr seconds. This limit has been extended to (2^31-1)/kr." Purely out
> of curiosity, does this mean that the limit has been extended for madsr as
> well?
> 
> Thanks again 
> 
> Chris
> 
> _______________________
> 
> Chris Wade-Evans
> Tel: +44 (0)20 7565 8235
> Mob: +44 (0)7768 891733
> Email: wevans@cix.co.uk
> 
> -----Original Message-----
> From: A discussion list for users of Csound  On
> Behalf Of john
> Sent: 15 September 2019 20:57
> To: CSOUND@LISTSERV.HEANET.IE
> Subject: Re: [Csnd] Getting Started
> 
> In madsr the instrument length is extended by the release segment as
> default, so in your example each note is 2 seconds long plus the 0.7 you
> give as iRel.  It does not matter if the kEnv is used as the extra time is
> added in the initialisation of madsr because it is calculated.
> 
> I hear (and see in audacity) no distortion but the notes overlapping. 
> Changing the score to 3 seconds between the onset and again there is no
> overlap as 2.7s is less than 3.
> 
> So you got what you asked fr, not what ypu thought you were asking for!
> 
> ==John ff
> 
> 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

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

Date2019-09-16 15:12
Fromjohn
SubjectRe: [Csnd] Getting Started
adsr and madsr are just front ends or linseg and linsegr.

The oddity you point out is I think a documentation failure.  Will check it 
and update the manual as appropriate.   Thank you for noticing.

==John ff


On Mon, 16 Sep 2019, Chris Wade-Evans wrote:

> John
>
> Thanks for taking the time to reply. That makes sense now.
>
> I had a look at the manual page for linsegr as well as the one for madsr and
> that helped too.
>
> Also the manual page for madsr says "Please note that the release time
> cannot be longer than 32767/kr seconds." But the linsegr manual page says
> "For Csound versions prior to 5.00, the release time cannot be longer than
> 32767/kr seconds. This limit has been extended to (2^31-1)/kr." Purely out
> of curiosity, does this mean that the limit has been extended for madsr as
> well?
>
> Thanks again
>
> Chris
>
> _______________________
>
> Chris Wade-Evans
> Tel: +44 (0)20 7565 8235
> Mob: +44 (0)7768 891733
> Email: wevans@cix.co.uk

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