Csound Csound-dev Csound-tekno Search About

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

Date2018-04-11 00:19
FromMeijis
Subject[Csnd] Help with Object Orientated Csound API usage from Python
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 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

Date2018-04-13 04:22
FromSteven Yi
SubjectRe: [Csnd] Help with Object Orientated Csound API usage from Python
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  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 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

Date2018-04-13 15:01
FromMeijis
SubjectRe: [Csnd] Help with Object Orientated Csound API usage from Python
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 <stevenyi@gmail.com> 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 <honoonu@gmail.com> 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 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

Date2018-04-16 02:36
FromMeijis
SubjectRe: [Csnd] Help with Object Orientated Csound API usage from Python
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 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

Date2018-05-04 22:10
FromSteven Yi
SubjectRe: [Csnd] Help with Object Orientated Csound API usage from Python
Hi Syl,

Sorry I missed replying to this earlier.  CSOUND_CONTROL_CHANNEL is to
say you want a k-rate signal value (single float value), and
CSOUND_INPUT_CHANNEL is to say you want to set a value that is going
into Csound.  (Though, the INPUT/OUTPUT stuff was initially done many
years ago, I wonder if it's more complicated or not to differentiate
input and output channels)

steven

On Sun, Apr 15, 2018 at 9:36 PM, Meijis  wrote:
> 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 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