Csound Csound-dev Csound-tekno Search About

Global Variables reinitialisation - Yet Another Newb Question !

Date2005-12-07 18:12
FromNicolas =?iso-8859-1?Q?Castagn=E9?=
SubjectGlobal Variables reinitialisation - Yet Another Newb Question !
Hi all,

yet another 'newbee', though precise, question.


Let's define a global echo instrument such as :

	instr 198 ; GLOBAL ECHO
idur = p3
itime = p4
iloop = p5
kenv linen 1, .01, idur, .01
acomb comb gacmb, itime, iloop, 0

out acomb*kenv
gacmb =0
	endin


This instrument work with the global variable gacmb.



Now, let's create various copies of this instrument in the score :

;ins		strt	dur	time	loopt
i 198	0	6	10	.8
i 198	0	6	10	.3
i 198	0	6	10	.3




What happens when these multiple instances run in parallel ?



A possible behavior would be :
When the a-rate instruction :
	gacmb =0
is executed in the first instance of the 
instrument, then the global variable gacmb is set 
to Zero.

Consequently, the other instances of the 
instrument would process a Null signal !!

MMmhhhhh... Let me guess... This is not the CSound behavior in that case.

Possibly, the multiple instances are executed 'in 
parallel', Opcode per Opcode... But I am not sure 
at all !


I red carefully the CSound program flow 
http://www.csounds.com/internals/index.html but 
did not find the answer...


I would be grateful if someone could tell me a bit more about :
- how CSound behaves in that case
- why he behaves so (how it is implemented)


Thx much in advance !
(and for answers to my past questions)

Nicolas


PS : as you may have seen, my 'example' is coming 
from Dr Boulanger's first chapter of the CSound 
Book :
http://www.csounds.com/chapter1/index.html

Indeed, it corresponds with instrument 137 in this chapter :
http://www.csounds.com/chapter1/instruments/01/137/137.html
http://www.csounds.com/chapter1/instruments/01/137.sco



-- 
-------------------------------------------------------------------
Dr Nicolas CASTAGNE

ACROE-ICA,
46 av. Félix Viallet
38 000 Grenoble
http://acroe.imag.fr

Tel : (33) 4 76 57 46 60
-------------------------------------------------------------------

Date2005-12-08 09:48
FromVictor Lazzarini
SubjectRe: Global Variables reinitialisation - Yet Another Newb Question !
I'm not really sure what you said is right. I just did a test here using

gk1 init 0
instr 1
gk1 = 1
endin

instr 2
k1 = p4
printk 1, gk1
printk 1, k1
gk1 = 0;
endin

and

i1 0 10
i2 0 10 1
i2 0 10 2

The printout goes like:

  i   2 time     0.00023:     1.00000
  i   2 time     0.00023:     1.00000
  i   2 time     0.00023:     0.00000 <---
  i   2 time     0.00023:     2.00000 <---
  i   2 time     1.00000:     1.00000
  i   2 time     1.00000:     1.00000
  i   2 time     1.00000:     0.00000 <---
  i   2 time     1.00000:     2.00000 <---


So you can see that the second instance of the instrument (marked with <---)
actually runs after the first and gk1 is set to 0

I have not tested your example, but I will do.

Victor

At 18:12 07/12/2005, you wrote:
>Hi all,
>
>yet another 'newbee', though precise, question.
>
>
>Let's define a global echo instrument such as :
>
>         instr 198 ; GLOBAL ECHO
>idur = p3
>itime = p4
>iloop = p5
>kenv linen 1, .01, idur, .01
>acomb comb gacmb, itime, iloop, 0
>
>out acomb*kenv
>gacmb =0
>         endin
>
>
>This instrument work with the global variable gacmb.
>
>
>
>Now, let's create various copies of this instrument in the score :
>
>;ins            strt    dur     time    loopt
>i 198   0       6       10      .8
>i 198   0       6       10      .3
>i 198   0       6       10      .3
>
>
>
>
>What happens when these multiple instances run in parallel ?
>
>
>
>A possible behavior would be :
>When the a-rate instruction :
>         gacmb =0
>is executed in the first instance of the instrument, then the global 
>variable gacmb is set to Zero.
>
>Consequently, the other instances of the instrument would process a Null 
>signal !!
>
>MMmhhhhh... Let me guess... This is not the CSound behavior in that case.
>
>Possibly, the multiple instances are executed 'in parallel', Opcode per 
>Opcode... But I am not sure at all !
>
>
>I red carefully the CSound program flow 
>http://www.csounds.com/internals/index.html but did not find the answer...
>
>
>I would be grateful if someone could tell me a bit more about :
>- how CSound behaves in that case
>- why he behaves so (how it is implemented)
>
>
>Thx much in advance !
>(and for answers to my past questions)
>
>Nicolas
>
>
>PS : as you may have seen, my 'example' is coming from Dr Boulanger's 
>first chapter of the CSound Book :
>http://www.csounds.com/chapter1/index.html
>
>Indeed, it corresponds with instrument 137 in this chapter :
>http://www.csounds.com/chapter1/instruments/01/137/137.html
>http://www.csounds.com/chapter1/instruments/01/137.sco
>
>
>
>--
>-------------------------------------------------------------------
>Dr Nicolas CASTAGNE
>
>ACROE-ICA,
>46 av. Félix Viallet
>38 000 Grenoble
>http://acroe.imag.fr
>
>Tel : (33) 4 76 57 46 60
>-------------------------------------------------------------------
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 

Date2005-12-08 10:06
FromVictor Lazzarini
SubjectRe: Global Variables reinitialisation - Yet Another Newb Question !
Just tested your example and I only get a single
output, as predicted.

instr 3

gacmb rand 10000

endin

  instr 199 ; GLOBAL ECHO
idur = p3
itime = p4
iloop = p5
kenv linen 1, .01, idur, .01
acomb comb gacmb, itime, iloop, 0


out acomb*kenv
gacmb =0
         endin

with

i3 0 0.05
i 198   0       6       10      .8
i 198   0       6       10      .3
i 198   0       6       10      .3


In fact if  gacmb=0 from instr 198 is removed and

instr 200

gacmb = 0

endin

Then all three instances output sound, as predicted,
again.

Victor

At 18:12 07/12/2005, you wrote:
>Hi all,
>
>yet another 'newbee', though precise, question.
>
>
>Let's define a global echo instrument such as :
>
>         instr 198 ; GLOBAL ECHO
>idur = p3
>itime = p4
>iloop = p5
>kenv linen 1, .01, idur, .01
>acomb comb gacmb, itime, iloop, 0
>
>out acomb*kenv
>gacmb =0
>         endin
>
>
>This instrument work with the global variable gacmb.
>
>
>
>Now, let's create various copies of this instrument in the score :
>
>;ins            strt    dur     time    loopt
>i 198   0       6       10      .8
>i 198   0       6       10      .3
>i 198   0       6       10      .3
>
>
>
>
>What happens when these multiple instances run in parallel ?
>
>
>
>A possible behavior would be :
>When the a-rate instruction :
>         gacmb =0
>is executed in the first instance of the instrument, then the global 
>variable gacmb is set to Zero.
>
>Consequently, the other instances of the instrument would process a Null 
>signal !!
>
>MMmhhhhh... Let me guess... This is not the CSound behavior in that case.
>
>Possibly, the multiple instances are executed 'in parallel', Opcode per 
>Opcode... But I am not sure at all !
>
>
>I red carefully the CSound program flow 
>http://www.csounds.com/internals/index.html but did not find the answer...
>
>
>I would be grateful if someone could tell me a bit more about :
>- how CSound behaves in that case
>- why he behaves so (how it is implemented)
>
>
>Thx much in advance !
>(and for answers to my past questions)
>
>Nicolas
>
>
>PS : as you may have seen, my 'example' is coming from Dr Boulanger's 
>first chapter of the CSound Book :
>http://www.csounds.com/chapter1/index.html
>
>Indeed, it corresponds with instrument 137 in this chapter :
>http://www.csounds.com/chapter1/instruments/01/137/137.html
>http://www.csounds.com/chapter1/instruments/01/137.sco
>
>
>
>--
>-------------------------------------------------------------------
>Dr Nicolas CASTAGNE
>
>ACROE-ICA,
>46 av. Félix Viallet
>38 000 Grenoble
>http://acroe.imag.fr
>
>Tel : (33) 4 76 57 46 60
>-------------------------------------------------------------------
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 

Date2005-12-08 10:30
FromNicolas =?iso-8859-1?Q?Castagn=E9?=
SubjectRe: Global Variables reinitialisation - Yet Another Newb Question !
Hi Victor,

Thx for your answer, which confirms my analysis !

Indeed, the example is taken from Dr Boulanger's 
first chapter of the CSound Book.

I may write to him about this, I guess...

Anyhow, there is something a bit strange with Dr Boulanger's example.

When hearing the latest 'notes' of the 
instrument/score #137, on time=46 secondes,
http://www.csounds.com/chapter1/instruments/01/137/137.html
http://www.csounds.com/chapter1/instruments/01/137.sco

I hear quite clearly a 'multiple-rate echo' as 
intended in  the score (through multiple 
instances of instruments #198)...
This does not match with what you found !

Should I change my hears ? :)
Or is there something weard ?

All the best,
Nicolas

>Just tested your example and I only get a single
>output, as predicted.
>
>instr 3
>
>gacmb rand 10000
>
>endin
>
>  instr 199 ; GLOBAL ECHO
>idur = p3
>itime = p4
>iloop = p5
>kenv linen 1, .01, idur, .01
>acomb comb gacmb, itime, iloop, 0
>
>
>out acomb*kenv
>gacmb =0
>         endin
>
>with
>
>i3 0 0.05
>i 198   0       6       10      .8
>i 198   0       6       10      .3
>i 198   0       6       10      .3
>
>
>In fact if  gacmb=0 from instr 198 is removed and
>
>instr 200
>
>gacmb = 0
>
>endin
>
>Then all three instances output sound, as predicted,
>again.
>
>Victor
>
>At 18:12 07/12/2005, you wrote:
>>Hi all,
>>
>>yet another 'newbee', though precise, question.
>>
>>
>>Let's define a global echo instrument such as :
>>
>>         instr 198 ; GLOBAL ECHO
>>idur = p3
>>itime = p4
>>iloop = p5
>>kenv linen 1, .01, idur, .01
>>acomb comb gacmb, itime, iloop, 0
>>
>>out acomb*kenv
>>gacmb =0
>>         endin
>>
>>
>>This instrument work with the global variable gacmb.
>>
>>
>>
>>Now, let's create various copies of this instrument in the score :
>>
>>;ins            strt    dur     time    loopt
>>i 198   0       6       10      .8
>>i 198   0       6       10      .3
>>i 198   0       6       10      .3
>>
>>
>>
>>
>>What happens when these multiple instances run in parallel ?
>>
>>
>>
>>A possible behavior would be :
>>When the a-rate instruction :
>>         gacmb =0
>>is executed in the first instance of the 
>>instrument, then the global variable gacmb is 
>>set to Zero.
>>
>>Consequently, the other instances of the 
>>instrument would process a Null signal !!
>>
>>MMmhhhhh... Let me guess... This is not the CSound behavior in that case.
>>
>>Possibly, the multiple instances are executed 
>>'in parallel', Opcode per Opcode... But I am 
>>not sure at all !
>>
>>
>>I red carefully the CSound program flow 
>>http://www.csounds.com/internals/index.html but 
>>did not find the answer...
>>
>>
>>I would be grateful if someone could tell me a bit more about :
>>- how CSound behaves in that case
>>- why he behaves so (how it is implemented)
>>
>>
>>Thx much in advance !
>>(and for answers to my past questions)
>>
>>Nicolas
>>
>>
>>PS : as you may have seen, my 'example' is 
>>coming from Dr Boulanger's first chapter of the 
>>CSound Book :
>>http://www.csounds.com/chapter1/index.html
>>
>>Indeed, it corresponds with instrument 137 in this chapter :
>>http://www.csounds.com/chapter1/instruments/01/137/137.html
>>http://www.csounds.com/chapter1/instruments/01/137.sco
>>
>>
>>
>>--
>>-------------------------------------------------------------------
>>Dr Nicolas CASTAGNE
>>
>>ACROE-ICA,
>>46 av. Félix Viallet
>>38 000 Grenoble
>>http://acroe.imag.fr
>>
>>Tel : (33) 4 76 57 46 60
>>-------------------------------------------------------------------
>>--
>>Send bugs reports to this list.
>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
>Victor Lazzarini
>Music Technology Laboratory
>Music Department
>National University of Ireland, Maynooth
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk


-- 
-------------------------------------------------------------------
Dr Nicolas CASTAGNE

ACROE-ICA,
46 av. Félix Viallet
38 000 Grenoble
http://acroe.imag.fr

Tel : (33) 4 76 57 46 60
-------------------------------------------------------------------

Date2005-12-08 10:41
FromVictor Lazzarini
SubjectRe: Global Variables reinitialisation - Yet Another Newb Question !
I don't understand. What happens when you run my example? You
should hear just a single repeating echo every 0.8 s. If you take out
the gacmb=0 line and add it to another higher-number instrument, then
you have your multi-rate echoes. If that is not the case, there might a
bug in your version of csound. If in doubt, change comb for delay and
check for how many echoes you get. There should be only one if
you zero the global variable in the instrument.

That should be the case for any orc/sco of the kind.



Victor

At 10:30 08/12/2005, you wrote:
>Hi Victor,
>
>Thx for your answer, which confirms my analysis !
>
>Indeed, the example is taken from Dr Boulanger's first chapter of the 
>CSound Book.
>
>I may write to him about this, I guess...
>
>Anyhow, there is something a bit strange with Dr Boulanger's example.
>
>When hearing the latest 'notes' of the instrument/score #137, on time=46 
>secondes,
>http://www.csounds.com/chapter1/instruments/01/137/137.html
>http://www.csounds.com/chapter1/instruments/01/137.sco
>
>I hear quite clearly a 'multiple-rate echo' as intended in  the score 
>(through multiple instances of instruments #198)...
>This does not match with what you found !
>
>Should I change my hears ? :)
>Or is there something weard ?
>
>All the best,
>Nicolas
>
>>Just tested your example and I only get a single
>>output, as predicted.
>>
>>instr 3
>>
>>gacmb rand 10000
>>
>>endin
>>
>>  instr 199 ; GLOBAL ECHO
>>idur = p3
>>itime = p4
>>iloop = p5
>>kenv linen 1, .01, idur, .01
>>acomb comb gacmb, itime, iloop, 0
>>
>>
>>out acomb*kenv
>>gacmb =0
>>         endin
>>
>>with
>>
>>i3 0 0.05
>>i 198   0       6       10      .8
>>i 198   0       6       10      .3
>>i 198   0       6       10      .3
>>
>>
>>In fact if  gacmb=0 from instr 198 is removed and
>>
>>instr 200
>>
>>gacmb = 0
>>
>>endin
>>
>>Then all three instances output sound, as predicted,
>>again.
>>
>>Victor
>>
>>At 18:12 07/12/2005, you wrote:
>>>Hi all,
>>>
>>>yet another 'newbee', though precise, question.
>>>
>>>
>>>Let's define a global echo instrument such as :
>>>
>>>         instr 198 ; GLOBAL ECHO
>>>idur = p3
>>>itime = p4
>>>iloop = p5
>>>kenv linen 1, .01, idur, .01
>>>acomb comb gacmb, itime, iloop, 0
>>>
>>>out acomb*kenv
>>>gacmb =0
>>>         endin
>>>
>>>
>>>This instrument work with the global variable gacmb.
>>>
>>>
>>>
>>>Now, let's create various copies of this instrument in the score :
>>>
>>>;ins            strt    dur     time    loopt
>>>i 198   0       6       10      .8
>>>i 198   0       6       10      .3
>>>i 198   0       6       10      .3
>>>
>>>
>>>
>>>
>>>What happens when these multiple instances run in parallel ?
>>>
>>>
>>>
>>>A possible behavior would be :
>>>When the a-rate instruction :
>>>         gacmb =0
>>>is executed in the first instance of the instrument, then the global 
>>>variable gacmb is set to Zero.
>>>
>>>Consequently, the other instances of the instrument would process a Null 
>>>signal !!
>>>
>>>MMmhhhhh... Let me guess... This is not the CSound behavior in that case.
>>>
>>>Possibly, the multiple instances are executed 'in parallel', Opcode per 
>>>Opcode... But I am not sure at all !
>>>
>>>
>>>I red carefully the CSound program flow 
>>>http://www.csounds.com/internals/index.html but did not find the answer...
>>>
>>>
>>>I would be grateful if someone could tell me a bit more about :
>>>- how CSound behaves in that case
>>>- why he behaves so (how it is implemented)
>>>
>>>
>>>Thx much in advance !
>>>(and for answers to my past questions)
>>>
>>>Nicolas
>>>
>>>
>>>PS : as you may have seen, my 'example' is coming from Dr Boulanger's 
>>>first chapter of the CSound Book :
>>>http://www.csounds.com/chapter1/index.html
>>>
>>>Indeed, it corresponds with instrument 137 in this chapter :
>>>http://www.csounds.com/chapter1/instruments/01/137/137.html
>>>http://www.csounds.com/chapter1/instruments/01/137.sco
>>>
>>>
>>>
>>>--
>>>-------------------------------------------------------------------
>>>Dr Nicolas CASTAGNE
>>>
>>>ACROE-ICA,
>>>46 av. Félix Viallet
>>>38 000 Grenoble
>>>http://acroe.imag.fr
>>>
>>>Tel : (33) 4 76 57 46 60
>>>-------------------------------------------------------------------
>>>--
>>>Send bugs reports to this list.
>>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
>>Victor Lazzarini
>>Music Technology Laboratory
>>Music Department
>>National University of Ireland, Maynooth
>>--
>>Send bugs reports to this list.
>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
>
>--
>-------------------------------------------------------------------
>Dr Nicolas CASTAGNE
>
>ACROE-ICA,
>46 av. Félix Viallet
>38 000 Grenoble
>http://acroe.imag.fr
>
>Tel : (33) 4 76 57 46 60
>-------------------------------------------------------------------
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth 

Date2005-12-08 10:57
FromNicolas =?iso-8859-1?Q?Castagn=E9?=
SubjectRe: Global Variables reinitialisation - Yet Another Newb Question !
Hi Victor,

Unfortunately, I have no CSound available this morning...

Let me explain a bit more the **new question**.

I am convinced that your analysis (which 
corresponds to mine) is correct. And quite sure 
runing your example on my CSound (tomorrow...) 
will produce the same result.

And I completely agree with your solution (introducing an instrument #200).

My **new question** relates not to your example, 
but to Pr Boulanger's examples 137/198/199, ch 1 
CSound Book, on the page :
http://www.csounds.com/chapter1/instruments/01/137/137.html
http://www.csounds.com/chapter1/instruments/01/137.sco

Have a look at the latest notes of this score, t=46seconds,
then hear the latest notes of the mp3 sound on 
http://www.csounds.com/chapter1/instruments/01/137/137.html

Well... I myself hear a multiple-rate echo on 
this latest note of Pr Boulanger's example....

Which contradicts your example, and our analysis...
Consequently, I wonder how Pr Boulanger's example can work correctly !


Anyhow, I may write to Pr Boulanger now ;)

Thx much
NC


>I don't understand. What happens when you run my example? You
>should hear just a single repeating echo every 0.8 s. If you take out
>the gacmb=0 line and add it to another higher-number instrument, then
>you have your multi-rate echoes. If that is not the case, there might a
>bug in your version of csound. If in doubt, change comb for delay and
>check for how many echoes you get. There should be only one if
>you zero the global variable in the instrument.
>
>That should be the case for any orc/sco of the kind.
>
>
>
>Victor
>
>At 10:30 08/12/2005, you wrote:
>>Hi Victor,
>>
>>Thx for your answer, which confirms my analysis !
>>
>>Indeed, the example is taken from Dr 
>>Boulanger's first chapter of the CSound Book.
>>
>>I may write to him about this, I guess...
>>
>>Anyhow, there is something a bit strange with Dr Boulanger's example.
>>
>>When hearing the latest 'notes' of the 
>>instrument/score #137, on time=46 secondes,
>>http://www.csounds.com/chapter1/instruments/01/137/137.html
>>http://www.csounds.com/chapter1/instruments/01/137.sco
>>
>>I hear quite clearly a 'multiple-rate echo' as 
>>intended in  the score (through multiple 
>>instances of instruments #198)...
>>This does not match with what you found !
>>
>>Should I change my hears ? :)
>>Or is there something weard ?
>>
>>All the best,
>>Nicolas
>>
>>>Just tested your example and I only get a single
>>>output, as predicted.
>>>
>>>instr 3
>>>
>>>gacmb rand 10000
>>>
>>>endin
>>>
>>>  instr 199 ; GLOBAL ECHO
>>>idur = p3
>>>itime = p4
>>>iloop = p5
>>>kenv linen 1, .01, idur, .01
>>>acomb comb gacmb, itime, iloop, 0
>>>
>>>
>>>out acomb*kenv
>>>gacmb =0
>>>         endin
>>>
>>>with
>>>
>>>i3 0 0.05
>>>i 198   0       6       10      .8
>>>i 198   0       6       10      .3
>>>i 198   0       6       10      .3
>>>
>>>
>>>In fact if  gacmb=0 from instr 198 is removed and
>>>
>>>instr 200
>>>
>>>gacmb = 0
>>>
>>>endin
>>>
>>>Then all three instances output sound, as predicted,
>>>again.
>>>
>>>Victor
>>>
>>>At 18:12 07/12/2005, you wrote:
>>>>Hi all,
>>>>
>>>>yet another 'newbee', though precise, question.
>>>>
>>>>
>>>>Let's define a global echo instrument such as :
>>>>
>>>>         instr 198 ; GLOBAL ECHO
>>>>idur = p3
>>>>itime = p4
>>>>iloop = p5
>>>>kenv linen 1, .01, idur, .01
>>>>acomb comb gacmb, itime, iloop, 0
>>>>
>>>>out acomb*kenv
>>>>gacmb =0
>>>>         endin
>>>>
>>>>
>>>>This instrument work with the global variable gacmb.
>>>>
>>>>
>>>>
>>>>Now, let's create various copies of this instrument in the score :
>>>>
>>>>;ins            strt    dur     time    loopt
>>>>i 198   0       6       10      .8
>>>>i 198   0       6       10      .3
>>>>i 198   0       6       10      .3
>>>>
>>>>
>>>>
>>>>
>>>>What happens when these multiple instances run in parallel ?
>>>>
>>>>
>>>>
>>>>A possible behavior would be :
>>>>When the a-rate instruction :
>>>>         gacmb =0
>>>>is executed in the first instance of the 
>>>>instrument, then the global variable gacmb is 
>>>>set to Zero.
>>>>
>>>>Consequently, the other instances of the 
>>>>instrument would process a Null signal !!
>>>>
>>>>MMmhhhhh... Let me guess... This is not the CSound behavior in that case.
>>>>
>>>>Possibly, the multiple instances are executed 
>>>>'in parallel', Opcode per Opcode... But I am 
>>>>not sure at all !
>>>>
>>>>
>>>>I red carefully the CSound program flow 
>>>>http://www.csounds.com/internals/index.html 
>>>>but did not find the answer...
>>>>
>>>>
>>>>I would be grateful if someone could tell me a bit more about :
>>>>- how CSound behaves in that case
>>>>- why he behaves so (how it is implemented)
>>>>
>>>>
>>>>Thx much in advance !
>>>>(and for answers to my past questions)
>>>>
>>>>Nicolas
>>>>
>>>>
>>>>PS : as you may have seen, my 'example' is 
>>>>coming from Dr Boulanger's first chapter of 
>>>>the CSound Book :
>>>>http://www.csounds.com/chapter1/index.html
>>>>
>>>>Indeed, it corresponds with instrument 137 in this chapter :
>>>>http://www.csounds.com/chapter1/instruments/01/137/137.html
>>>>http://www.csounds.com/chapter1/instruments/01/137.sco
>>>>
>>>>
>>>>
>>>>--
>>>>-------------------------------------------------------------------
>>>>Dr Nicolas CASTAGNE
>>>>
>>>>ACROE-ICA,
>>>>46 av. Félix Viallet
>>>>38 000 Grenoble
>>>>http://acroe.imag.fr
>>>>
>>>>Tel : (33) 4 76 57 46 60
>>>>-------------------------------------------------------------------
>>>>--
>>>>Send bugs reports to this list.
>>>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>>
>>>Victor Lazzarini
>>>Music Technology Laboratory
>>>Music Department
>>>National University of Ireland, Maynooth
>>>--
>>>Send bugs reports to this list.
>>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
>>
>>--
>>-------------------------------------------------------------------
>>Dr Nicolas CASTAGNE
>>
>>ACROE-ICA,
>>46 av. Félix Viallet
>>38 000 Grenoble
>>http://acroe.imag.fr
>>
>>Tel : (33) 4 76 57 46 60
>>-------------------------------------------------------------------
>>--
>>Send bugs reports to this list.
>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
>Victor Lazzarini
>Music Technology Laboratory
>Music Department
>National University of Ireland, Maynooth
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk


-- 
-------------------------------------------------------------------
Dr Nicolas CASTAGNE

ACROE-ICA,
46 av. Félix Viallet
38 000 Grenoble
http://acroe.imag.fr

Tel : (33) 4 76 57 46 60
-------------------------------------------------------------------

Date2005-12-08 11:03
FromVictor Lazzarini
SubjectRe: Global Variables reinitialisation - Yet Another Newb Question !
I'm not too sure, it's difficult to tell, but I think the
repetition goes at a constant rate, but it's hard to tell with
the kind of input being used. The noise burst in my example
demonstrates the way csound is predicted to work, and
works, much more clearly.

Victor

At 10:57 08/12/2005, you wrote:
>Hi Victor,
>
>Unfortunately, I have no CSound available this morning...
>
>Let me explain a bit more the **new question**.
>
>I am convinced that your analysis (which corresponds to mine) is correct. 
>And quite sure runing your example on my CSound (tomorrow...) will produce 
>the same result.
>
>And I completely agree with your solution (introducing an instrument #200).
>
>My **new question** relates not to your example, but to Pr Boulanger's 
>examples 137/198/199, ch 1 CSound Book, on the page :
>http://www.csounds.com/chapter1/instruments/01/137/137.html
>http://www.csounds.com/chapter1/instruments/01/137.sco
>
>Have a look at the latest notes of this score, t=46seconds,
>then hear the latest notes of the mp3 sound on 
>http://www.csounds.com/chapter1/instruments/01/137/137.html
>
>Well... I myself hear a multiple-rate echo on this latest note of Pr 
>Boulanger's example....
>
>Which contradicts your example, and our analysis...
>Consequently, I wonder how Pr Boulanger's example can work correctly !
>
>
>Anyhow, I may write to Pr Boulanger now ;)
>
>Thx much
>NC
>
>
>>I don't understand. What happens when you run my example? You
>>should hear just a single repeating echo every 0.8 s. If you take out
>>the gacmb=0 line and add it to another higher-number instrument, then
>>you have your multi-rate echoes. If that is not the case, there might a
>>bug in your version of csound. If in doubt, change comb for delay and
>>check for how many echoes you get. There should be only one if
>>you zero the global variable in the instrument.
>>
>>That should be the case for any orc/sco of the kind.
>>
>>
>>
>>Victor
>>
>>At 10:30 08/12/2005, you wrote:
>>>Hi Victor,
>>>
>>>Thx for your answer, which confirms my analysis !
>>>
>>>Indeed, the example is taken from Dr Boulanger's first chapter of the 
>>>CSound Book.
>>>
>>>I may write to him about this, I guess...
>>>
>>>Anyhow, there is something a bit strange with Dr Boulanger's example.
>>>
>>>When hearing the latest 'notes' of the instrument/score #137, on time=46 
>>>secondes,
>>>http://www.csounds.com/chapter1/instruments/01/137/137.html
>>>http://www.csounds.com/chapter1/instruments/01/137.sco
>>>
>>>I hear quite clearly a 'multiple-rate echo' as intended in  the score 
>>>(through multiple instances of instruments #198)...
>>>This does not match with what you found !
>>>
>>>Should I change my hears ? :)
>>>Or is there something weard ?
>>>
>>>All the best,
>>>Nicolas
>>>
>>>>Just tested your example and I only get a single
>>>>output, as predicted.
>>>>
>>>>instr 3
>>>>
>>>>gacmb rand 10000
>>>>
>>>>endin
>>>>
>>>>  instr 199 ; GLOBAL ECHO
>>>>idur = p3
>>>>itime = p4
>>>>iloop = p5
>>>>kenv linen 1, .01, idur, .01
>>>>acomb comb gacmb, itime, iloop, 0
>>>>
>>>>
>>>>out acomb*kenv
>>>>gacmb =0
>>>>         endin
>>>>
>>>>with
>>>>
>>>>i3 0 0.05
>>>>i 198   0       6       10      .8
>>>>i 198   0       6       10      .3
>>>>i 198   0       6       10      .3
>>>>
>>>>
>>>>In fact if  gacmb=0 from instr 198 is removed and
>>>>
>>>>instr 200
>>>>
>>>>gacmb = 0
>>>>
>>>>endin
>>>>
>>>>Then all three instances output sound, as predicted,
>>>>again.
>>>>
>>>>Victor
>>>>
>>>>At 18:12 07/12/2005, you wrote:
>>>>>Hi all,
>>>>>
>>>>>yet another 'newbee', though precise, question.
>>>>>
>>>>>
>>>>>Let's define a global echo instrument such as :
>>>>>
>>>>>         instr 198 ; GLOBAL ECHO
>>>>>idur = p3
>>>>>itime = p4
>>>>>iloop = p5
>>>>>kenv linen 1, .01, idur, .01
>>>>>acomb comb gacmb, itime, iloop, 0
>>>>>
>>>>>out acomb*kenv
>>>>>gacmb =0
>>>>>         endin
>>>>>
>>>>>
>>>>>This instrument work with the global variable gacmb.
>>>>>
>>>>>
>>>>>
>>>>>Now, let's create various copies of this instrument in the score :
>>>>>
>>>>>;ins            strt    dur     time    loopt
>>>>>i 198   0       6       10      .8
>>>>>i 198   0       6       10      .3
>>>>>i 198   0       6       10      .3
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>What happens when these multiple instances run in parallel ?
>>>>>
>>>>>
>>>>>
>>>>>A possible behavior would be :
>>>>>When the a-rate instruction :
>>>>>         gacmb =0
>>>>>is executed in the first instance of the instrument, then the global 
>>>>>variable gacmb is set to Zero.
>>>>>
>>>>>Consequently, the other instances of the instrument would process a 
>>>>>Null signal !!
>>>>>
>>>>>MMmhhhhh... Let me guess... This is not the CSound behavior in that case.
>>>>>
>>>>>Possibly, the multiple instances are executed 'in parallel', Opcode 
>>>>>per Opcode... But I am not sure at all !
>>>>>
>>>>>
>>>>>I red carefully the CSound program flow 
>>>>>http://www.csounds.com/internals/index.html but did not find the answer...
>>>>>
>>>>>
>>>>>I would be grateful if someone could tell me a bit more about :
>>>>>- how CSound behaves in that case
>>>>>- why he behaves so (how it is implemented)
>>>>>
>>>>>
>>>>>Thx much in advance !
>>>>>(and for answers to my past questions)
>>>>>
>>>>>Nicolas
>>>>>
>>>>>
>>>>>PS : as you may have seen, my 'example' is coming from Dr Boulanger's 
>>>>>first chapter of the CSound Book :
>>>>>http://www.csounds.com/chapter1/index.html
>>>>>
>>>>>Indeed, it corresponds with instrument 137 in this chapter :
>>>>>http://www.csounds.com/chapter1/instruments/01/137/137.html
>>>>>http://www.csounds.com/chapter1/instruments/01/137.sco
>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>-------------------------------------------------------------------
>>>>>Dr Nicolas CASTAGNE
>>>>>
>>>>>ACROE-ICA,
>>>>>46 av. Félix Viallet
>>>>>38 000 Grenoble
>>>>>http://acroe.imag.fr
>>>>>
>>>>>Tel : (33) 4 76 57 46 60
>>>>>-------------------------------------------------------------------
>>>>>--
>>>>>Send bugs reports to this list.
>>>>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>>>
>>>>Victor Lazzarini
>>>>Music Technology Laboratory
>>>>Music Department
>>>>National University of Ireland, Maynooth
>>>>--
>>>>Send bugs reports to this list.
>>>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>>
>>>
>>>--
>>>-------------------------------------------------------------------
>>>Dr Nicolas CASTAGNE
>>>
>>>ACROE-ICA,
>>>46 av. Félix Viallet
>>>38 000 Grenoble
>>>http://acroe.imag.fr
>>>
>>>Tel : (33) 4 76 57 46 60
>>>-------------------------------------------------------------------
>>>--
>>>Send bugs reports to this list.
>>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>>
>>Victor Lazzarini
>>Music Technology Laboratory
>>Music Department
>>National University of Ireland, Maynooth
>>--
>>Send bugs reports to this list.
>>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk
>
>
>--
>-------------------------------------------------------------------
>Dr Nicolas CASTAGNE
>
>ACROE-ICA,
>46 av. Félix Viallet
>38 000 Grenoble
>http://acroe.imag.fr
>
>Tel : (33) 4 76 57 46 60
>-------------------------------------------------------------------
>--
>Send bugs reports to this list.
>To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth