Csound Csound-dev Csound-tekno Search About

[Csnd] looptseg difficulties

Date2010-09-13 07:10
FromJim Aikin
Subject[Csnd] looptseg difficulties
Looks like a cool new opcode ... but when I try to use it, QuteCsound
crashes. Here's the line in my code:

k_env1	looptseg	0.1, 0, 1, 0, 0,	2, 2, 1,	5 ; , 0, 1

This crashes well before the end of the first iteration of the envelope
(about five seconds after the instrument starts). If I uncomment those last
two numbers, it crashes immediately. Trying various values in the second
triplet of parameters doesn't prevent the crash.

The manual is not entirely clear on the usage of this opcode. For starters,
the type and value parameters switch places after the first trio of
parameters:

ksig looptseg kfreq, ktrig, ktime0, kvalue0, ktype, [, ktime1] [,ktype1] [,
kvalue1] \

Should it be time/value/type throughout, or is the reversal intentional?

Second, it's unclear whether the type parameter is the type for the curve
that follows the corresponding envelope point or for the curve that precedes
it. This would make a difference.

Third, the number of parameters in the example given in the manual is
difficult to understand. After two triplets, it ends with a single
parameter. But that would be a time that has no value. Should we assume that
the value at point N is the same as the value at point 0? If so, the
parameter list should always end with a singleton (preceded by 1 or more
triplets). Is that correct?

Fourth, I don't understand this explanation: "ktype0...ktypeN -- shape of
the envelope. If the value is 0 then the shap eis linear; otherwise it is an
concave exponential (positive type) or a convex exponential (negative
type)." This sentence doesn't actually state what values should be used for
the type parameter to produce a positive or negative curve.

Can anyone clear up my perplexities? Thanks in advance!

--Jim Aikin

Date2010-09-13 18:29
FromIain McCurdy
Subject[Csnd] RE: looptseg difficulties


Hi Jim,

Hi Jim,

Sorry for the late response. I don't think anyone else has taken a look at this yet.

The manual says that ktime0 should always be zero, you've given it a value of 1 so perhaps that is the first problem. You also haven't given the opcode a correct number of arguments. It should have 7, 10, 13 etc. Qutecsound won't crash if you follow these requirements.

The following envelope rises from zero to 1 with concave shape over 5 seconds and decays from 1 to zero over the next 5 seconds also with a concave shape

k_env1     looptseg  0.1,0,  0,0,4, 0.5,1,-4, 0.5,0

and is roughly equivalent to 

k_env1      expseg   0.0001,5,1,5,0.0001

for one cycle.

Note that a type value of 4 results in a concave shape when a segment is rising but convex when falling so to achieve a concave shape on the descending segement of the envelope a value of -4 was required.

These are my findings after rendering some enveloped sine waves in Audacity. Please correct me anybody if I'm wrong somewhere.

Hope this helps,
Iain

----------------------------------------
> Date: Sun, 12 Sep 2010 23:10:46 -0700
> From: midiguru23@sbcglobal.net
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] looptseg difficulties
>
>
> Looks like a cool new opcode ... but when I try to use it, QuteCsound
> crashes. Here's the line in my code:
>
> k_env1 looptseg 0.1, 0, 1, 0, 0, 2, 2, 1, 5 ; , 0, 1
>
> This crashes well before the end of the first iteration of the envelope
> (about five seconds after the instrument starts). If I uncomment those last
> two numbers, it crashes immediately. Trying various values in the second
> triplet of parameters doesn't prevent the crash.
>
> The manual is not entirely clear on the usage of this opcode. For starters,
> the type and value parameters switch places after the first trio of
> parameters:
>
> ksig looptseg kfreq, ktrig, ktime0, kvalue0, ktype, [, ktime1] [,ktype1] [,
> kvalue1] \
>
> Should it be time/value/type throughout, or is the reversal intentional?
>
> Second, it's unclear whether the type parameter is the type for the curve
> that follows the corresponding envelope point or for the curve that precedes
> it. This would make a difference.
>
> Third, the number of parameters in the example given in the manual is
> difficult to understand. After two triplets, it ends with a single
> parameter. But that would be a time that has no value. Should we assume that
> the value at point N is the same as the value at point 0? If so, the
> parameter list should always end with a singleton (preceded by 1 or more
> triplets). Is that correct?
>
> Fourth, I don't understand this explanation: "ktype0...ktypeN -- shape of
> the envelope. If the value is 0 then the shap eis linear; otherwise it is an
> concave exponential (positive type) or a convex exponential (negative
> type)." This sentence doesn't actually state what values should be used for
> the type parameter to produce a positive or negative curve.
>
> Can anyone clear up my perplexities? Thanks in advance!
>
> --Jim Aikin
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/looptseg-difficulties-tp2837329p2837329.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
 		 	   		  

Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Date2010-09-13 19:48
FromJim Aikin
Subject[Csnd] RE: looptseg difficulties
Thanks, Iain. With your help, I've got it working now. I was misreading the
example in the manual.

What I don't believe the manual mentions is that the type parameter is
continuously variable. The further from 0 it is, the more convex or concave
the curve will be. This type of curve adjustment has become pretty standard
in graphic envelope editing in a lot of programs, and it's sweet to see it
implemented in Csound.

--JA