Csound Csound-dev Csound-tekno Search About

[Cs-dev] Calling Csound API functions from Python 3

Date2012-02-27 13:22
Fromandy fillebrown
Subject[Cs-dev] Calling Csound API functions from Python 3
Hi all,

I'm planning on developing an interactive score viewer using Blender's
game engine and I'm wondering what is the best way to call into the
Csound API from Python 3?  I'm not familiar with Python so any
suggestions are welcome.

Cheers,
~ andy.f

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-27 14:00
FromMichael Gogins
SubjectRe: [Cs-dev] Calling Csound API functions from Python 3
Currently the Csound API gets Python wrappers created by SWIG. These
are for specific versions of Python. If you need Python 3 you will
have to build the Python wrappers for Python 3.

There is, however, another alternative that does not depend on SWIG,
and that is to use Python's ctypes module. This permits Python to call
into C functions in shared libraries and to access structures, members
of structures, pointers, and other C types. You could use ctypes to
access the Csound "C" API declared in csound.h. This would be easy for
some functions and not so easy for other functions. I use ctypes at
work with success.

By the way, I think Blender is great and I think it offers a lot of
potential for integrating with Csound.

If I were doing this integration myself, I would probably use ctypes
as it gives the Python programmer more flexibility. How experienced
are you with Python and C? The ctypes module might be difficult if you
don't have some real experience and understanding of both languages.

On the other hand, I expect that fairly soon, the standard version of
Python for which the regular Csound packages are targeted will become
version 3.

Hope this helps,
Mike

On Mon, Feb 27, 2012 at 8:22 AM, andy fillebrown
 wrote:
> Hi all,
>
> I'm planning on developing an interactive score viewer using Blender's
> game engine and I'm wondering what is the best way to call into the
> Csound API from Python 3?  I'm not familiar with Python so any
> suggestions are welcome.
>
> Cheers,
> ~ andy.f
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-27 15:15
Fromandy fillebrown
SubjectRe: [Cs-dev] Calling Csound API functions from Python 3
Great! Thanks for the ctypes suggestion.  I'm well versed in C, but
I've only used Python for importing my custom xml files into Blender.

I've been a Blender fan for a while and I'm loving the new UI and
Cycles rendering engine.  Great community, too.  I'm still torn
between using Blender or Unity3d for building games, though.  Unity3d
can target a lot more platforms but I'm discovering that it's very
difficult or impossible to call into Csound on most of them, which is
limiting my creativity.  Some of my ideas don't need direct access to
a synth api but the really good ideas do, which is why I'm considering
the Blender game engine.

Cheers,
~ andy.f



On Mon, Feb 27, 2012 at 9:00 AM, Michael Gogins
 wrote:
> Currently the Csound API gets Python wrappers created by SWIG. These
> are for specific versions of Python. If you need Python 3 you will
> have to build the Python wrappers for Python 3.
>
> There is, however, another alternative that does not depend on SWIG,
> and that is to use Python's ctypes module. This permits Python to call
> into C functions in shared libraries and to access structures, members
> of structures, pointers, and other C types. You could use ctypes to
> access the Csound "C" API declared in csound.h. This would be easy for
> some functions and not so easy for other functions. I use ctypes at
> work with success.
>
> By the way, I think Blender is great and I think it offers a lot of
> potential for integrating with Csound.
>
> If I were doing this integration myself, I would probably use ctypes
> as it gives the Python programmer more flexibility. How experienced
> are you with Python and C? The ctypes module might be difficult if you
> don't have some real experience and understanding of both languages.
>
> On the other hand, I expect that fairly soon, the standard version of
> Python for which the regular Csound packages are targeted will become
> version 3.
>
> Hope this helps,
> Mike
>
> On Mon, Feb 27, 2012 at 8:22 AM, andy fillebrown
>  wrote:
>> Hi all,
>>
>> I'm planning on developing an interactive score viewer using Blender's
>> game engine and I'm wondering what is the best way to call into the
>> Csound API from Python 3?  I'm not familiar with Python so any
>> suggestions are welcome.
>>
>> Cheers,
>> ~ andy.f
>>
>> ------------------------------------------------------------------------------
>> Try before you buy = See our experts in action!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-dev2
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> --
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-29 02:02
Fromandy fillebrown
SubjectRe: [Cs-dev] Calling Csound API functions from Python 3
Whelp, I got the Blender types to autocomplete in Eclipse with PyDev
and I'm able to set breakpoints, so it looks like Blender is going to
be the tool of choice.  I'll let you know how the ctypes stuff works
out when I get to it.

Blender + Csound could be really fun!

Cheers,
~ andy.f



On Mon, Feb 27, 2012 at 10:15 AM, andy fillebrown
 wrote:
> Great! Thanks for the ctypes suggestion.  I'm well versed in C, but
> I've only used Python for importing my custom xml files into Blender.
>
> I've been a Blender fan for a while and I'm loving the new UI and
> Cycles rendering engine.  Great community, too.  I'm still torn
> between using Blender or Unity3d for building games, though.  Unity3d
> can target a lot more platforms but I'm discovering that it's very
> difficult or impossible to call into Csound on most of them, which is
> limiting my creativity.  Some of my ideas don't need direct access to
> a synth api but the really good ideas do, which is why I'm considering
> the Blender game engine.
>
> Cheers,
> ~ andy.f
>
>
>
> On Mon, Feb 27, 2012 at 9:00 AM, Michael Gogins
>  wrote:
>> Currently the Csound API gets Python wrappers created by SWIG. These
>> are for specific versions of Python. If you need Python 3 you will
>> have to build the Python wrappers for Python 3.
>>
>> There is, however, another alternative that does not depend on SWIG,
>> and that is to use Python's ctypes module. This permits Python to call
>> into C functions in shared libraries and to access structures, members
>> of structures, pointers, and other C types. You could use ctypes to
>> access the Csound "C" API declared in csound.h. This would be easy for
>> some functions and not so easy for other functions. I use ctypes at
>> work with success.
>>
>> By the way, I think Blender is great and I think it offers a lot of
>> potential for integrating with Csound.
>>
>> If I were doing this integration myself, I would probably use ctypes
>> as it gives the Python programmer more flexibility. How experienced
>> are you with Python and C? The ctypes module might be difficult if you
>> don't have some real experience and understanding of both languages.
>>
>> On the other hand, I expect that fairly soon, the standard version of
>> Python for which the regular Csound packages are targeted will become
>> version 3.
>>
>> Hope this helps,
>> Mike
>>
>> On Mon, Feb 27, 2012 at 8:22 AM, andy fillebrown
>>  wrote:
>>> Hi all,
>>>
>>> I'm planning on developing an interactive score viewer using Blender's
>>> game engine and I'm wondering what is the best way to call into the
>>> Csound API from Python 3?  I'm not familiar with Python so any
>>> suggestions are welcome.
>>>
>>> Cheers,
>>> ~ andy.f
>>>
>>> ------------------------------------------------------------------------------
>>> Try before you buy = See our experts in action!
>>> The most comprehensive online learning library for Microsoft developers
>>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>>> Metro Style Apps, more. Free future releases when you subscribe now!
>>> http://p.sf.net/sfu/learndevnow-dev2
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> Try before you buy = See our experts in action!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-dev2
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net