Csound Csound-dev Csound-tekno Search About

[Csnd] global k-variables

Date2013-10-30 17:01
Fromorebronerd
Subject[Csnd] global k-variables
I am trying out global k-variables, and made a simple example, see below. I
expected the k variable "gktest" to add vibrato to my poscil, but it
doesn´t. It works fine if I define it as a local variable. Is there a bug,
or have I misunderstood this?





sr 	= 44100
ksmps 	= 10
nchnls 	= 1
0dbfs  	= 1

gisine		ftgen 0,0,2^12,10,1
gktest		lfo 30,2,0

instr 1
asig poscil 0.3,400+gktest,gisine
out asig
endin



i 1 0 4






--
View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2013-10-30 17:06
FromJustin Smith
SubjectRe: [Csnd] global k-variables
Entries outside an instr block run in instrument 0, which only gets an i time pass when csound starts, and no p-time passes. k signals are generated at p time, so they must be modified inside an instrument (though you can create the global in instr 0 at i time).


On Wed, Oct 30, 2013 at 10:01 AM, orebronerd <martino.flodino@gmail.com> wrote:
I am trying out global k-variables, and made a simple example, see below. I
expected the k variable "gktest" to add vibrato to my poscil, but it
doesn´t. It works fine if I define it as a local variable. Is there a bug,
or have I misunderstood this?

<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr      = 44100
ksmps   = 10
nchnls  = 1
0dbfs   = 1

gisine          ftgen 0,0,2^12,10,1
gktest          lfo 30,2,0

instr 1
asig poscil 0.3,400+gktest,gisine
out asig
endin

</CsInstruments>
<CsScore>
i 1 0 4

</CsScore>
</CsoundSynthesizer>



--
View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug trackers
csound6:
            https://sourceforge.net/p/csound/tickets/
csound5:
            https://sourceforge.net/p/csound/bugs/
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2013-10-30 17:26
Fromorebronerd
Subject[Csnd] Re: global k-variables
I tried to put the gk in another instrument, see below, but it doesn´tt work
either. When I read in the Csound book about global csound instruments, for
example nr 1805 etc page 356, it seems to me that I should be able to define
a gk variable within an instrument and use it in another?





sr 	= 44100
ksmps 	= 10
nchnls 	= 1
0dbfs  	= 1

gisine		ftgen 0,0,2^12,10,1

instr 1
gktest		lfo 30,2,0
endin

instr 2
asig poscil 0.3,400+gktest,gisine
out asig
endin



i 2 0 4






--
View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896p5728898.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2013-10-30 17:33
FromIain McCurdy
SubjectRE: [Csnd] Re: global k-variables
You just need to add a score event for instrument 1:
i 1 0 4

> Date: Wed, 30 Oct 2013 10:26:23 -0700
> From: martino.flodino@gmail.com
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] Re: global k-variables
>
> I tried to put the gk in another instrument, see below, but it doesn´tt work
> either. When I read in the Csound book about global csound instruments, for
> example nr 1805 etc page 356, it seems to me that I should be able to define
> a gk variable within an instrument and use it in another?
>
> <CsoundSynthesizer>
> <CsOptions>
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 10
> nchnls = 1
> 0dbfs = 1
>
> gisine ftgen 0,0,2^12,10,1
>
> instr 1
> gktest lfo 30,2,0
> endin
>
> instr 2
> asig poscil 0.3,400+gktest,gisine
> out asig
> endin
>
> </CsInstruments>
> <CsScore>
> i 2 0 4
>
> </CsScore>
> </CsoundSynthesizer>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896p5728898.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
> https://sourceforge.net/p/csound/tickets/
> csound5:
> https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>

Date2013-10-30 17:40
FromVictor Lazzarini
SubjectRe: [Csnd] Re: global k-variables
yes, but you need to run instr 1, otherwise there is no signal being generated.

Here's the deal

1) outside instruments, in the global space, only i-time code can be run,
and that includes running "init" on global k-rate variables (it is i-time)

2) you can fill global variables inside instruments. By doing so, you are
creating them. But for the signal to be generated, you have to run the instrument

3) you can consume global variables in any instrument, but the variable
needs to exist (ie. have been declared somewhere) beforehand

http://en.flossmanuals.net/csound/b-local-and-global-variables/

On 30 Oct 2013, at 17:26, orebronerd wrote:

> I tried to put the gk in another instrument, see below, but it doesn´tt work
> either. When I read in the Csound book about global csound instruments, for
> example nr 1805 etc page 356, it seems to me that I should be able to define
> a gk variable within an instrument and use it in another?
> 
> 
> 
> 
> 
> sr 	= 44100
> ksmps 	= 10
> nchnls 	= 1
> 0dbfs  	= 1
> 
> gisine		ftgen 0,0,2^12,10,1
> 
> instr 1
> gktest		lfo 30,2,0
> endin
> 
> instr 2
> asig poscil 0.3,400+gktest,gisine
> out asig
> endin
> 
> 
> 
> i 2 0 4
> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896p5728898.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>            https://sourceforge.net/p/csound/tickets/
> csound5:
>            https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Date2013-10-30 17:44
Fromorebronerd
Subject[Csnd] Re: global k-variables
Ok. Embarrassing. Thank you for your help. It works fine now. 



--
View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896p5728901.html
Sent from the Csound - General mailing list archive at Nabble.com.

Date2013-10-30 18:12
FromSteven Yi
SubjectRe: [Csnd] Re: global k-variables
Your example only turns on i2, but not i1, so it is not actively
writing anything.

On Wed, Oct 30, 2013 at 1:44 PM, orebronerd  wrote:
> Ok. Embarrassing. Thank you for your help. It works fine now.
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/global-k-variables-tp5728896p5728901.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug trackers
> csound6:
>             https://sourceforge.net/p/csound/tickets/
> csound5:
>             https://sourceforge.net/p/csound/bugs/
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>