[Csnd] Help with Object Orientated Csound API usage from Python

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

[Csnd] Help with Object Orientated Csound API usage from Python

Meijis
Hiya guys, first off I hope I'm doing this right, am very new to mailing lists.
I was sent from the guys over at r/DSP, I've been working on an assignment for college which was supposed to be a simple Csound project, but because I'm really interested in improving at coding I decided to write mine in python using the Csound API, again at the behest of Reddit, as I wanted to use the Google Speech Recognition API. 
My project is essentially a simple filter, where the parameters are controlled by a command given by the user through a microphone. I got this working, but only for a single pass. I decided I needed the speech recognition to operate on a button press from some form of GUI, and looked into Tkinter, which led me to trying to make my project Object Orientated, which admittedly I'm very new to. So basically, I was hoping one of you might have some form of suggestion on how to improve it, or where I'm going wrong etc, some points that I've been concerned about is, in the constructor I'm starting my Csound file, which means I needed to define a score, despite it defining another score based on a conditional later in the code. So I essentially used a dummy instrument, but I'm a little concerned that the score might not update when I need it to. 
Sorry for the long winded email, feel free to shout at me if Ive done this wrong, and here's my code:
https://github.com/MeijisIrlnd/speech-recognition-filter/blob/master/Speech%20Recognition%20Filter%20-%20Class%20Implementation.py
Thanks!
Syl
Csound mailing list [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Help with Object Orientated Csound API usage from Python

Steven Yi
Hi Syl,

If this is all realtime, you shouldn't need to use any score. You
should be able to compile just the orc and start Csound and Csound
should start in realtime mode and run indefinitely.

Also, have you looked at the csoundAPI_Examples?

https://github.com/csound/csoundAPI_examples/tree/master/python

The examples there were written a while ago but should still be valid
and may give some ideas for both object orientation, UI, and using
CsoundPerformanceThread.

Other than that, I had no idea about the Speech Recognition API: neat!

All best,
steven

On Tue, Apr 10, 2018 at 7:19 PM, Meijis <[hidden email]> wrote:

> Hiya guys, first off I hope I'm doing this right, am very new to mailing
> lists.
> I was sent from the guys over at r/DSP, I've been working on an assignment
> for college which was supposed to be a simple Csound project, but because
> I'm really interested in improving at coding I decided to write mine in
> python using the Csound API, again at the behest of Reddit, as I wanted to
> use the Google Speech Recognition API.
> My project is essentially a simple filter, where the parameters are
> controlled by a command given by the user through a microphone. I got this
> working, but only for a single pass. I decided I needed the speech
> recognition to operate on a button press from some form of GUI, and looked
> into Tkinter, which led me to trying to make my project Object Orientated,
> which admittedly I'm very new to. So basically, I was hoping one of you
> might have some form of suggestion on how to improve it, or where I'm going
> wrong etc, some points that I've been concerned about is, in the constructor
> I'm starting my Csound file, which means I needed to define a score, despite
> it defining another score based on a conditional later in the code. So I
> essentially used a dummy instrument, but I'm a little concerned that the
> score might not update when I need it to.
> Sorry for the long winded email, feel free to shout at me if Ive done this
> wrong, and here's my code:
> https://github.com/MeijisIrlnd/speech-recognition-filter/blob/master/Speech%20Recognition%20Filter%20-%20Class%20Implementation.py
> Thanks!
> Syl
> Csound mailing list [hidden email]
> 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
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Help with Object Orientated Csound API usage from Python

Meijis
I actually didn't think of that, see in Csound its currently layed out where theres a separate instrument for each function of the filter, just to simplify the changet business, but if I was to stream audio from a DAW it'd be way simpler to just use a conditional to switch between the functionality! I did have a look at the examples, they're what got me started on the whole API usage, I have to admit I'm not quite sure about what CsoundPerformanceThread does though!
The conditional would also alleviate the problem I've been struggling with of when to start the CsoundPerform() method, thank you so much for your response!
Syl
On Fri, Apr 13, 2018 at 4:22 AM, Steven Yi <[hidden email]> wrote:
Hi Syl,

If this is all realtime, you shouldn't need to use any score. You
should be able to compile just the orc and start Csound and Csound
should start in realtime mode and run indefinitely.

Also, have you looked at the csoundAPI_Examples?

https://github.com/csound/csoundAPI_examples/tree/master/python

The examples there were written a while ago but should still be valid
and may give some ideas for both object orientation, UI, and using
CsoundPerformanceThread.

Other than that, I had no idea about the Speech Recognition API: neat!

All best,
steven

On Tue, Apr 10, 2018 at 7:19 PM, Meijis <[hidden email]> wrote:
> Hiya guys, first off I hope I'm doing this right, am very new to mailing
> lists.
> I was sent from the guys over at r/DSP, I've been working on an assignment
> for college which was supposed to be a simple Csound project, but because
> I'm really interested in improving at coding I decided to write mine in
> python using the Csound API, again at the behest of Reddit, as I wanted to
> use the Google Speech Recognition API.
> My project is essentially a simple filter, where the parameters are
> controlled by a command given by the user through a microphone. I got this
> working, but only for a single pass. I decided I needed the speech
> recognition to operate on a button press from some form of GUI, and looked
> into Tkinter, which led me to trying to make my project Object Orientated,
> which admittedly I'm very new to. So basically, I was hoping one of you
> might have some form of suggestion on how to improve it, or where I'm going
> wrong etc, some points that I've been concerned about is, in the constructor
> I'm starting my Csound file, which means I needed to define a score, despite
> it defining another score based on a conditional later in the code. So I
> essentially used a dummy instrument, but I'm a little concerned that the
> score might not update when I need it to.
> Sorry for the long winded email, feel free to shout at me if Ive done this
> wrong, and here's my code:
> https://github.com/MeijisIrlnd/speech-recognition-filter/blob/master/Speech%20Recognition%20Filter%20-%20Class%20Implementation.py
> Thanks!
> Syl
> Csound mailing list [hidden email]
> 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
[hidden email]
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 [hidden email] 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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Help with Object Orientated Csound API usage from Python

Meijis
Hiya again, been working through the examples to try and get a better grasp of Tkinter integration in programs, and I couldn't seem to find much documentation for the CSOUND_CONTROL_CHANNEL | CSOUND_INPUT_CHANNEL usage, would you be able to give me a brief summary when you get a second? Sorry it's probably a v basic question!
Cheers,
Syl
Csound mailing list [hidden email] 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