[Csnd] Controll Global Variables

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Csnd] Controll Global Variables

Marcelo Carneiro
Hi,
I am trying to use global variables to control my instruments  and widgets with a midi external controller. Without the global variables the midi controller works fine. When I try to implement global variables to use those parameters in all instruments (without repeating the code all over again in each instrument), the

error: syntax error, unexpected INTEGER_TOKEN (token "1") from file ...

shows up.

What is happening?


ga init 0

ga1 init 0

gkfreq1 init 0

gkfreq2 init 0

gkband1 init 0

gkband2 init 0

gkdens1 init 0

gktran1 init 0

gkoct1 init 0

gkgband init 0


gkwarp init 0

gksamp init 0

gkampli init 0

gitime init 0

;gaply init 0


;########################################################

instr 150

;kplay ctrl7 1,41,0,1

kmid ctrl7 2,7,100,81920

kmid2 ctrl7 2,8,10,1000


;kply invalue "Stop"

;outvalue "Stop", kply


;########### FILTRO 1 ####################


kfreq1 invalue "freq1"

kband 1 invalue "band2"

outvalue "freq1", kmid

outvalue "band2", kmid2


kmid ctrl7 2,9,100,15000

kmid2 ctrl7 2,10,10,1000


;########### FILTRO 2 ####################


kmid3 ctrl7 2,9,100,15000

kmid4 ctrl7 2,10,10,1000


kfreq2 invalue "freq3"

kband3 invalue "band3"

outvalue "freq3", kmid3

outvalue "band3", kmid4


;########### GRAOS ######################


kdens ctrl7 1,4,10,100

ktran ctrl7 1,5,-2,4

koct ctrl7 1,6,0,10

kbandg ctrl7 1,7,0,10


outvalue "dens", kdens

outvalue "tran", ktran

outvalue "oct", koct

outvalue "bandg", kbandg



kdens1 invalue "dens"

ktran1 invalue "tran"

koct1 invalue "oct"

kbandg1 invalue "bandg"


;############## WARP ###################


kwarp ctrl7 1,11,0,2

ksamp ctrl7 1,13,0.2,3

kampli ctrl7 1,14,0,1.1

itime ctrl7 1,12,0,2



outvalue "warp", kwarp

outvalue "samp", ksamp

outvalue "ampli", kampli

outvalue "time", itime


kwarpin invalue "warp"

ksampin invalue "samp"

kampli1 invalue "ampli"

itime2 invalue "time"



;########### GLOBAL ####################


gkfreq1 = kfreq1

gkfreq2 = kfreq2

gkband1 = kband1

gkband2 = kband3


gkdens1 = kdens1

gktran1 = ktran1

gkoct1 = koct1

gkgband = kbandg1


gkwarp = kwarpin

gksamp = ksampin

gkampli = kampli1

gitime = itime2


endin


instr 1


asig loscil .7,261,1, 261,1,0,131072

afilt butterbp asig, gkfreq1, gkband1

outs afilt, afilt

gkfreq1 = 0

gkband1 = 0

endin



instr 2



isamp = sr/ftlen(3)

a1 phasor isamp*p5

iamp = p4

;kdens ctrl7 1,4,10,100

;ktran ctrl7 1,5,-2,4

;koct ctrl7 1,6,0,10

;kband ctrl7 1,7,0,10

iolaps = 150

ifna = p6

ifnb = 40

itotdur = p3


asig fog iamp,gkdens1,gktran1,a1,gkoct1,gkgband,.01,.5,.002, iolaps, ifna,ifnb,itotdur


afilt butterbp asig, gkfreq2, gkband2



kpan ctrl7 1,10,0,1

outvalue "pan", kpan

kpanv invalue "pan"


kvol1 ctrl7 1,1,0.001,2

outvalue "vol1",kvol1

kvolume1 invalue "vol1"


kvol2 ctrl7 1,2,0.001,2

outvalue "vol2",kvol2

kvolume2 invalue "vol2"

asig=asig*kvolume1

afilt=afilt*kvolume2



outs (afilt)*(1-kpanv), (afilt)*kpanv

ga = asig+afilt

gkfreq2 = 0

gkband2 = 0


gkdens1 = 0

gktran1 = 0

gkoct1 = 0

gkgband = 0


endin


ETC...
--
Marcelo Carneiro
(21) 9382-3621
(21) 3497-0193
Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] Controll Global Variables

joachim-3
hi -

i tried your code and this is the offending line:

kband 1 invalue "band2"

if i remove the space after kband there is no error any more.

so i think it has nothing to do with global variables.

best -
        joachim




On 27/06/17 15:29, Marcelo Carneiro de Lima wrote:

> Hi,
> I am trying to use global variables to control my instruments  and
> widgets with a midi external controller. Without the global variables
> the midi controller works fine. When I try to implement global variables
> to use those parameters in all instruments (without repeating the code
> all over again in each instrument), the
>
> error: syntax error, unexpected INTEGER_TOKEN (token "1") from file ...
>
> shows up.
>
> What is happening?
>
>
> ga init 0
>
> ga1 init 0
>
> gkfreq1 init 0
>
> gkfreq2 init 0
>
> gkband1 init 0
>
> gkband2 init 0
>
> gkdens1 init 0
>
> gktran1 init 0
>
> gkoct1 init 0
>
> gkgband init 0
>
>
> gkwarp init 0
>
> gksamp init 0
>
> gkampli init 0
>
> gitime init 0
>
> ;gaply init 0
>
>
> ;########################################################
>
> instr 150
>
> ;kplay ctrl7 1,41,0,1
>
> kmid ctrl7 2,7,100,81920
>
> kmid2 ctrl7 2,8,10,1000
>
>
> ;kply invalue "Stop"
>
> ;outvalue "Stop", kply
>
>
> ;########### FILTRO 1 ####################
>
>
> kfreq1 invalue "freq1"
>
> kband 1 invalue "band2"
>
> outvalue "freq1", kmid
>
> outvalue "band2", kmid2
>
>
> kmid ctrl7 2,9,100,15000
>
> kmid2 ctrl7 2,10,10,1000
>
>
> ;########### FILTRO 2 ####################
>
>
> kmid3 ctrl7 2,9,100,15000
>
> kmid4 ctrl7 2,10,10,1000
>
>
> kfreq2 invalue "freq3"
>
> kband3 invalue "band3"
>
> outvalue "freq3", kmid3
>
> outvalue "band3", kmid4
>
>
> ;########### GRAOS ######################
>
>
> kdens ctrl7 1,4,10,100
>
> ktran ctrl7 1,5,-2,4
>
> koct ctrl7 1,6,0,10
>
> kbandg ctrl7 1,7,0,10
>
>
> outvalue "dens", kdens
>
> outvalue "tran", ktran
>
> outvalue "oct", koct
>
> outvalue "bandg", kbandg
>
>
>
> kdens1 invalue "dens"
>
> ktran1 invalue "tran"
>
> koct1 invalue "oct"
>
> kbandg1 invalue "bandg"
>
>
> ;############## WARP ###################
>
>
> kwarp ctrl7 1,11,0,2
>
> ksamp ctrl7 1,13,0.2,3
>
> kampli ctrl7 1,14,0,1.1
>
> itime ctrl7 1,12,0,2
>
>
>
> outvalue "warp", kwarp
>
> outvalue "samp", ksamp
>
> outvalue "ampli", kampli
>
> outvalue "time", itime
>
>
> kwarpin invalue "warp"
>
> ksampin invalue "samp"
>
> kampli1 invalue "ampli"
>
> itime2 invalue "time"
>
>
>
> ;########### GLOBAL ####################
>
>
> gkfreq1 = kfreq1
>
> gkfreq2 = kfreq2
>
> gkband1 = kband1
>
> gkband2 = kband3
>
>
> gkdens1 = kdens1
>
> gktran1 = ktran1
>
> gkoct1 = koct1
>
> gkgband = kbandg1
>
>
> gkwarp = kwarpin
>
> gksamp = ksampin
>
> gkampli = kampli1
>
> gitime = itime2
>
>
> endin
>
>
> instr 1
>
>
> asig loscil .7,261,1, 261,1,0,131072
>
> afilt butterbp asig, gkfreq1, gkband1
>
> outs afilt, afilt
>
> gkfreq1 = 0
>
> gkband1 = 0
>
> endin
>
>
>
> instr 2
>
>
>
> isamp = sr/ftlen(3)
>
> a1 phasor isamp*p5
>
> iamp = p4
>
> ;kdens ctrl7 1,4,10,100
>
> ;ktran ctrl7 1,5,-2,4
>
> ;koct ctrl7 1,6,0,10
>
> ;kband ctrl7 1,7,0,10
>
> iolaps = 150
>
> ifna = p6
>
> ifnb = 40
>
> itotdur = p3
>
>
> asig fog iamp,gkdens1,gktran1,a1,gkoct1,gkgband,.01,.5,.002, iolaps,
> ifna,ifnb,itotdur
>
>
> afilt butterbp asig, gkfreq2, gkband2
>
>
>
> kpan ctrl7 1,10,0,1
>
> outvalue "pan", kpan
>
> kpanv invalue "pan"
>
>
> kvol1 ctrl7 1,1,0.001,2
>
> outvalue "vol1",kvol1
>
> kvolume1 invalue "vol1"
>
>
> kvol2 ctrl7 1,2,0.001,2
>
> outvalue "vol2",kvol2
>
> kvolume2 invalue "vol2"
>
> asig=asig*kvolume1
>
> afilt=afilt*kvolume2
>
>
>
> outs (afilt)*(1-kpanv), (afilt)*kpanv
>
> ga = asig+afilt
>
> gkfreq2 = 0
>
> gkband2 = 0
>
>
> gkdens1 = 0
>
> gktran1 = 0
>
> gkoct1 = 0
>
> gkgband = 0
>
>
> endin
>
>
> ETC...
> --
> *Marcelo Carneiro*
> (21) 9382-3621
> (21) 3497-0193
> Skype: Carneiro3729
> http://marceloarcos2.wixsite.com/marcelocarneiro
> Csound mailing list [hidden email]
> <mailto:[hidden email]>
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Csnd] Controll Global Variables

Marcelo Carneiro
Thanks.
bests
Marcelo

2017-06-27 17:06 GMT-03:00 joachim heintz <[hidden email]>:
hi -

i tried your code and this is the offending line:

kband 1 invalue "band2"

if i remove the space after kband there is no error any more.

so i think it has nothing to do with global variables.

best -
        joachim





On 27/06/17 15:29, Marcelo Carneiro de Lima wrote:
Hi,
I am trying to use global variables to control my instruments  and
widgets with a midi external controller. Without the global variables
the midi controller works fine. When I try to implement global variables
to use those parameters in all instruments (without repeating the code
all over again in each instrument), the

error: syntax error, unexpected INTEGER_TOKEN (token "1") from file ...

shows up.

What is happening?


ga init 0

ga1 init 0

gkfreq1 init 0

gkfreq2 init 0

gkband1 init 0

gkband2 init 0

gkdens1 init 0

gktran1 init 0

gkoct1 init 0

gkgband init 0


gkwarp init 0

gksamp init 0

gkampli init 0

gitime init 0

;gaply init 0


;########################################################

instr 150

;kplay ctrl7 1,41,0,1

kmid ctrl7 2,7,100,81920

kmid2 ctrl7 2,8,10,1000


;kply invalue "Stop"

;outvalue "Stop", kply


;########### FILTRO 1 ####################


kfreq1 invalue "freq1"

kband 1 invalue "band2"

outvalue "freq1", kmid

outvalue "band2", kmid2


kmid ctrl7 2,9,100,15000

kmid2 ctrl7 2,10,10,1000


;########### FILTRO 2 ####################


kmid3 ctrl7 2,9,100,15000

kmid4 ctrl7 2,10,10,1000


kfreq2 invalue "freq3"

kband3 invalue "band3"

outvalue "freq3", kmid3

outvalue "band3", kmid4


;########### GRAOS ######################


kdens ctrl7 1,4,10,100

ktran ctrl7 1,5,-2,4

koct ctrl7 1,6,0,10

kbandg ctrl7 1,7,0,10


outvalue "dens", kdens

outvalue "tran", ktran

outvalue "oct", koct

outvalue "bandg", kbandg



kdens1 invalue "dens"

ktran1 invalue "tran"

koct1 invalue "oct"

kbandg1 invalue "bandg"


;############## WARP ###################


kwarp ctrl7 1,11,0,2

ksamp ctrl7 1,13,0.2,3

kampli ctrl7 1,14,0,1.1

itime ctrl7 1,12,0,2



outvalue "warp", kwarp

outvalue "samp", ksamp

outvalue "ampli", kampli

outvalue "time", itime


kwarpin invalue "warp"

ksampin invalue "samp"

kampli1 invalue "ampli"

itime2 invalue "time"



;########### GLOBAL ####################


gkfreq1 = kfreq1

gkfreq2 = kfreq2

gkband1 = kband1

gkband2 = kband3


gkdens1 = kdens1

gktran1 = ktran1

gkoct1 = koct1

gkgband = kbandg1


gkwarp = kwarpin

gksamp = ksampin

gkampli = kampli1

gitime = itime2


endin


instr 1


asig loscil .7,261,1, 261,1,0,131072

afilt butterbp asig, gkfreq1, gkband1

outs afilt, afilt

gkfreq1 = 0

gkband1 = 0

endin



instr 2



isamp = sr/ftlen(3)

a1 phasor isamp*p5

iamp = p4

;kdens ctrl7 1,4,10,100

;ktran ctrl7 1,5,-2,4

;koct ctrl7 1,6,0,10

;kband ctrl7 1,7,0,10

iolaps = 150

ifna = p6

ifnb = 40

itotdur = p3


asig fog iamp,gkdens1,gktran1,a1,gkoct1,gkgband,.01,.5,.002, iolaps,
ifna,ifnb,itotdur


afilt butterbp asig, gkfreq2, gkband2



kpan ctrl7 1,10,0,1

outvalue "pan", kpan

kpanv invalue "pan"


kvol1 ctrl7 1,1,0.001,2

outvalue "vol1",kvol1

kvolume1 invalue "vol1"


kvol2 ctrl7 1,2,0.001,2

outvalue "vol2",kvol2

kvolume2 invalue "vol2"

asig=asig*kvolume1

afilt=afilt*kvolume2



outs (afilt)*(1-kpanv), (afilt)*kpanv

ga = asig+afilt

gkfreq2 = 0

gkband2 = 0


gkdens1 = 0

gktran1 = 0

gkoct1 = 0

gkgband = 0


endin


ETC...
--
*Marcelo Carneiro*
<a href="tel:%2821%29%209382-3621" value="+12193823621" target="_blank">(21) 9382-3621
<a href="tel:%2821%29%203497-0193" value="+12134970193" target="_blank">(21) 3497-0193
Skype: Carneiro3729
http://marceloarcos2.wixsite.com/marcelocarneiro
Csound mailing list [hidden email]
<mailto:[hidden email]>
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
[hidden email]
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



--
Marcelo Carneiro
(21) 9382-3621
(21) 3497-0193
Csound mailing list [hidden email] 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
Loading...