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

Re: Python instrument and global variables in orchestra

by Steven Yi :: Rate this Message:

Reply to Author | View in Thread

Hi Olivier,

I tried to look at the file but it was reported deleted on nabble.

So if I understand correctly, you are using a MIDI controller to
record information that you are using in Csound/blue, and also want to
record that information for later use.

What would be the ideal workflow then?  There is a request by Menno
already to record MIDI controller data and map to automations.  If
implemented and using the API, this should be address both realtime
adjustment as well as recording during performance.  Is this what you
are ultimately looking for?

Thanks!
steven

On Tue, Jan 20, 2009 at 9:24 AM, obaudouin
<olivierbaudouin@...> wrote:

>
> Dear Steven,
>
> Here is my Blue file:
> http://www.nabble.com/file/p21564049/bcf2000-controller.blue
> bcf2000-controller.blue
>
> My purpose is to play Csound into Blue with a MIDI controller (Behringer
> BCF2000). It works fine, but I have to reduce the amount of global variables
> and opcodes (to improve the process) by hand.
>
> I think using the slider32 opcode is a good idea here (slider64 does'nt
> work, I don't know why), better than using zak variables, because it is more
> concise and relevant.
>
> Another problem is that I have to run a MIDI sequencer to record and play
> the MIDI controller. Implementing a track to edit and keep registered
> variables (the output of foutk e.g.) like a MIDI sequencer would be, in this
> case, very usefull. I don't know if Blue can do that actually.
>
> Regards,
>
> Olivier.
>
>
>
> Steven Yi wrote:
>>
>> Hi Olivier,
>>
>> As I mentioned, I do not know if you can do what you ultimately want
>> to achieve musically or not since you have not responded to my request
>> for code or examples. My thought was that you might be able to use a
>> different mechanism than using global variables(I.e. store values in a
>> table to communicate a dynamic number of signals, use zak, possibly
>> use chnget/chnset) , but again I can not help you without more
>> information that I have asked for.
>>
>> As for if I think it would be interesting or not, you could should
>> simply ask to request to implement the it. You should know though that
>> I asked you the above questions so I could determine if there are
>> other ways to do what you want without me having to change code in
>> blue, as it does take up my personal time to do these things and I
>> certainly enjoy whatever free time I can get.
>>
>> Anyways, this could be implemented by making the global instrument
>> area of the python instrument editor have a check box that would allow
>> processing the text as code or not before generating to the global
>> instrument code. This would be the first solution to come to mind,
>> another possibility then would be to change the processing order in
>> the instrument so that one could store global orc code from the instr
>> code  in a globalOrc variable. That if found gets appended to the
>> value in the global instrument tab before generating to the CSD.
>>
>> Anyways, I have to run as I have to to work now on very little sleep
>> for the second day in a row, complete with jet lag. Please review the
>> above and let me know what you think would be better for
>> implementation and we'll see if it can done quickly.
>>
>> Steven
>>
>> On 1/20/09, obaudouin <olivierbaudouin@...> wrote:
>>>
>>> Hi Steven!
>>>
>>> As you, I think there is no solution available for my problem into Csound
>>> or
>>> Blue. However, I can produce separately a csd file with Python and import
>>> it
>>> in Blue...
>>>
>>> Thank you very much for your help,
>>>
>>> Olivier.
>>>
>>> PS: Allowing code generation from a Python instrument into the global and
>>> score instrument tabs is an interesting feature which could be added to
>>> Blue, isn't it?
>>>
>>>
>>> Steven Yi wrote:
>>>>
>>>> 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
>>>> <olivierbaudouin@...> 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
>>>>>> <olivierbaudouin@...> 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@...
>>>>>>> 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@...
>>>>>> 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
>>>>> Bluemusic-users@...
>>>>> 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@...
>>>> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Python-instrument-and-global-variables-in-orchestra-tp21546201p21558413.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@...
>>> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
>>>
>>
>> --
>> Sent from my mobile device
>>
>> ------------------------------------------------------------------------------
>> 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@...
>> https://lists.sourceforge.net/lists/listinfo/bluemusic-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Python-instrument-and-global-variables-in-orchestra-tp21546201p21564049.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@...
> 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@...
https://lists.sourceforge.net/lists/listinfo/bluemusic-users

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