Csound Csound-dev Csound-tekno Search About

[Csnd] channelCallback in Python

Date2014-03-30 16:59
Fromzappfinger
Subject[Csnd] channelCallback in Python
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-03-30 20:44
FromRichard van Bemmelen
SubjectRe: [Csnd] channelCallback in Python
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2014-03-30 20:52
FromRory Walsh
SubjectRe: [Csnd] channelCallback in Python

I thinkthey are called GetChannel and SetChannel?

On 30 Mar 2014 20:45, "Richard van Bemmelen" <zappfinger@gmail.com> wrote:
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2014-03-30 21:51
FromRichard van Bemmelen
SubjectRe: [Csnd] channelCallback in Python
Ok thanks, how could I use GetChannel as a callback? Is the cb.py example still valid?


2014-03-30 21:52 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

I thinkthey are called GetChannel and SetChannel?

On 30 Mar 2014 20:45, "Richard van Bemmelen" <zappfinger@gmail.com> wrote:
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






Date2014-03-30 22:07
FromRory Walsh
SubjectRe: [Csnd] channelCallback in Python

No. They do not work with callbacks. But you can access them between k cycles without any problem. At the end of each preformKsmps () you can update accordingly in both directions.

On 30 Mar 2014 21:51, "Richard van Bemmelen" <zappfinger@gmail.com> wrote:
Ok thanks, how could I use GetChannel as a callback? Is the cb.py example still valid?


2014-03-30 21:52 GMT+02:00 Rory Walsh <rorywalsh@ear.ie>:

I thinkthey are called GetChannel and SetChannel?

On 30 Mar 2014 20:45, "Richard van Bemmelen" <zappfinger@gmail.com> wrote:
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






Date2014-03-30 22:09
FromVictor Lazzarini
SubjectRe: [Csnd] channelCallback in Python
cb.py seems to work fine.
========================
Dr Victor Lazzarini
Senior Lecturer
NUI Maynooth, Ireland
victor dot lazzarini at nuim dot ie




On 30 Mar 2014, at 21:51, Richard van Bemmelen  wrote:

> Ok thanks, how could I use GetChannel as a callback? Is the cb.py example still valid?
> 
> 
> 2014-03-30 21:52 GMT+02:00 Rory Walsh :
> I thinkthey are called GetChannel and SetChannel?
> 
> 
> On 30 Mar 2014 20:45, "Richard van Bemmelen"  wrote:
> I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?
> 
> 
> 
> 
> 2014-03-30 17:59 GMT+02:00 zappfinger :
> Has anyone used the channelCallback functions in Python? An example would be
> great....
> 
> Richard
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 
> 
> 



Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2014-03-30 22:23
FromDominic Melville
Subject[Csnd] channelCallback in Python
What exactly are you wanting to respond to and with what? If you've got a code snippet of your python gui I might be able to help as I've used getchannel etc with a python app successfully not too long ago. I remember it taking a while to get working as I wanted it. 

Thanks 
Dominic 

On Sunday, March 30, 2014, Richard van Bemmelen <zappfinger@gmail.com> wrote:
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2014-03-30 23:35
Fromfrancesco
Subject[Csnd] Re: channelCallback in Python
and i think that You could also take a look to
https://github.com/csound/csoundAPI_examples/tree/master/python
if i remember right there are examples of what You are trying to do.

ciao,
francesco.




--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658p5733684.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2014-03-31 21:24
FromRichard van Bemmelen
SubjectRe: [Csnd] channelCallback in Python
Well, I use QML/Pyside to create GUI's like sliders and LEDs or VU meters.
The sliders work fine, but I am struggeling get the LEDs or VU meters to display values coming form Csound via chnset().
(Oh yeah, this runs as a server class and there is a layer of Pyro so that csound could run say on a Raspberry Pi and the GUI runs on another machine, connecting to it via Pyro).

Richard


2014-03-30 23:23 GMT+02:00 Dominic Melville <dcamelville@gmail.com>:
What exactly are you wanting to respond to and with what? If you've got a code snippet of your python gui I might be able to help as I've used getchannel etc with a python app successfully not too long ago. I remember it taking a while to get working as I wanted it. 

Thanks 
Dominic 


On Sunday, March 30, 2014, Richard van Bemmelen <zappfinger@gmail.com> wrote:
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






Date2014-03-31 22:06
FromDominic Melville
SubjectRe: [Csnd] channelCallback in Python
Give me a few days to have the time to find it and I'll send you a bit of code that does VU meter display from Csound output values. That should get you going and show how you could get the other values displays working. 

This was actually running on an RPI originally and ultimately being controlled by a second machine, although in a very convoluted way! 

Feel free to remind me on or off list if I don't get back to you in a few days. 

Cheers 

Dominic 

On Monday, March 31, 2014, Richard van Bemmelen <zappfinger@gmail.com> wrote:
Well, I use QML/Pyside to create GUI's like sliders and LEDs or VU meters.
The sliders work fine, but I am struggeling get the LEDs or VU meters to display values coming form Csound via chnset().
(Oh yeah, this runs as a server class and there is a layer of Pyro so that csound could run say on a Raspberry Pi and the GUI runs on another machine, connecting to it via Pyro).

Richard


2014-03-30 23:23 GMT+02:00 Dominic Melville <dcamelville@gmail.com>:
What exactly are you wanting to respond to and with what? If you've got a code snippet of your python gui I might be able to help as I've used getchannel etc with a python app successfully not too long ago. I remember it taking a while to get working as I wanted it. 

Thanks 
Dominic 


On Sunday, March 30, 2014, Richard van Bemmelen <zappfinger@gmail.com> wrote:
I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?




2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
Has anyone used the channelCallback functions in Python? An example would be
great....

Richard



--
View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"






Date2014-03-31 22:38
FromVictor Lazzarini
SubjectRe: [Csnd] channelCallback in Python
Look at shapes.py. It has a VU meter of sorts.
On 31 Mar 2014, at 21:24, Richard van Bemmelen wrote:

> Well, I use QML/Pyside to create GUI's like sliders and LEDs or VU meters.
> The sliders work fine, but I am struggeling get the LEDs or VU meters to display values coming form Csound via chnset().
> (Oh yeah, this runs as a server class and there is a layer of Pyro so that csound could run say on a Raspberry Pi and the GUI runs on another machine, connecting to it via Pyro).
> 
> Richard
> 
> 
> 2014-03-30 23:23 GMT+02:00 Dominic Melville :
> What exactly are you wanting to respond to and with what? If you've got a code snippet of your python gui I might be able to help as I've used getchannel etc with a python app successfully not too long ago. I remember it taking a while to get working as I wanted it. 
> 
> Thanks 
> Dominic 
> 
> 
> On Sunday, March 30, 2014, Richard van Bemmelen  wrote:
> I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?
> 
> 
> 
> 
> 2014-03-30 17:59 GMT+02:00 zappfinger :
> Has anyone used the channelCallback functions in Python? An example would be
> great....
> 
> Richard
> 
> 
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 
> 
> 
> 
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2014-04-01 20:52
FromRichard van Bemmelen
SubjectRe: [Csnd] channelCallback in Python
Thanks Victor, creating the VU meter with QML will be no problem.
Shapes.py does not use callbacks however, it just calls GetChannel() in a function that is repeated frequently.


I wonder why this little piece of code does not work in my class:

 
def start(self):
self.csound.Start()
self.csPerfThread = CsoundPerformanceThread(self.csound)
self.csPerfThread.SetProcessCallback(self.callback, self.csound)
self.csPerfThread.Play()

def callback(self, csnd):
what = csnd.GetChannel("pulse")
print 'called ' + what

The csd (a metronome) runs, I can hear it, has a piece of code like:

        if (kcount > ktime) then
                event "i", 9, 0, kdur, kgain, kpit, kpan
                event "i", 20, 0, .5, 60
                chnset kcount, "pulse"
                kcount = 0

So I would expect the callback to be called....

Richard


2014-03-31 23:38 GMT+02:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Look at shapes.py. It has a VU meter of sorts.
On 31 Mar 2014, at 21:24, Richard van Bemmelen wrote:

> Well, I use QML/Pyside to create GUI's like sliders and LEDs or VU meters.
> The sliders work fine, but I am struggeling get the LEDs or VU meters to display values coming form Csound via chnset().
> (Oh yeah, this runs as a server class and there is a layer of Pyro so that csound could run say on a Raspberry Pi and the GUI runs on another machine, connecting to it via Pyro).
>
> Richard
>
>
> 2014-03-30 23:23 GMT+02:00 Dominic Melville <dcamelville@gmail.com>:
> What exactly are you wanting to respond to and with what? If you've got a code snippet of your python gui I might be able to help as I've used getchannel etc with a python app successfully not too long ago. I remember it taking a while to get working as I wanted it.
>
> Thanks
> Dominic
>
>
> On Sunday, March 30, 2014, Richard van Bemmelen <zappfinger@gmail.com> wrote:
> I want to be able to respond to chnset values in my Python GUI. Since these can occur asynchronously, callbacks are needed. But I understand the ..channelCallback() functions are meant for invalues/outvalues, which API functions should I use for chnsets?
>
>
>
>
> 2014-03-30 17:59 GMT+02:00 zappfinger <zappfinger@gmail.com>:
> Has anyone used the channelCallback functions in Python? An example would be
> great....
>
> Richard
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/channelCallback-in-Python-tp5733658.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>
>
>

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"