[Csnd] Using the Python bindings / how to call scoreEvent()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Using the Python bindings / how to call scoreEvent()

Torgeir Strand Henriksen
Hi!

I'm trying to call Csound methods from Python, using the Csound VST
bindings. For sending messages, I've used csound.inputMessage() with a
string parameter, but recently I discovered the scoreEvent() method
while looking at the C++ sources. This passes the numbers directly,
which seems a lot more sensible than converting back and forth between
strings and numbers. But how do I actually call this method from python?
I've tried

        csound.scoreEvent("i", [3, 0, 1, -2.2])

which gave me the following error:

  File "CsoundVST.py", line 612, in scoreEvent
    def scoreEvent(*args): return _CsoundVST.CppSound_scoreEvent(*args)
TypeError: Expected a pointer

All the methods seem to be declared with *args as the only parameter, so
does anyone know where I can find instructions on how to call them?

Best regards,
Torgeir

--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Using the Python bindings / how to call scoreEvent()

Michael Gogins
I suspect this method works in C++ but not in Python since SWIG generates a binding to a special pointer wrapper, and not to a list. I also think this could easily be fixed. Could you please enter this as a bug at SourceForge?

What I do myself is use inputMessage with a formatting string... e.g. inputMessage("i %d %f %f %f %f" % (insno, time, dur, key, vel)).

Regards,
Mike


-----Original Message-----
From: Torgeir Strand Henriksen <[hidden email]>
Sent: May 12, 2005 9:25 AM
To: [hidden email]
Subject: [Csnd] Using the Python bindings / how to call scoreEvent()

Hi!

I'm trying to call Csound methods from Python, using the Csound VST
bindings. For sending messages, I've used csound.inputMessage() with a
string parameter, but recently I discovered the scoreEvent() method
while looking at the C++ sources. This passes the numbers directly,
which seems a lot more sensible than converting back and forth between
strings and numbers. But how do I actually call this method from python?
I've tried

        csound.scoreEvent("i", [3, 0, 1, -2.2])

which gave me the following error:

  File "CsoundVST.py", line 612, in scoreEvent
    def scoreEvent(*args): return _CsoundVST.CppSound_scoreEvent(*args)
TypeError: Expected a pointer

All the methods seem to be declared with *args as the only parameter, so
does anyone know where I can find instructions on how to call them?

Best regards,
Torgeir

--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]



--
Send bugs reports to [hidden email]
              (or to http://www.cs.bath.ac.uk/cgi-bin/csound )
To unsubscribe, send email to [hidden email]