python csound callback

View: New views
7 Messages — Rating Filter:   Alert me  

python csound callback

by francibal :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,
i would send more value from python to csound in real time. I have try callback example from example folder of csound, but i am not able to understand how can i pass more variables. I have also try shapes examples, but my knowledge don't allow me to understand completly the mechanism.
Could someone please tell me if there are other doc that i can study, or, maybe, show me some simple example ?

Thanks to all,

ciao,
fran.

Re: python csound callback

by iain duncan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-10-23 at 13:43 -0700, francibal wrote:
> Hi All,
> i would send more value from python to csound in real time. I have try
> callback example from example folder of csound, but i am not able to
> understand how can i pass more variables. I have also try shapes examples,
> but my knowledge don't allow me to understand completly the mechanism.
> Could someone please tell me if there are other doc that i can study, or,
> maybe, show me some simple example ?
>
> Thanks to all,

You might want to consider using tables as a patch bay and writing to
tables from the api, I found this a lot easier to keep track of myself.
My python part just hooks controllers up to patch points, and writes to
the table, and the instruments read their patch values from the table.
They can even write back if you want to do something like see the
current value from a python gui.

Iain




Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"

Re: Re: python csound callback

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sounds complicated to me. What I suggest is just use the
Csound.SetChannel() method and the chn opcodes.

To retrieve values use Csound.GetChannel(). You can see these used
in shapes.py.

Victor


On 23 Oct 2009, at 21:57, Iain Duncan wrote:

> On Fri, 2009-10-23 at 13:43 -0700, francibal wrote:
>> Hi All,
>> i would send more value from python to csound in real time. I have  
>> try
>> callback example from example folder of csound, but i am not able to
>> understand how can i pass more variables. I have also try shapes  
>> examples,
>> but my knowledge don't allow me to understand completly the  
>> mechanism.
>> Could someone please tell me if there are other doc that i can  
>> study, or,
>> maybe, show me some simple example ?
>>
>> Thanks to all,
>
> You might want to consider using tables as a patch bay and writing to
> tables from the api, I found this a lot easier to keep track of  
> myself.
> My python part just hooks controllers up to patch points, and writes  
> to
> the table, and the instruments read their patch values from the table.
> They can even write back if you want to do something like see the
> current value from a python gui.
>
> Iain
>
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@... with body  
> "unsubscribe csound"



Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"

Re: Re: Re: python csound callback

by iain duncan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-10-23 at 22:13 +0100, Victor Lazzarini wrote:
> Sounds complicated to me. What I suggest is just use the
> Csound.SetChannel() method and the chn opcodes.
>
> To retrieve values use Csound.GetChannel(). You can see these used
> in shapes.py.

You mean the tables method sounded complicated? In practise it turned
out to be really simple because the tables are totally use agnostic
patchbays. Anyone can write to them, anyone can read from them, at any
rate, in any context. All you need to do is make yourself a little chart
of your patchbay, which is exactly what anyone using a hardware patchbay
has to do. YMMV but I found it a very simple way to handle routing, and
bigger than that it's portable across applications. If your gui is
always a grid of controls writing to a grid of points, it's simplicity
to change which patch bay those controls are wired to. And it's easy to
dump or load your tables.

Then again, I think I think those pin based modular synths are pretty
nifty...so maybe I'm just an anachronism there. ;-)

Iain

>
> Victor
>
>
> On 23 Oct 2009, at 21:57, Iain Duncan wrote:
>
> > On Fri, 2009-10-23 at 13:43 -0700, francibal wrote:
> >> Hi All,
> >> i would send more value from python to csound in real time. I have  
> >> try
> >> callback example from example folder of csound, but i am not able to
> >> understand how can i pass more variables. I have also try shapes  
> >> examples,
> >> but my knowledge don't allow me to understand completly the  
> >> mechanism.
> >> Could someone please tell me if there are other doc that i can  
> >> study, or,
> >> maybe, show me some simple example ?
> >>
> >> Thanks to all,
> >
> > You might want to consider using tables as a patch bay and writing to
> > tables from the api, I found this a lot easier to keep track of  
> > myself.
> > My python part just hooks controllers up to patch points, and writes  
> > to
> > the table, and the instruments read their patch values from the table.
> > They can even write back if you want to do something like see the
> > current value from a python gui.
> >
> > Iain
> >
> >
> >
> >
> > Send bugs reports to this list.
> > To unsubscribe, send email sympa@... with body  
> > "unsubscribe csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@... with body "unsubscribe csound"



Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"

Re: python csound callback

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, here's an example using the software bus, which I prefer to
use.


Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"

[csex.py]

from csnd import *

csoundInitialize(None,None,0)

cs = Csound()
res = cs.Compile('csex.csd', '-d')

if not res:
   perf = CsoundPerformanceThread(cs)
   perf.Play()
   perf.InputMessage('i1 0 60')
   curtime = 0.0
   prevtime = 0.0
   for i in range(400,800,1):
     cs.SetChannel('freq',i)
     delta = 0.0
     while(delta < 0.01):
        curtime = cs.GetScoreTime()
        delta = curtime - prevtime
     prevtime = curtime  
   perf.Stop()
   perf.Join()

cs.Cleanup()




Victor


On 23 Oct 2009, at 22:30, Iain Duncan wrote:

> On Fri, 2009-10-23 at 22:13 +0100, Victor Lazzarini wrote:
>> Sounds complicated to me. What I suggest is just use the
>> Csound.SetChannel() method and the chn opcodes.
>>
>> To retrieve values use Csound.GetChannel(). You can see these used
>> in shapes.py.
>
> You mean the tables method sounded complicated? In practise it turned
> out to be really simple because the tables are totally use agnostic
> patchbays. Anyone can write to them, anyone can read from them, at any
> rate, in any context. All you need to do is make yourself a little  
> chart
> of your patchbay, which is exactly what anyone using a hardware  
> patchbay
> has to do. YMMV but I found it a very simple way to handle routing,  
> and
> bigger than that it's portable across applications. If your gui is
> always a grid of controls writing to a grid of points, it's simplicity
> to change which patch bay those controls are wired to. And it's easy  
> to
> dump or load your tables.
>
> Then again, I think I think those pin based modular synths are pretty
> nifty...so maybe I'm just an anachronism there. ;-)
>
> Iain
>
>>
>> Victor
>>
>>
>> On 23 Oct 2009, at 21:57, Iain Duncan wrote:
>>
>>> On Fri, 2009-10-23 at 13:43 -0700, francibal wrote:
>>>> Hi All,
>>>> i would send more value from python to csound in real time. I have
>>>> try
>>>> callback example from example folder of csound, but i am not able  
>>>> to
>>>> understand how can i pass more variables. I have also try shapes
>>>> examples,
>>>> but my knowledge don't allow me to understand completly the
>>>> mechanism.
>>>> Could someone please tell me if there are other doc that i can
>>>> study, or,
>>>> maybe, show me some simple example ?
>>>>
>>>> Thanks to all,
>>>
>>> You might want to consider using tables as a patch bay and writing  
>>> to
>>> tables from the api, I found this a lot easier to keep track of
>>> myself.
>>> My python part just hooks controllers up to patch points, and writes
>>> to
>>> the table, and the instruments read their patch values from the  
>>> table.
>>> They can even write back if you want to do something like see the
>>> current value from a python gui.
>>>
>>> Iain
>>>
>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@... with body
>>> "unsubscribe csound"
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@... with body  
>> "unsubscribe csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@... with body  
> "unsubscribe csound"


csex.csd (284 bytes) Download Attachment

Re: Re: python csound callback

by iain duncan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2009-10-23 at 22:48 +0100, Victor Lazzarini wrote:
> Well, here's an example using the software bus, which I prefer to
> use.

Thanks Victor. How do you save the software bus state to file? from the
host or from csound?

thank
Iain

>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@... with body "unsubscribe csound"
> Victor On 23 Oct 2009, at 22:30, Iain Duncan wrote: > On Fri, 2009-10-23 at 22:13 +0100, Victor Lazzarini wrote: >> Sounds complicated to me. What I suggest is just use the >> Csound.SetChannel() method and the chn opcodes. >> >> To retrieve values use Csound.GetChannel(). You can see these used >> in shapes.py. > > You mean the tables method sounded complicated? In practise it turned > out to be really simple because the tables are totally use agnostic > patchbays. Anyone can write to them, anyone can read from them, at any > rate, in any context. All you need to do is make yourself a little > chart > of your patchbay, which is exactly what anyone using a hardware > patchbay > has to do. YMMV but I found it a very simple way to handle routing, > and > bigger than that it's portable across applications. If your gui is > always a grid of controls writing to a grid of points, it's simplicity > to change which patch bay those controls are wired to. And it's easy > to > dump or load your tables. > > Then again, I think I think those pin based modular synths are pretty > nifty...so maybe I'm just an anachronism there. ;-) > > Iain > >> >> Victor >> >> >> On 23 Oct 2009, at 21:57, Iain Duncan wrote: >> >>> On Fri, 2009-10-23 at 13:43 -0700, francibal wrote: >>>> Hi All, >>>> i would send more value from python to csound in real time. I have >>>> try >>>> callback example from example folder of csound, but i am not able >>>> to >>>> understand how can i pass more variables. I have also try shapes >>>> examples, >>>> but my knowledge don't allow me to understand completly the >>>> mechanism. >>>> Could someone please tell me if there are other doc that i can >>>> study, or, >>>> maybe, show me some simple example ? >>>> >>>> Thanks to all, >>> >>> You might want to consider using tables as a patch bay and writing >>> to >>> tables from the api, I found this a lot easier to keep track of >>> myself. >>> My python part just hooks controllers up to patch points, and writes >>> to >>> the table, and the instruments read their patch values from the >>> table. >>> They can even write back if you want to do something like see the >>> current value from a python gui. >>> >>> Iain >>> >>> >>> >>> >>> Send bugs reports to this list. >>> To unsubscribe, send email sympa@... with body >>> "unsubscribe csound" >> >> >> >> Send bugs reports to this list. >> To unsubscribe, send email sympa@... with body >> "unsubscribe csound" > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@... with body > "unsubscribe csound"



Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"

Re: Re: Re: python csound callback

by Victor Lazzarini :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I suppose you can do either way, but it might be easier to do it host-
side.
On 23 Oct 2009, at 22:58, Iain Duncan wrote:

> On Fri, 2009-10-23 at 22:48 +0100, Victor Lazzarini wrote:
>> Well, here's an example using the software bus, which I prefer to
>> use.
>
> Thanks Victor. How do you save the software bus state to file? from  
> the
> host or from csound?
>
> thank
> Iain
>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@... with body  
>> "unsubscribe csound"
>> Victor On 23 Oct 2009, at 22:30, Iain Duncan wrote: > On Fri,  
>> 2009-10-23 at 22:13 +0100, Victor Lazzarini wrote: >> Sounds  
>> complicated to me. What I suggest is just use the >>  
>> Csound.SetChannel() method and the chn opcodes. >> >> To retrieve  
>> values use Csound.GetChannel(). You can see these used >> in  
>> shapes.py. > > You mean the tables method sounded complicated? In  
>> practise it turned > out to be really simple because the tables are  
>> totally use agnostic > patchbays. Anyone can write to them, anyone  
>> can read from them, at any > rate, in any context. All you need to  
>> do is make yourself a little > chart > of your patchbay, which is  
>> exactly what anyone using a hardware > patchbay > has to do. YMMV  
>> but I found it a very simple way to handle routing, > and > bigger  
>> than that it's portable across applications. If your gui is >  
>> always a grid of controls writing to a grid of points, it's  
>> simplicity > to change which patch bay those controls are wired to.  
>> And it's easy > to > dump or load your tables. > > Then again, I  
>> think I think those pin based modular synths are pretty >  
>> nifty...so maybe I'm just an anachronism there. ;-) > > Iain > >>  
>> >> Victor >> >> >> On 23 Oct 2009, at 21:57, Iain Duncan wrote: >>  
>> >>> On Fri, 2009-10-23 at 13:43 -0700, francibal wrote: >>>> Hi  
>> All, >>>> i would send more value from python to csound in real  
>> time. I have >>>> try >>>> callback example from example folder of  
>> csound, but i am not able >>>> to >>>> understand how can i pass  
>> more variables. I have also try shapes >>>> examples, >>>> but my  
>> knowledge don't allow me to understand completly the >>>>  
>> mechanism. >>>> Could someone please tell me if there are other doc  
>> that i can >>>> study, or, >>>> maybe, show me some simple  
>> example ? >>>> >>>> Thanks to all, >>> >>> You might want to  
>> consider using tables as a patch bay and writing >>> to >>> tables  
>> from the api, I found this a lot easier to keep track of >>>  
>> myself. >>> My python part just hooks controllers up to patch  
>> points, and writes >>> to >>> the table, and the instruments read  
>> their patch values from the >>> table. >>> They can even write back  
>> if you want to do something like see the >>> current value from a  
>> python gui. >>> >>> Iain >>> >>> >>> >>> >>> Send bugs reports to  
>> this list. >>> To unsubscribe, send email sympa@...  
>> with body >>> "unsubscribe csound" >> >> >> >> Send bugs reports to  
>> this list. >> To unsubscribe, send email sympa@...  
>> with body >> "unsubscribe csound" > > > > Send bugs reports to this  
>> list. > To unsubscribe, send email sympa@... with body  
>> > "unsubscribe csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@... with body  
> "unsubscribe csound"



Send bugs reports to this list.
To unsubscribe, send email sympa@... with body "unsubscribe csound"