Csound Csound-dev Csound-tekno Search About

Python 3 bindings

Date2016-01-29 22:52
FromEugene Cherny
SubjectPython 3 bindings
Hi guys!

I use Python 3 for my projects and would like to use Csound with it.
How hard is to generate SWIG wrapper for this Python version?

Best,
Eugene

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

Date2016-01-30 02:41
FromMichael Gogins
SubjectRe: Python 3 bindings

Use ctypes with the Csound shared library. Then you don't need SWIG.

Regards,
Mike

On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru> wrote:
Hi guys!

I use Python 3 for my projects and would like to use Csound with it.
How hard is to generate SWIG wrapper for this Python version?

Best,
Eugene

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

Date2016-01-30 02:54
FromBrian Redfern
Subjectcsound + kivy?
I'm curious if anyone has used kivy with the csound python api from either python3 or python2? It looks like a pretty sweet framework but if I can't use it with csound I'd rather spend my energy on native android + csound, but python is a lot more fun than java.
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

Date2016-01-30 08:00
FromEugene Cherny
SubjectRe: Python 3 bindings
Hi Micheal,

I tried ctypes and it's not so hard to set up .csd file playing, but I'd 
like to build an app where Csound would run in background in a separate 
thread. I doubt that it could work good with Python's own threads (due 
to GIL), and I found a CsoundPerformanceThread C++ class, which should 
do the work. But afaik, I can only use C code from ctypes and 
CsoundPerformanceThread class doesn't provide extern functions.

So I need to set up Csound's native threading from Python somehow, and I 
don't see an obvious way to do this. Any ideas?

Best,
Eugene


On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
>
> Regards,
> Mike
>
> On Jan 29, 2016 5:53 PM, "Eugene Cherny"  > wrote:
>
>     Hi guys!
>
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
>
>     Best,
>     Eugene
>
>     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

Date2016-01-30 11:44
FromFrancois PINOT
SubjectRe: Python 3 bindings
Hello Eugene,

I'm actually working on a ctypes interface to the Csound API. It can be used from both Python2 and Python3. It defines a python class named Csound  whose methods call the corresponding C functions of the API.

I plan to do the same for CsPerfThread.

I opened a repo on github so that people can see this work in progress: https://github.com/fggp/ctcsound.

If you're interested in participating, I can give you acces to the repo.

Regards

Francois

2016-01-30 9:00 GMT+01:00 Eugene Cherny <iam@oscii.ru>:
Hi Micheal,

I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.

So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?

Best,
Eugene


On 1/30/16 04:41 , Michael Gogins wrote:
Use ctypes with the Csound shared library. Then you don't need SWIG.

Regards,
Mike

On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru
<mailto:iam@oscii.ru>> wrote:

    Hi guys!

    I use Python 3 for my projects and would like to use Csound with it.
    How hard is to generate SWIG wrapper for this Python version?

    Best,
    Eugene

    Csound mailing list
    Csound@listserv.heanet.ie <mailto: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
<mailto: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

Date2016-01-30 12:34
FromVictor Lazzarini
SubjectRe: Python 3 bindings
Looks pretty good. Would you mind contributing these to the project when it’s done? 
========================
Dr 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 30 Jan 2016, at 11:44, Francois PINOT  wrote:
> 
> Hello Eugene,
> 
> I'm actually working on a ctypes interface to the Csound API. It can be used from both Python2 and Python3. It defines a python class named Csound  whose methods call the corresponding C functions of the API.
> 
> I plan to do the same for CsPerfThread.
> 
> I opened a repo on github so that people can see this work in progress: https://github.com/fggp/ctcsound.
> 
> If you're interested in participating, I can give you acces to the repo.
> 
> Regards
> 
> Francois
> 
> 2016-01-30 9:00 GMT+01:00 Eugene Cherny :
> Hi Micheal,
> 
> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
> 
> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
> 
> Best,
> Eugene
> 
> 
> On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
> 
> Regards,
> Mike
> 
> On Jan 29, 2016 5:53 PM, "Eugene Cherny"  > wrote:
> 
>     Hi guys!
> 
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
> 
>     Best,
>     Eugene
> 
>     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

Date2016-01-30 12:49
FromMichael Gogins
SubjectRe: Python 3 bindings

Ok, now I understand more about what you're trying to do.

You can either use SWIG, or you can take the C++ CsoundPerformanceThread  class and write a C wrapper for it with exported functions in a little shared library to call using ctypes. This should not be hard.

Another option is to just switch back and forth from your application to Csound using csoundPerformKsmps. Unless your code is compute intensive or suffers user interface hiccups that could work.

Regards,
Mike

On Jan 30, 2016 3:00 AM, "Eugene Cherny" <iam@oscii.ru> wrote:
Hi Micheal,

I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.

So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?

Best,
Eugene


On 1/30/16 04:41 , Michael Gogins wrote:
Use ctypes with the Csound shared library. Then you don't need SWIG.

Regards,
Mike

On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru
<mailto:iam@oscii.ru>> wrote:

    Hi guys!

    I use Python 3 for my projects and would like to use Csound with it.
    How hard is to generate SWIG wrapper for this Python version?

    Best,
    Eugene

    Csound mailing list
    Csound@listserv.heanet.ie <mailto: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
<mailto: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

Date2016-01-30 13:01
FromFrancois PINOT
SubjectRe: Python 3 bindings
Hello Victor,

of course, when it's done and tested.

2016-01-30 13:34 GMT+01:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
Looks pretty good. Would you mind contributing these to the project when it’s done?
========================
Dr 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 30 Jan 2016, at 11:44, Francois PINOT <fggpinot@gmail.com> wrote:
>
> Hello Eugene,
>
> I'm actually working on a ctypes interface to the Csound API. It can be used from both Python2 and Python3. It defines a python class named Csound  whose methods call the corresponding C functions of the API.
>
> I plan to do the same for CsPerfThread.
>
> I opened a repo on github so that people can see this work in progress: https://github.com/fggp/ctcsound.
>
> If you're interested in participating, I can give you acces to the repo.
>
> Regards
>
> Francois
>
> 2016-01-30 9:00 GMT+01:00 Eugene Cherny <iam@oscii.ru>:
> Hi Micheal,
>
> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
>
> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
>
> Best,
> Eugene
>
>
> On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
>
> Regards,
> Mike
>
> On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru
> <mailto:iam@oscii.ru>> wrote:
>
>     Hi guys!
>
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
>
>     Best,
>     Eugene
>
>     Csound mailing list
>     Csound@listserv.heanet.ie <mailto: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
> <mailto: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

Date2016-01-30 13:21
FromVictor Lazzarini
SubjectRe: Python 3 bindings
You could try to generate the bindings using the same interface file, but targetting python3. Not sure if that can be done, but at least the
interface file might be a starting point. It uses some Python API code, so I guess it might not work out of the box.
========================
Dr 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 30 Jan 2016, at 12:49, Michael Gogins  wrote:
> 
> Ok, now I understand more about what you're trying to do.
> 
> You can either use SWIG, or you can take the C++ CsoundPerformanceThread  class and write a C wrapper for it with exported functions in a little shared library to call using ctypes. This should not be hard.
> 
> Another option is to just switch back and forth from your application to Csound using csoundPerformKsmps. Unless your code is compute intensive or suffers user interface hiccups that could work.
> 
> Regards, 
> Mike
> 
> On Jan 30, 2016 3:00 AM, "Eugene Cherny"  wrote:
> Hi Micheal,
> 
> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
> 
> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
> 
> Best,
> Eugene
> 
> 
> On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
> 
> Regards,
> Mike
> 
> On Jan 29, 2016 5:53 PM, "Eugene Cherny"  > wrote:
> 
>     Hi guys!
> 
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
> 
>     Best,
>     Eugene
> 
>     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

Date2016-01-30 13:32
FromFrancois PINOT
SubjectRe: Python 3 bindings
Well, actually the test file works with both version of Python. I wrote some helper functions as cstring and pstring which take care of the python version. My aim is to have a single interface file that works with python2 and python3 as well.

2016-01-30 14:21 GMT+01:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
You could try to generate the bindings using the same interface file, but targetting python3. Not sure if that can be done, but at least the
interface file might be a starting point. It uses some Python API code, so I guess it might not work out of the box.
========================
Dr 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 30 Jan 2016, at 12:49, Michael Gogins <michael.gogins@gmail.com> wrote:
>
> Ok, now I understand more about what you're trying to do.
>
> You can either use SWIG, or you can take the C++ CsoundPerformanceThread  class and write a C wrapper for it with exported functions in a little shared library to call using ctypes. This should not be hard.
>
> Another option is to just switch back and forth from your application to Csound using csoundPerformKsmps. Unless your code is compute intensive or suffers user interface hiccups that could work.
>
> Regards,
> Mike
>
> On Jan 30, 2016 3:00 AM, "Eugene Cherny" <iam@oscii.ru> wrote:
> Hi Micheal,
>
> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
>
> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
>
> Best,
> Eugene
>
>
> On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
>
> Regards,
> Mike
>
> On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru
> <mailto:iam@oscii.ru>> wrote:
>
>     Hi guys!
>
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
>
>     Best,
>     Eugene
>
>     Csound mailing list
>     Csound@listserv.heanet.ie <mailto: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
> <mailto: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

Date2016-01-30 13:38
FromVictor Lazzarini
SubjectRe: Python 3 bindings
I meant the SWIG interface file.

On 30 Jan 2016, at 13:32, Francois PINOT <fggpinot@GMAIL.COM> wrote:

Well, actually the test file works with both version of Python. I wrote some helper functions as cstring and pstring which take care of the python version. My aim is to have a single interface file that works with python2 and python3 as well.

2016-01-30 14:21 GMT+01:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
You could try to generate the bindings using the same interface file, but targetting python3. Not sure if that can be done, but at least the
interface file might be a starting point. It uses some Python API code, so I guess it might not work out of the box.
========================
Dr 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 30 Jan 2016, at 12:49, Michael Gogins <michael.gogins@gmail.com> wrote:
>
> Ok, now I understand more about what you're trying to do.
>
> You can either use SWIG, or you can take the C++ CsoundPerformanceThread  class and write a C wrapper for it with exported functions in a little shared library to call using ctypes. This should not be hard.
>
> Another option is to just switch back and forth from your application to Csound using csoundPerformKsmps. Unless your code is compute intensive or suffers user interface hiccups that could work.
>
> Regards,
> Mike
>
> On Jan 30, 2016 3:00 AM, "Eugene Cherny" <iam@oscii.ru> wrote:
> Hi Micheal,
>
> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
>
> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
>
> Best,
> Eugene
>
>
> On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
>
> Regards,
> Mike
>
> On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru
> <mailto:iam@oscii.ru>> wrote:
>
>     Hi guys!
>
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
>
>     Best,
>     Eugene
>
>     Csound mailing list
>     Csound@listserv.heanet.ie <mailto: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
> <mailto: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

Date2016-01-30 14:37
FromFrancois PINOT
SubjectRe: Python 3 bindings
One of my goals in doing this work is to get rid of the swig interface. So let's see...

2016-01-30 14:38 GMT+01:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
I meant the SWIG interface file.

On 30 Jan 2016, at 13:32, Francois PINOT <fggpinot@GMAIL.COM> wrote:

Well, actually the test file works with both version of Python. I wrote some helper functions as cstring and pstring which take care of the python version. My aim is to have a single interface file that works with python2 and python3 as well.

2016-01-30 14:21 GMT+01:00 Victor Lazzarini <Victor.Lazzarini@nuim.ie>:
You could try to generate the bindings using the same interface file, but targetting python3. Not sure if that can be done, but at least the
interface file might be a starting point. It uses some Python API code, so I guess it might not work out of the box.
========================
Dr 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 30 Jan 2016, at 12:49, Michael Gogins <michael.gogins@gmail.com> wrote:
>
> Ok, now I understand more about what you're trying to do.
>
> You can either use SWIG, or you can take the C++ CsoundPerformanceThread  class and write a C wrapper for it with exported functions in a little shared library to call using ctypes. This should not be hard.
>
> Another option is to just switch back and forth from your application to Csound using csoundPerformKsmps. Unless your code is compute intensive or suffers user interface hiccups that could work.
>
> Regards,
> Mike
>
> On Jan 30, 2016 3:00 AM, "Eugene Cherny" <iam@oscii.ru> wrote:
> Hi Micheal,
>
> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
>
> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
>
> Best,
> Eugene
>
>
> On 1/30/16 04:41 , Michael Gogins wrote:
> Use ctypes with the Csound shared library. Then you don't need SWIG.
>
> Regards,
> Mike
>
> On Jan 29, 2016 5:53 PM, "Eugene Cherny" <iam@oscii.ru
> <mailto:iam@oscii.ru>> wrote:
>
>     Hi guys!
>
>     I use Python 3 for my projects and would like to use Csound with it.
>     How hard is to generate SWIG wrapper for this Python version?
>
>     Best,
>     Eugene
>
>     Csound mailing list
>     Csound@listserv.heanet.ie <mailto: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
> <mailto: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

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

Date2016-01-30 20:11
FromEugene Cherny
SubjectRe: Python 3 bindings
OK, I'll try something. Thanks you guys!

Eugene

On 1/30/16 15:21 , Victor Lazzarini wrote:
> You could try to generate the bindings using the same interface file, but targetting python3. Not sure if that can be done, but at least the
> interface file might be a starting point. It uses some Python API code, so I guess it might not work out of the box.
> ========================
> Dr 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 30 Jan 2016, at 12:49, Michael Gogins  wrote:
>>
>> Ok, now I understand more about what you're trying to do.
>>
>> You can either use SWIG, or you can take the C++ CsoundPerformanceThread  class and write a C wrapper for it with exported functions in a little shared library to call using ctypes. This should not be hard.
>>
>> Another option is to just switch back and forth from your application to Csound using csoundPerformKsmps. Unless your code is compute intensive or suffers user interface hiccups that could work.
>>
>> Regards,
>> Mike
>>
>> On Jan 30, 2016 3:00 AM, "Eugene Cherny"  wrote:
>> Hi Micheal,
>>
>> I tried ctypes and it's not so hard to set up .csd file playing, but I'd like to build an app where Csound would run in background in a separate thread. I doubt that it could work good with Python's own threads (due to GIL), and I found a CsoundPerformanceThread C++ class, which should do the work. But afaik, I can only use C code from ctypes and CsoundPerformanceThread class doesn't provide extern functions.
>>
>> So I need to set up Csound's native threading from Python somehow, and I don't see an obvious way to do this. Any ideas?
>>
>> Best,
>> Eugene
>>
>>
>> On 1/30/16 04:41 , Michael Gogins wrote:
>> Use ctypes with the Csound shared library. Then you don't need SWIG.
>>
>> Regards,
>> Mike
>>
>> On Jan 29, 2016 5:53 PM, "Eugene Cherny" > > wrote:
>>
>>      Hi guys!
>>
>>      I use Python 3 for my projects and would like to use Csound with it.
>>      How hard is to generate SWIG wrapper for this Python version?
>>
>>      Best,
>>      Eugene
>>
>>      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