« Return to Thread: Python instrument and global variables in orchestra

Re: Python instrument and global variables in orchestra

by obaudouin :: Rate this Message:

Reply to Author | View in Thread

I'm looking for a way to add lines (a lot of MIDI controllers automatically generated) in the global part of the orchestra FROM AN INSTRUMENT, to avoid a copy by hand:

1. gk_var init 0 into an instrument does'nt work (of course)
2. I have never heard of a Csound opcode able to do that (?)
3. and my question is...: a Python instrument could do that in Blue?

What is this the ";[pre] {" block ? How do you deal with that ?

---------



Steven Yi wrote:
Hi Olivier,

Have you tried using the "global instrument" tab in the python
instrument editor? That code should be copied to the global area when
generating a CSD.  So you should be able to use:

gk_<INSTR_ID>_myvar init 0

and in your code, use

gk_<INSTR_ID>_myvar

and doing so will make sure that the variable names are unique per
instrument, regardless of if you make multiple copies of that
instrument.  There should also be no issues with order of
initialization, as that code should be generated at the top of the CSD
before and instrument definitions.  (If you do need to ensure that
code is generated at very very top of global area, you can use a
";[pre] {" block.)

Let me know if that is what you are talking about, otherwise could you
post an example .blue file that illustrates the problem?

Thanks!
steven
On Mon, Jan 19, 2009 at 11:17 AM, obaudouin
<olivierbaudouin@perso.altitudetelecom.fr> wrote:
>
> Hi!
>
> I need that a Python instrument initializes global variables in the global
> orchestra. Currently, I copy by hand the "gkxxx init 0..." lines produced
> with the python instrument into the global orchestra before removing them
> from the instrument, and it is not very elegant!
>
> Thanks a lot for Blue,
>
> Olivier.
> --
> View this message in context: http://www.nabble.com/Python-instrument-and-global-variables-in-orchestra-tp21546201p21546201.html
> Sent from the Csound - Blue - User mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Bluemusic-users mailing list
> Bluemusic-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Bluemusic-users mailing list
Bluemusic-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluemusic-users

 « Return to Thread: Python instrument and global variables in orchestra