Csound Csound-dev Csound-tekno Search About

[Csnd] CsoundApi Feedback

Date2020-04-14 12:58
Fromfauveboy
Subject[Csnd] CsoundApi Feedback
livelooper1.c
  

I've uploaded a .c file, I'm aiming to playback an audio file and I'm trying
to adjust the amp of the playback by entering text into a while loop that
"waits" for user input. 

The file ive attached doesnt yet achieve this. I was hoping someone wouldn't
mind taking a look and filling any gaps in my knowledge that i haven't yet
applied to have this work as intended :)

many thanks,

J



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-14 13:31
FromJohn ff
SubjectRe: [Csnd] CsoundApi Feedback
Does not the amp channel expect a number, float or double depending on your csound- build but you send a character?

⁣Sent from TypeApp ​

On Apr 14, 2020, 12:59, at 12:59, fauveboy  wrote:
>livelooper1.c
>  
>
>I've uploaded a .c file, I'm aiming to playback an audio file and I'm
>trying
>to adjust the amp of the playback by entering text into a while loop
>that
>"waits" for user input. 
>
>The file ive attached doesnt yet achieve this. I was hoping someone
>wouldn't
>mind taking a look and filling any gaps in my knowledge that i haven't
>yet
>applied to have this work as intended :)
>
>many thanks,
>
>J
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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

Date2020-04-14 13:48
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
I believe it needs a float. In that case I could use atof() function to
convert char to float. However if amp_channel= 1; (like in my file
attachment here, no sound is yet audible livelooper1.txt
   ...?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-14 20:11
Fromjohn
SubjectRe: [Csnd] CsoundApi Feedback
>No real ideas.  What is in your audio.wav file?  \

On Tue, 14 Apr 2020, fauveboy wrote:

> I believe it needs a float. In that case I could use atof() function to
> convert char to float. However if amp_channel= 1; (like in my file
> attachment here, no sound is yet audible livelooper1.txt
>    ...?
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> 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

Date2020-04-14 20:54
Fromjohn
SubjectRe: [Csnd] CsoundApi Feedback
Removing the PI and running as a straight csd I get

INIT ERROR in instr 1 (opcode tablekt.a) line 26: tablekt: index type 
inconsistent with output
  from file live.csd (1)
asig    tablekt.a       kindex  1       0       0       1
           B  0.000 - note deleted.  i1 had 1 init errors


Line 26 is

asig tablekt kindex, 1, 0, 0, 1

Over to you....

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

Date2020-04-15 11:53
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
livelooper1.c
  

Heres the latest program with the corrections to the tableikt name and args. 
This will playback to audio as expected.

The new issue I need help with, is to learn an appropriate method to get
data from the user while the file is playing back?

If you look at the file I have a while loop on line 65. I have commented out
the scanf() function. This is because the while loop pauses at scanf which
in turn stops to flow of audio. How can this be done without stopping the
audio output?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 13:45
FromJohn ff
SubjectRe: [Csnd] CsoundApi Feedback
Not at a computer yet but scanf will block until it gets a new line or such.  So either put the scanf in a separate thread or use select ( I think that is the name) to check to see if there is input waiting.  Really a C issue rather than csound.

⁣Sent from TypeApp ​

On Apr 15, 2020, 11:54, at 11:54, fauveboy  wrote:
>livelooper1.c
>  
>
>Heres the latest program with the corrections to the tableikt name and
>args. 
>This will playback to audio as expected.
>
>The new issue I need help with, is to learn an appropriate method to
>get
>data from the user while the file is playing back?
>
>If you look at the file I have a while loop on line 65. I have
>commented out
>the scanf() function. This is because the while loop pauses at scanf
>which
>in turn stops to flow of audio. How can this be done without stopping
>the
>audio output?
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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

Date2020-04-15 15:05
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
It looks like the csound thread options are a good potential solution?

This is the only example I've that begins to implement this:
https://github.com/csound/csoundAPI_examples/blob/master/c/example4.c

livelooper1.c
   I've
added the csoundCreateThreat() function to my program however, its not yet
clear to me what can be done next with this? A separate while loop with
scanf() inside maybe?...




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 15:31
FromRory Walsh
SubjectRe: [Csnd] CsoundApi Feedback
AttachmentsliveCoder.hpp  liveCoder.cpp  
The easiest way to do this would be to use the CsoundPerformanceThread class, but it would mean switching to C++. If you wish to stick with C, I found some old code I posted to the list many years ago that shows an example of a live coding interface. Although it's technically C++, it does show how to use the csoundCreateThread function in 'C'. 

Note it's old code, I would do things a little different now, but it might give you some direction all the same. 

On Wed, 15 Apr 2020 at 15:05, fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
It looks like the csound thread options are a good potential solution?

This is the only example I've that begins to implement this:
https://github.com/csound/csoundAPI_examples/blob/master/c/example4.c

livelooper1.c
<http://csound.1045644.n5.nabble.com/file/t339654/livelooper1.c>   I've
added the csoundCreateThreat() function to my program however, its not yet
clear to me what can be done next with this? A separate while loop with
scanf() inside maybe?...




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 16:27
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Ill using c++ instead. Im folloing the examples here:
https://github.com/csound/csoundAPI_examples/blob/master/cpp/csPerfThreadExample.cpp.
Heres the latest update to my file  livelooper1.cpp
  . This
is the output http://ix.io/2iak. 

There isnt a discription as to where csPerThread.hpp is.

I have taken a look at your examples @rorywalsh so thanks for those. I think
just need to go over a simpler example before hand




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 16:34
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
actually heres an issue on a more basic step than my previous post here:

Heres my first attempt to use c++ with csoundapi  csoundapicplusplus.cpp
  

However heres the issue: http://ix.io/2ian



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 16:45
FromRory Walsh
SubjectRe: [Csnd] CsoundApi Feedback
It looks like you're not linking correctly to the Csound library?

On Wed, 15 Apr 2020 at 16:34, fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
actually heres an issue on a more basic step than my previous post here:

Heres my first attempt to use c++ with csoundapi  csoundapicplusplus.cpp
<http://csound.1045644.n5.nabble.com/file/t339654/csoundapicplusplus.cpp

However heres the issue: http://ix.io/2ian



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 16:59
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
i was using these paths for my program when it was just c code: g++
-Iusr/local/include/csound -L/usr/local/lib> -lcsound64 livelooper.c. is
there anything wrong with this command which could be a solution?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 18:29
FromRory Walsh
SubjectRe: [Csnd] CsoundApi Feedback
What's the > after lib for? 

On Wed 15 Apr 2020, 16:59 fauveboy, <joel.ramsbottom@hotmail.co.uk> wrote:
i was using these paths for my program when it was just c code: g++
-Iusr/local/include/csound -L/usr/local/lib> -lcsound64 livelooper.c. is
there anything wrong with this command which could be a solution?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 19:38
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
just a type I didn't use the ">" in the command



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-15 19:54
FromRory Walsh
SubjectRe: [Csnd] CsoundApi Feedback
Your example compiles just fine for me. And I can't see anything wrong with your command line arguments. The compiler errors show that it is not finding the Csound library. I'm not really sure how else to assist here. Do an
ls /usr/local/lib
and make sure that libcsound64.so is there..

FWIW, here is the command line in full I used to compile your example. Maybe I'm missing some difference between yours and it:

g++ fauveboyTest.cpp -I /usr/local/include/csound -L /usr/local/lib -lcsound64 -o test





On Wed, 15 Apr 2020 at 19:38, fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
just a type I didn't use the ">" in the command



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-16 11:14
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Using the command that compiled for you I only get an error stating the
following: http://ix.io/2iak

I was wondering if csPerfThread.hpp i just a file I need to download from
somewhere and have in the same directory? 

there doesn't appear to be anything in usr/local/lib for me actually, is
that an issue? :S.....


separate idea. As an alternative to using the csoundapi. perhaps changing
values via OSC  in a simple c program could work instead? 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-16 12:52
FromJohn ff
SubjectRe: [Csnd] CsoundApi Feedback
How about using a thread in the C program that does the read/scanf and sets a flag when it reads a value that the perf loop can sense and write to the channel?  That does not need anything fancy for interlocks or C++ or difficult stuff.

⁣Sent from TypeApp ​

On Apr 16, 2020, 11:15, at 11:15, fauveboy  wrote:
>Using the command that compiled for you I only get an error stating the
>following: http://ix.io/2iak
>
>I was wondering if csPerfThread.hpp i just a file I need to download
>from
>somewhere and have in the same directory? 
>
>there doesn't appear to be anything in usr/local/lib for me actually,
>is
>that an issue? :S.....
>
>
>separate idea. As an alternative to using the csoundapi. perhaps
>changing
>values via OSC  in a simple c program could work instead? 
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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

Date2020-04-16 13:05
FromMichael Gogins
SubjectRe: [Csnd] CsoundApi Feedback
Attachmentscsound_threaded.cpp  
There is csound_threaded.hpp in the Csound include directory. This is a header file only library, you don't need to compile any extra .c or .cpp files. The attached program demonstrates its use. It is more complete and easier to use than csPerfThread.cpp. This file implements the exact same API as csound.hpp but with the addition of running in a separate thread.

Regards,
Mike





-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Thu, Apr 16, 2020 at 7:52 AM John ff <jpff@codemist.co.uk> wrote:
How about using a thread in the C program that does the read/scanf and sets a flag when it reads a value that the perf loop can sense and write to the channel?  That does not need anything fancy for interlocks or C++ or difficult stuff.

⁣Sent from TypeApp ​

On Apr 16, 2020, 11:15, at 11:15, fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
>Using the command that compiled for you I only get an error stating the
>following: http://ix.io/2iak
>
>I was wondering if csPerfThread.hpp i just a file I need to download
>from
>somewhere and have in the same directory?
>
>there doesn't appear to be anything in usr/local/lib for me actually,
>is
>that an issue? :S.....
>
>
>separate idea. As an alternative to using the csoundapi. perhaps
>changing
>values via OSC  in a simple c program could work instead?
>
>
>
>--
>Sent from:
>http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
>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

Date2020-04-18 11:18
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Thats sounds like a good idea @jpff. Im still learning what that c program
would look like to be able to do that, are you able to share an example?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-18 12:37
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
I'm currently investigating this error @Michael Gogins-2 output3.txt
   after
running. g++ csound_threaded.cpp -I /usr.local/include/csound -L
/usr/local/lib -lcsound64 -o test



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-18 12:48
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
oops, sorry it has compiled with this line, which is in the comments: g++
--std=c++11 -Wno-write-strings -O2 -g csound_threaded.cpp -o csound_threaded
-lcsound64 -lpthread -lm



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-18 13:02
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Okay, so the csound_threaded.cpp runs successfully ( plays out some nice
sounds btw). 

How does this support the goal of interacting krate values in the orc here 
via a scanf() in a while loop ( for example).

On line 256 its says: int thread = csound.Perform()

Shall i simple do a line before or after looking something like: int thread2
= ????

Hope I've got accross my problem there :) 



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-18 14:07
FromMichael Gogins
SubjectRe: [Csnd] CsoundApi Feedback
Simply get line input from stdin before you join the Csound thread, and use the Csound API to feed the stuff to Csound. I will post a working example shortly. But basically it would look pretty much like this:

    int thread = csound.Perform();
    std::cout << "Performing in thread 0x" << std::hex << thread << "..." << std::endl;
    while (csound.IsPlaying() == true) {
        std::string user_input;
        std::getline(std::cin, user_input);
        csound.EvalCode(user_input.c_str());
    };
    csound.Join();
    std::cout << "Finished." << std::endl;

Here the user input can be any valid Csound orchestra code and will be evaluated once at init time, so you could set global variables, send values to channels, schedule events, and so on.

After the csound.Perform() call, Csound is running in a separate thread of execution. The main program continues at the same time, and would exit, except that the csound.Join() call makes the main thread wait for the Csound thread to finish. Before Join is called, the main thread can do anything it likes at the same time Csound is running. I _think_ the EvalCode function is thread-safe, we will see. If not, there are other calls that I know are thread-safe.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Sat, Apr 18, 2020 at 8:02 AM fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
Okay, so the csound_threaded.cpp runs successfully ( plays out some nice
sounds btw).

How does this support the goal of interacting krate values in the orc here
via a scanf() in a while loop ( for example).

On line 256 its says: int thread = csound.Perform()

Shall i simple do a line before or after looking something like: int thread2
= ????

Hope I've got accross my problem there :)



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-19 11:36
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
I think a working example would help a lot, when you get a moment, thanks.  
csound_threaded.cpp
  
I've tried to implement what you've suggested in my latest version of
csound_threaded.cpp.  

Does this start a thread where csound can sends samples to the output. And
the while loop is now in a separate thread? So it doesnt stop csound from
play audio when getline() is waiting for user input?

orc syntax seems like quite alot to type in while its playing? I think im
wrong there. But for its not clear to me yet what the user enters? 







--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-19 19:58
FromMichael Gogins
SubjectRe: [Csnd] CsoundApi Feedback
Attachmentscsound_threaded.cpp  
Yes, it starts a thread where Csound keeps sending audio to the output whatever the user is doing.

Have you seen this? https://live.csound.com/ It is a live coding environment online. It is similar to my example except that the online code editor sends code you have selected to csoundCompileOrc (not csoundEvalCode, but that shouldn't make much difference) when the user presses "Ctrl-R."

Anyway, here's a working example. This is just a bare beginning. It's best if you let Xanadu finish and die out, then schedule events for the instruments in Xanadu.

Regards,
Mike
-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Sun, Apr 19, 2020 at 6:36 AM fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
I think a working example would help a lot, when you get a moment, thanks. 
csound_threaded.cpp
<http://csound.1045644.n5.nabble.com/file/t339654/csound_threaded.cpp
I've tried to implement what you've suggested in my latest version of
csound_threaded.cpp. 

Does this start a thread where csound can sends samples to the output. And
the while loop is now in a separate thread? So it doesnt stop csound from
play audio when getline() is waiting for user input?

orc syntax seems like quite alot to type in while its playing? I think im
wrong there. But for its not clear to me yet what the user enters?







--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-20 14:05
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Thats great, thanks. I've had to simplify it quite a bit more heres my latest
version of csound_threaded csound_threaded.cpp
  

Im testing it with a one instr that contains simple oscil.

Im entering schedule(5,500,1)

but I get no sound and the program reads Result: 0

can you see whats not working here compared to your previous instruments?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-20 14:18
FromMichael Gogins
SubjectRe: [Csnd] CsoundApi Feedback
You have 0dfs=0. It needs to be 1 or more.

Regards,
Mike

On Mon, Apr 20, 2020, 09:05 fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
Thats great, thanks. I've had to simplify it quite a bit more heres my latest
version of csound_threaded csound_threaded.cpp
<http://csound.1045644.n5.nabble.com/file/t339654/csound_threaded.cpp

Im testing it with a one instr that contains simple oscil.

Im entering schedule(5,500,1)

but I get no sound and the program reads Result: 0

can you see whats not working here compared to your previous instruments?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-20 15:10
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Okay, thanks ;)... 

Couple more thoughts here.

schedule(....) is quite a lot to type in. Is there a way to vary this ?
Im think that Ill have the .cpp file add schedule so the user only needs to
type the p-fields. 

But, I was wondering if there is are other types of csound code that the
csound api can recieve?

Say if I just want to vary a single k-rate parameter? For example if I added
kamp to the asig output?

could the cpp. file say read in the data check if the user has written lets
say "kamp 0.5" and then adjust the instr accordingly as its playing?

What are your thoughts?

------------

Also, how can I stop a schedule task while its playing without closing the
program?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-20 15:28
FromMichael Gogins
SubjectRe: [Csnd] CsoundApi Feedback
The Csound API can receive literally any type of Csound code and evaluate it in real time.

csoundReadScore can receive real-time scores by line or by multiple lines or by entire score.

csoundCompileOrc can receive real-time orchestra code by line or by multiple lines or by entire instrument definition or by entire orchestra. Except for the global sr, kr, ksmps, 0dbfs etc. If you redefine an instr definition the old definition is used to finish any playing notes, and the new definition is used for new notes.

csoundEvalCode is like csoundCompileOrc except it's supposed to return a value representing the results of evaluating the code.

Look at Steven's live code example for some thoughts. What you might want is a separate editor where you type text, select what you want to evaluate, and then send it to Csound. You could have one such editor pane for orc code another such editor pane for sco code.

It would be very easy to code this up in Python, or with the Qt SDK in C++, or in a browser window using Csound for WebAssembly.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Mon, Apr 20, 2020 at 10:10 AM fauveboy <joel.ramsbottom@hotmail.co.uk> wrote:
Okay, thanks ;)...

Couple more thoughts here.

schedule(....) is quite a lot to type in. Is there a way to vary this ?
Im think that Ill have the .cpp file add schedule so the user only needs to
type the p-fields.

But, I was wondering if there is are other types of csound code that the
csound api can recieve?

Say if I just want to vary a single k-rate parameter? For example if I added
kamp to the asig output?

could the cpp. file say read in the data check if the user has written lets
say "kamp 0.5" and then adjust the instr accordingly as its playing?

What are your thoughts?

------------

Also, how can I stop a schedule task while its playing without closing the
program?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2020-04-20 18:55
Fromfauveboy
SubjectRe: [Csnd] CsoundApi Feedback
Some helpful food for thought there, thank you. 

Its still not clear with that info how I can cancel a note event or change
the value of a particular variable?

csound_threaded.cpp
  

from my latest version of csound_threaded you can see im now using
csound.ReadScore().

I you enter: i1 0 100. 

After reading ttp://www.csounds.com/manual/html/i.html, its suggests I can
stop that not a event with a negative p1? 
I take that to mean: i -1 0 100 would stop the note event? but the compiler
says "could not find playing instr 1.000. Do you know what that hasnt
worked?

My aim is to loop an audio clip.  While its playing how can I specify a
particular variable via the csoundapi while the note event is performing ?
for example the kfn in tableitk, or kamp. Can you specifically show me?
Sorry Im not getting yet.

Kind Regards



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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