Csound Csound-dev Csound-tekno Search About

[Csnd] local and global variables

Date2021-02-19 17:16
FromStefan Thomas
Subject[Csnd] local and global variables
Dear community,
I've studied the code of the "random-walk" of joachim that I've found on https://flossmanual.csound.com/basics/random
I would like to know if the global variables giLowestPitch,giHighestPitch,giStartPitch,gkPitchDev and gkPitchDir in EXAMPLE 01D09_random_walk.csd could
also be local variables?
Thanks for Your help,
Stefan


Csound mailing list Csound@listserv.heanet.ie 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

Date2021-02-19 18:03
FromDave Seidel
SubjectRe: [Csnd] local and global variables
Variables starting with "g" are always global in scope.

On Fri, Feb 19, 2021 at 12:17 PM Stefan Thomas <kontrapunktstefan@gmail.com> wrote:
Dear community,
I've studied the code of the "random-walk" of joachim that I've found on https://flossmanual.csound.com/basics/random
I would like to know if the global variables giLowestPitch,giHighestPitch,giStartPitch,gkPitchDev and gkPitchDir in EXAMPLE 01D09_random_walk.csd could
also be local variables?
Thanks for Your help,
Stefan


Csound mailing list Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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

Date2021-02-19 20:20
Fromjoachim heintz
SubjectRe: [Csnd] local and global variables
hi stefan -

after a quick look at the code, i see two reasons for making the 
variables global:
1. better overview
2. they are used in both instruments (see line 93)

but for sure the varibles could be made local, if you prefer. you need 
to send the lowest and highest pitch as p-fields to instr play then.

best -
	joachim


On 19/02/2021 18:16, Stefan Thomas wrote:
> Dear community,
> I've studied the code of the "random-walk" of joachim that I've found on 
> https://flossmanual.csound.com/basics/random
> I would like to know if the global variables 
> giLowestPitch,giHighestPitch,giStartPitch,gkPitchDev and gkPitchDir in 
> EXAMPLE 01D09_random_walk.csd could
> also be local variables?
> Thanks for Your help,
> Stefan
> 
> *//*
> 
> 
> Csound mailing list Csound@listserv.heanet.ie 
>  
> 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
Csound@listserv.heanet.ie
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

Date2021-02-21 15:54
FromStefan Thomas
SubjectRe: [Csnd] local and global variables
Dear Joachim,
thanks for the answer.
No I do understand it much better!
Stefan

Am Fr., 19. Feb. 2021 um 21:21 Uhr schrieb joachim heintz <jh@joachimheintz.de>:
hi stefan -

after a quick look at the code, i see two reasons for making the
variables global:
1. better overview
2. they are used in both instruments (see line 93)

but for sure the varibles could be made local, if you prefer. you need
to send the lowest and highest pitch as p-fields to instr play then.

best -
        joachim


On 19/02/2021 18:16, Stefan Thomas wrote:
> Dear community,
> I've studied the code of the "random-walk" of joachim that I've found on
> https://flossmanual.csound.com/basics/random
> I would like to know if the global variables
> giLowestPitch,giHighestPitch,giStartPitch,gkPitchDev and gkPitchDir in
> EXAMPLE 01D09_random_walk.csd could
> also be local variables?
> Thanks for Your help,
> Stefan
>
> *//*
>
>
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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