| I have ported the Python opcodes originally written by Maurizio Umberto
Puxeddu to Csound 5, borrowing sources maintained by Gabriel Maldonado in
CsoundAV. Sources, documentation, and examples have been committed to
Csound 5 CVS.
Thanks to Maurizio for inventing these and putting them under LGPL, and
thanks to Gabriel for keeping them alive.
These opcodes are very powerful and enable execution of arbitrary Python
code and access to Python variables from Csound orchestras. The opcodes
work at all rates: initialization, control, and even audio.
Some caveats:
Very little testing has been done to date, and only on Windows.
The documentation mentions another Python wrapper for Csound (not
CsoundVST), which I have not built, although I have added the code to
Csound 5 CVS. It features an interface for function table access that I
plan to add to the Csound API.
Currently, these opcodes only function in CsoundVST, because they require
the Python virtual machine to be initialized, which CsoundVST takes care
of. I may add a pyinit opcode to do this for command-line Csound.
The {{ and }} directives for mutiple-line strings are not currently
implemented in Csound 5. Examples written using these directives will not
run. However, if you write your composition as a Python script in
CsoundVST, you can write classes for your composition in that script and
embed your Csound orchestras and scores in the script using Python triple
quotes ('''). Therefore, the {{ and }} directives are not necessary if you
use CsoundVST in Python mode.
Finally, note that CsoundVST automatically creates a global instance of the
Csound API in Python. If you write orchestra code in Python, you have
access to this instance and can theoretically interact with Csound from
your instruments, and vice versa. Not tested! Could get rather
recursive....
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ . |