Re: [Bluemusic-users] Python instrument and global variables in orchestra
Brought to you by:
kunstmusik
From: Steven Y. <ste...@gm...> - 2009-01-20 00:59:37
|
Hi Olivier, So when you say FROM AN INSTRUMENT, are you saying the number of global variables is dynamic depending on the python code? (Because using "global instrument" tab within the instrument editor is a means to create global instrument code that is encapsulated with the instrument and is FROM AN INSTRUMENT, so I need this clarification to understand exactly what you are saying). If you are referring to generating that from the python code, I do not think this is possible, but there may be other ways to accomplish what you are doing than just using global variables. Could you post some code or an example project? If I can see what you are trying to accomplish, I can better try to figure out a solution. Regarding pre blocks, they are explained here: http://www.csounds.com/stevenyi/blue/usermanual/html/commandBlocks.html Thanks! steven On Mon, Jan 19, 2009 at 2:42 PM, obaudouin <oli...@pe...> wrote: > > 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 >> <oli...@pe...> 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 >>> Blu...@li... >>> 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 >> Blu...@li... >> https://lists.sourceforge.net/lists/listinfo/bluemusic-users >> >> > > -- > View this message in context: http://www.nabble.com/Python-instrument-and-global-variables-in-orchestra-tp21546201p21550107.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 > Blu...@li... > https://lists.sourceforge.net/lists/listinfo/bluemusic-users > |