Csound Csound-dev Csound-tekno Search About

[Csnd] Python API CsoundPerformanceThread.isRunning

Date2019-02-28 08:49
FromChuckk Hubbard
Subject[Csnd] Python API CsoundPerformanceThread.isRunning
Hi.
I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
Has this method changed? Is it still connected to whether the performance is running?

I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
Thanks.
-Chuckk
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-02-28 09:05
FromVictor Lazzarini
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
I see that isRunning() returns the value of the running member, which is set to 1 when the thread is started. 

It used to be set back to 0 at the end of the thread function, but it looks like François changed it to be
set at 0 after a call to Join() 

7936c85588 (fggp             2016-03-07 16:41:35 +0100 473)     //running = 0;
7936c85588 (fggp             2016-03-07 16:41:35 +0100 717)     running = 0;

Could you confirm it, François?

So you might just be missing a call to Join() somewhere at the end of your processing.

best
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 28 Feb 2019, at 08:49, Chuckk Hubbard  wrote:
> 
> Hi.
> I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
> I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
> Has this method changed? Is it still connected to whether the performance is running?
> 
> I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
> Thanks.
> -Chuckk
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-02-28 09:25
FromFrancois PINOT
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
I think you should use CsoundPerformanceThread.status() instead: https://csound.com/docs/ctcsound/ctcsound-PT.html

François


Le jeu. 28 févr. 2019 à 09:49, Chuckk Hubbard <badmuthahubbard@gmail.com> a écrit :
Hi.
I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
Has this method changed? Is it still connected to whether the performance is running?

I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
Thanks.
-Chuckk
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-02-28 10:02
FromFrancois PINOT
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
You're right. running is a two states flag giving the state of the thread, while status gives more information.

François

Le jeu. 28 févr. 2019 à 10:05, Victor Lazzarini <Victor.Lazzarini@mu.ie> a écrit :
I see that isRunning() returns the value of the running member, which is set to 1 when the thread is started.

It used to be set back to 0 at the end of the thread function, but it looks like François changed it to be
set at 0 after a call to Join()

7936c85588 (fggp             2016-03-07 16:41:35 +0100 473)     //running = 0;
7936c85588 (fggp             2016-03-07 16:41:35 +0100 717)     running = 0;

Could you confirm it, François?

So you might just be missing a call to Join() somewhere at the end of your processing.

best
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 28 Feb 2019, at 08:49, Chuckk Hubbard <badmuthahubbard@gmail.com> wrote:
>
> Hi.
> I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
> I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
> Has this method changed? Is it still connected to whether the performance is running?
>
> I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
> Thanks.
> -Chuckk
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-02-28 10:26
FromVictor Lazzarini
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
yep, I would strongly advise updating your code to use ctcsound in place of csnd6, for three main
reasons:

1. ctcsound is much more featureful and integrates nicely with Numpy.
2. ctcsound is Python version-agnostic, works well in 3.x
3. Once we move to csound 7, which we hope to be soon, csnd6 will be gone and
we will not be maintain a SWIG-based wrapper for Python anymore.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 28 Feb 2019, at 09:25, Francois PINOT  wrote:
> 
> I think you should use CsoundPerformanceThread.status() instead: https://csound.com/docs/ctcsound/ctcsound-PT.html
> 
> François
> 
> 
> Le jeu. 28 févr. 2019 à 09:49, Chuckk Hubbard  a écrit :
> Hi.
> I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
> I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
> Has this method changed? Is it still connected to whether the performance is running?
> 
> I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
> Thanks.
> -Chuckk
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2019-02-28 19:58
FromMichael Gogins
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
I'm the original author of the SWIG wrapper, but I think ctcsound is what people should use now for the reasons given by Victor. 

There's another reason, it should be easier to subclass or extend ctcsound.

However, I seem to recall an issue with versions of numpy. What is that?

Regards, 
Mike

On Thu, Feb 28, 2019, 23:26 Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
yep, I would strongly advise updating your code to use ctcsound in place of csnd6, for three main
reasons:

1. ctcsound is much more featureful and integrates nicely with Numpy.
2. ctcsound is Python version-agnostic, works well in 3.x
3. Once we move to csound 7, which we hope to be soon, csnd6 will be gone and
we will not be maintain a SWIG-based wrapper for Python anymore.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 28 Feb 2019, at 09:25, Francois PINOT <fggpinot@gmail.com> wrote:
>
> I think you should use CsoundPerformanceThread.status() instead: https://csound.com/docs/ctcsound/ctcsound-PT.html
>
> François
>
>
> Le jeu. 28 févr. 2019 à 09:49, Chuckk Hubbard <badmuthahubbard@gmail.com> a écrit :
> Hi.
> I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
> I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
> Has this method changed? Is it still connected to whether the performance is running?
>
> I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
> Thanks.
> -Chuckk
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-02-28 21:34
FromFrancois PINOT
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
It's a problem between Numpy and ctypes that appeared with the version 1.15 of Numpy: https://github.com/numpy/numpy/issues/12421. The problem has been solved in Numpy 1.16 by the addition of a new method to ndpointer, but this new method is not compatible with what I used until version 1.14 of Numpy.

I modified ctcsound (https://github.com/csound/csound/commit/59b4335845d6d1360b8c25c2cf44f5b06ccb27c7) so that it detects the version of Numpy on the user's system. If it is less than 1.15, the old solution is applied; if it is >= 1.16, the new solution is applied; and finally, if it is 1.15.x, sys.exit() is called with a warning message telling to use an older or a newer version of Numpy.

François

Le jeu. 28 févr. 2019 à 20:58, Michael Gogins <michael.gogins@gmail.com> a écrit :
I'm the original author of the SWIG wrapper, but I think ctcsound is what people should use now for the reasons given by Victor. 

There's another reason, it should be easier to subclass or extend ctcsound.

However, I seem to recall an issue with versions of numpy. What is that?

Regards, 
Mike

On Thu, Feb 28, 2019, 23:26 Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
yep, I would strongly advise updating your code to use ctcsound in place of csnd6, for three main
reasons:

1. ctcsound is much more featureful and integrates nicely with Numpy.
2. ctcsound is Python version-agnostic, works well in 3.x
3. Once we move to csound 7, which we hope to be soon, csnd6 will be gone and
we will not be maintain a SWIG-based wrapper for Python anymore.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 28 Feb 2019, at 09:25, Francois PINOT <fggpinot@gmail.com> wrote:
>
> I think you should use CsoundPerformanceThread.status() instead: https://csound.com/docs/ctcsound/ctcsound-PT.html
>
> François
>
>
> Le jeu. 28 févr. 2019 à 09:49, Chuckk Hubbard <badmuthahubbard@gmail.com> a écrit :
> Hi.
> I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
> I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
> Has this method changed? Is it still connected to whether the performance is running?
>
> I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
> Thanks.
> -Chuckk
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2019-02-28 21:55
FromMichael Gogins
SubjectRe: [Csnd] Python API CsoundPerformanceThread.isRunning
Thanks for the info!

Regards, 
Mike

On Fri, Mar 1, 2019, 10:34 Francois PINOT <fggpinot@gmail.com> wrote:
It's a problem between Numpy and ctypes that appeared with the version 1.15 of Numpy: https://github.com/numpy/numpy/issues/12421. The problem has been solved in Numpy 1.16 by the addition of a new method to ndpointer, but this new method is not compatible with what I used until version 1.14 of Numpy.

I modified ctcsound (https://github.com/csound/csound/commit/59b4335845d6d1360b8c25c2cf44f5b06ccb27c7) so that it detects the version of Numpy on the user's system. If it is less than 1.15, the old solution is applied; if it is >= 1.16, the new solution is applied; and finally, if it is 1.15.x, sys.exit() is called with a warning message telling to use an older or a newer version of Numpy.

François

Le jeu. 28 févr. 2019 à 20:58, Michael Gogins <michael.gogins@gmail.com> a écrit :
I'm the original author of the SWIG wrapper, but I think ctcsound is what people should use now for the reasons given by Victor. 

There's another reason, it should be easier to subclass or extend ctcsound.

However, I seem to recall an issue with versions of numpy. What is that?

Regards, 
Mike

On Thu, Feb 28, 2019, 23:26 Victor Lazzarini <Victor.Lazzarini@mu.ie> wrote:
yep, I would strongly advise updating your code to use ctcsound in place of csnd6, for three main
reasons:

1. ctcsound is much more featureful and integrates nicely with Numpy.
2. ctcsound is Python version-agnostic, works well in 3.x
3. Once we move to csound 7, which we hope to be soon, csnd6 will be gone and
we will not be maintain a SWIG-based wrapper for Python anymore.

========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952

> On 28 Feb 2019, at 09:25, Francois PINOT <fggpinot@gmail.com> wrote:
>
> I think you should use CsoundPerformanceThread.status() instead: https://csound.com/docs/ctcsound/ctcsound-PT.html
>
> François
>
>
> Le jeu. 28 févr. 2019 à 09:49, Chuckk Hubbard <badmuthahubbard@gmail.com> a écrit :
> Hi.
> I'm afraid I don't have a code example yet for this. I wrote a pretty complicated program some years ago that relied heavily on the Python version of the API.
> I used the isRunning() method of the CsoundPerformanceThread class to find out when a score was finished. As I recall, it actually returned 0 while running and 1 at the end. Now, with the logic I had, it stops immediately; but reversing the logic [if not self.perf.isRunning() ], it continues endlessly.
> Has this method changed? Is it still connected to whether the performance is running?
>
> I have to search through several places to put together an example. Will do ASAP, but I'd expect someone to know if it was changed.
> Thanks.
> -Chuckk
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
> Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here


Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here