Csound Csound-dev Csound-tekno Search About

Any way to make breakpoint envelopes with unlimited number of points?

Date2007-09-10 13:12
Fromteemuo
SubjectAny way to make breakpoint envelopes with unlimited number of points?
I've been coding a sort of Cecilia equivalent for Windows for the past month,
and it's been progressing nicely...But one problem I'm having is how to pass
envelopes to the Csound orchestra efficiently and accurately. The envelopes
of course must have varying amounts of breakpoints and I am currently simply
using Ftables generated with GEN27. The problem with this approach is the
timing accuracy for the breakpoints that can be achieved. Now, of course, I
could simply use very large tables, like as large as the desired render
duration in sample frames, but that seems a bit silly...

Is there any other alternative? One possibility, I guess, would be to handle
the breakpoint functions directly in the orchestra code using linseg or
similar, as most of the processing modules I am planning to include in my
program only need one note in the score anyway, so having the envelopes
hardcoded in the orchestra in that way could be possible...But can the
Csound orchestra code compiler handle very large amounts of input fields to,
for example, linseg?

Thanks for any insights you might be able to give,

Teemu O
-- 
View this message in context: http://www.nabble.com/Any-way-to-make-breakpoint-envelopes-with-unlimited-number-of-points--tf4414113.html#a12591424
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-09-10 14:10
Frompeiman
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
Hi,

do you mean that you are not happy about the way Cecilia handles envelops?
For a good resolution why not just use very large table size (e.g. 16384 or
more) regardless of the actual length  of the note?  

Best
Peiman


teemuo wrote:
> 
> I've been coding a sort of Cecilia equivalent for Windows for the past
> month, and it's been progressing nicely...But one problem I'm having is
> how to pass envelopes to the Csound orchestra efficiently and accurately.
> The envelopes of course must have varying amounts of breakpoints and I am
> currently simply using Ftables generated with GEN27. The problem with this
> approach is the timing accuracy for the breakpoints that can be achieved.
> Now, of course, I could simply use very large tables, like as large as the
> desired render duration in sample frames, but that seems a bit silly...
> 
> Is there any other alternative? One possibility, I guess, would be to
> handle the breakpoint functions directly in the orchestra code using
> linseg or similar, as most of the processing modules I am planning to
> include in my program only need one note in the score anyway, so having
> the envelopes hardcoded in the orchestra in that way could be
> possible...But can the Csound orchestra code compiler handle very large
> amounts of input fields to, for example, linseg?
> 
> Thanks for any insights you might be able to give,
> 
> Teemu O
> 

-- 
View this message in context: http://www.nabble.com/Any-way-to-make-breakpoint-envelopes-with-unlimited-number-of-points--tf4414113.html#a12592487
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-09-10 14:27
Fromteemuo
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
I am not happy at all how Cecilia works right now on Windows...That why I've
been programming my own similar front-end for Csound...

A table size of 16384 isnt't nearly enough for very fast changes in
envelopes, especially if the sound is long...In fact the envelopes should be
able to respond sample accurately, in which case the table size(s) would
grow insanely...I'm hoping for a solution where I would not need huge
function tables...

As an example, I might want to have the following breakpoints (given as
seconds and then value) :

0.000 0.0
0.001 1.0
59.999 0.5
60.000 0.0

Using the table approach I would have to waste resources and use a very
large table just for these four breakpoints.

I think it is not possible to pass varying numbers of p-fields from the
score to, for example,  a linseg-opcode in the orchestra, right? 


peiman wrote:
> 
> Hi,
> 
> do you mean that you are not happy about the way Cecilia handles envelops?
> For a good resolution why not just use very large table size (e.g. 16384
> or more) regardless of the actual length  of the note?  
> 
> Best
> Peiman
> 
> 

-- 
View this message in context: http://www.nabble.com/Any-way-to-make-breakpoint-envelopes-with-unlimited-number-of-points--tf4414113.html#a12592780
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-09-10 14:42
Frompeiman
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
OK I see where you are coming from :-) I did myself wonder about that. Now I
know that Blue uses this breakpoint format for automating istruments and you
can import and export these automations. 

Just looking at a blue generated CSD this is what I see:

;
; ""
; by author
;
; 
;
; Generated by blue 0.117.0 (http://csounds.com/stevenyi/blue/index.html)
;




sr=44100
ksmps=1
nchnls=2


gk_blue_auto0 init 3.6726675034






	instr 1	;player
asig1, asig2  	diskin	
"/Users/peimankhosravi/Desktop/SOUNDS/newsounds_2006/china.aif",
gk_blue_auto0, 0, 1
outc  asig1, asig2

	endin

	instr 2	;Param: speed
gk_blue_auto0 line p4, p3, p5
	endin









i2	0	1.484375	3.6726675034	-3.3333334923
i2	1.484375	0.859375	-3.3333334923	2.6666665077
i2	2.34375	2.453125	2.6666665077	-4





i1	0.0	15.96875	3	4	5
e


So it breaks up the envelop points into line segments (as apposed to
linseg-opcode) using a global line object. This means that you don't have to
have very large  number of pfields but the line object has to be controlled
by a separate note (or rather a note section).

I would be very interested to see what solution you come up with. 

Best
peiman
 






teemuo wrote:
> 
> I am not happy at all how Cecilia works right now on Windows...That why
> I've been programming my own similar front-end for Csound...
> 
> A table size of 16384 isnt't nearly enough for very fast changes in
> envelopes, especially if the sound is long...In fact the envelopes should
> be able to respond sample accurately, in which case the table size(s)
> would grow insanely...I'm hoping for a solution where I would not need
> huge function tables...
> 
> As an example, I might want to have the following breakpoints (given as
> seconds and then value) :
> 
> 0.000 0.0
> 0.001 1.0
> 59.999 0.5
> 60.000 0.0
> 
> Using the table approach I would have to waste resources and use a very
> large table just for these four breakpoints.
> 
> I think it is not possible to pass varying numbers of p-fields from the
> score to, for example,  a linseg-opcode in the orchestra, right? 
> 
> 
> peiman wrote:
>> 
>> Hi,
>> 
>> do you mean that you are not happy about the way Cecilia handles
>> envelops? For a good resolution why not just use very large table size
>> (e.g. 16384 or more) regardless of the actual length  of the note?  
>> 
>> Best
>> Peiman
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Any-way-to-make-breakpoint-envelopes-with-unlimited-number-of-points--tf4414113.html#a12593022
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-09-10 14:51
Fromteemuo
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
Ok, the Blue-approach seems clever and workable...I have try something like
that...Thanks a lot for suggesting!


peiman wrote:
> 
> OK I see where you are coming from :-) I did myself wonder about that. Now
> I know that Blue uses this breakpoint format for automating istruments and
> you can import and export these automations. 
> 
> Just looking at a blue generated CSD this is what I see:
> 
> -snip-
> 
> So it breaks up the envelop points into line segments (as apposed to
> linseg-opcode) using a global line object. This means that you don't have
> to have very large  number of pfields but the line object has to be
> controlled by a separate note (or rather a note section).
> 
> I would be very interested to see what solution you come up with. 
> 
> Best
> peiman
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Any-way-to-make-breakpoint-envelopes-with-unlimited-number-of-points--tf4414113.html#a12593122
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-09-10 15:11
FromJacob Joaquin
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
My solution ended up being virtually identical to peiman's, except that it
uses the zak bus instead of a global variable.  :)




sr     = 44100
kr     = 4410
ksmps  = 10
nchnls = 1

; Zak Busses
# define cEnvelope  # 1 #
zakinit 1, 1


instr EnvelopeInit    ; Initializes the value of $cEnvelope to Zero
	ziw 0, $cEnvelope
endin


instr Envelope
	idur      = p3
	iendpoint = p4

	ival zir  $cEnvelope
	kenv line ival, idur, iendpoint

	zkw kenv, $cEnvelope
endin


instr Sine
	idur  = p3
	ifreq = p4

	kenv zkr   $cEnvelope
	aosc oscil kenv * 0dbfs, ifreq, 1

	out aosc
endin




f1 0 8193 10 1

i "EnvelopeInit" 0 1  ; Initializes the value of $cEnvelope to Zero

i "Envelope" 0 1 1    ; Individual envelope break points
i "Envelope" + . 0.8
i "Envelope" + . 0.2
i "Envelope" + . 1
i "Envelope" + 2 0
i "Envelope" + 2 1
i "Envelope" + 4 0
i "Envelope" + 2 1
i "Envelope" + 2 0

i "Sine" 0 16 262  ; Generate sine wave






This code is a derivative from the Csound Blog entry "Adding Zak to the
Mix."  There is another possibility of using the schedule or the event
opcodes to generate envelope segments, as done in the "Back in the ADSR."

Adding Zak to the Mix
http://www.thumbuki.com/csound/files/thumbuki20070410.csd

Back in the ADSER
http://www.thumbuki.com/csound/files/thumbuki20061227.csd

Best,
Jake

---- 
The Csound Blog 
http://www.thumbuki.com/csound/blog  




teemuo wrote:
> 
> Ok, the Blue-approach seems clever and workable...I have try something
> like that...Thanks a lot for suggesting!
> 
> 
> peiman wrote:
>> 
>> OK I see where you are coming from :-) I did myself wonder about that.
>> Now I know that Blue uses this breakpoint format for automating
>> istruments and you can import and export these automations. 
>> 
>> Just looking at a blue generated CSD this is what I see:
>> 
>> -snip-
>> 
>> So it breaks up the envelop points into line segments (as apposed to
>> linseg-opcode) using a global line object. This means that you don't have
>> to have very large  number of pfields but the line object has to be
>> controlled by a separate note (or rather a note section).
>> 
>> I would be very interested to see what solution you come up with. 
>> 
>> Best
>> peiman
>> 
> 

-- 
View this message in context: http://www.nabble.com/Any-way-to-make-breakpoint-envelopes-with-unlimited-number-of-points--tf4414113.html#a12593628
Sent from the Csound - General mailing list archive at Nabble.com.

Date2007-09-10 15:20
Fromjoachim heintz
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
hi teemuo -

i'm not sure if this a good idea for your case, but one solution could also be to write the breakpoint pair-values (time and value) in a function table via GEN02 (as much as you need), and then to read the table in the orc and to make a linseg with this values. a simple example with your values:


;making a ftable with pairs timepoint/value
gibreakp ftgen 0, 0, 8, -2, 0, 0, 0.001, 1, 59.999, 0.5, 60, 0

instr 1

;reading the table values
itmpt1 table 0, gibreakp
ival1 table 1, gibreakp
itmpt2 table 2, gibreakp
ival2 table 3, gibreakp
itmpt3 table 4, gibreakp
ival3 table 5, gibreakp
itmpt4 table 6, gibreakp
ival4 table 7, gibreakp

;calculating the durations
idur1 = itmpt2 - itmpt1
idur2 = itmpt3 - itmpt2
idur3 = itmpt4 - itmpt3

;envelope and audiosignal
kenv linseg ival1, idur1, ival2, idur2, ival3, idur3, ival4
asin oscils 0dbfs, 666, 0
aenv = asin * kenv
out aenv
endin

i1 0 60

best -

joachim




Am 10.09.2007 um 15:27 schrieb teemuo:


I am not happy at all how Cecilia works right now on Windows...That why I've
been programming my own similar front-end for Csound...

A table size of 16384 isnt't nearly enough for very fast changes in
envelopes, especially if the sound is long...In fact the envelopes should be
able to respond sample accurately, in which case the table size(s) would
grow insanely...I'm hoping for a solution where I would not need huge
function tables...

As an example, I might want to have the following breakpoints (given as
seconds and then value) :

0.000 0.0
0.001 1.0
59.999 0.5
60.000 0.0

Using the table approach I would have to waste resources and use a very
large table just for these four breakpoints.

I think it is not possible to pass varying numbers of p-fields from the
score to, for example,  a linseg-opcode in the orchestra, right? 


peiman wrote:

Hi,

do you mean that you are not happy about the way Cecilia handles envelops?
For a good resolution why not just use very large table size (e.g. 16384
or more) regardless of the actual length  of the note?  

Best
Peiman



-- 
Sent from the Csound - General mailing list archive at Nabble.com.

-- 
Send bugs reports to this list.
To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk


Date2007-09-10 16:50
From"Steven Yi"
SubjectRe: Any way to make breakpoint envelopes with unlimited number of points?
AttachmentsNone