Csound Csound-dev Csound-tekno Search About

[Csnd] signalflowgraph: csoundModuleDestroy(0x55b395c5ae70) : csoundSetParams(csound,&csparams)

Date2019-09-09 10:22
FromMarco Ippolito
Subject[Csnd] signalflowgraph: csoundModuleDestroy(0x55b395c5ae70) : csoundSetParams(csound,&csparams)
Hi,
this is my very first attemp to use C++API:

#include 
#include 
#include 
#include "csound.h"

#include "hparams.h"


int main(int argc, char* argv[])  {


    CSOUND* csound = csoundCreate(0); // Create an instance of Csound
    csoundInitialize(argc); // Initialise the library

    csoundSetInput(csound,"6319-64726-0013.flac"); 

    CSOUND_PARAMS csparams;
    csparams.sample_rate_override = sampling_rate; // http://files.csound-tutorial.net/floss_manual/Release04/Cs_FM_04_ScrapBook/the-csound-api.html
                                                                             // http://csound.sourceforge.net/doc/html/structCSOUND__PARAMS.html#a7a77491c079d119b980632a7d369319c

    csoundSetParams(csound,&csparams);  // http://csound.sourceforge.net/doc/html/group__ATTRIBUTES.html#ga15cb37340ffddae130ba299e9a44c246

    csoundDestroy(csound);

}

After compiling:

g++ -std=c++17 -DUSE_DOUBLE -I /usr/include/csound -L /usr/lib/csound audio.cpp -lcsound64 -o audio;


./audio
0dBFS level = 32768.0
--Csound version 6.10 (double samples) 2018-01-27 
[commit: none]
libsndfile-1.0.28
end of score.		   overall amps:      0.0
	   overall samples out of range:        0
0 errors in performance
	beep!
signalflowgraph: csoundModuleDestroy(0x557c0b2b3e70)


What's wrong with   csparams.sample_rate_override = sampling_rate;
                                    csoundSetParams(csound,&csparams);

?

Marco

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

Date2019-09-09 10:32
FromSteven Yi
SubjectRe: [Csnd] signalflowgraph: csoundModuleDestroy(0x55b395c5ae70) : csoundSetParams(csound,&csparams)
I think the problem is that there is no Csound code being executed.
Usually there's calls to csoundCompile (or variant) and either calls
csoundPerformKsmps or csoundPerform or starting of a thread.

You might also check out these examples for some ideas:

https://github.com/csound/csoundAPI_examples


On Mon, Sep 9, 2019 at 5:22 AM Marco Ippolito  wrote:
>
> Hi,
> this is my very first attemp to use C++API:
>
> #include 
> #include 
> #include 
> #include "csound.h"
>
> #include "hparams.h"
>
>
> int main(int argc, char* argv[])  {
>
>
>     CSOUND* csound = csoundCreate(0); // Create an instance of Csound
>     csoundInitialize(argc); // Initialise the library
>
>     csoundSetInput(csound,"6319-64726-0013.flac");
>
>     CSOUND_PARAMS csparams;
>     csparams.sample_rate_override = sampling_rate; // http://files.csound-tutorial.net/floss_manual/Release04/Cs_FM_04_ScrapBook/the-csound-api.html
>                                                                              // http://csound.sourceforge.net/doc/html/structCSOUND__PARAMS.html#a7a77491c079d119b980632a7d369319c
>
>     csoundSetParams(csound,&csparams);  // http://csound.sourceforge.net/doc/html/group__ATTRIBUTES.html#ga15cb37340ffddae130ba299e9a44c246
>
>     csoundDestroy(csound);
>
> }
>
> After compiling:
>
> g++ -std=c++17 -DUSE_DOUBLE -I /usr/include/csound -L /usr/lib/csound audio.cpp -lcsound64 -o audio;
>
>
> ./audio
> 0dBFS level = 32768.0
> --Csound version 6.10 (double samples) 2018-01-27
> [commit: none]
> libsndfile-1.0.28
> end of score.              overall amps:      0.0
>            overall samples out of range:        0
> 0 errors in performance
>         beep!
> signalflowgraph: csoundModuleDestroy(0x557c0b2b3e70)
>
>
> What's wrong with   csparams.sample_rate_override = sampling_rate;
>                                     csoundSetParams(csound,&csparams);
>
> ?
>
> Marco
>
> 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

Date2019-09-09 10:32
FromFrancois PINOT
SubjectRe: [Csnd] signalflowgraph: csoundModuleDestroy(0x55b395c5ae70) : csoundSetParams(csound,&csparams)
You're saying that you're using the Csound C++ API, but in fact I see that you are using functions of the Csound C API. The C API has been wrapped in a C++ class for convenience. This gives the Csound basic C++ API. You can find useful references here:
and examples her:

François

Le lun. 9 sept. 2019 à 11:22, Marco Ippolito <ippolito.marco@gmail.com> a écrit :
Hi,
this is my very first attemp to use C++API:

#include <iostream>
#include <cmath>
#include <stdio.h>
#include "csound.h"

#include "hparams.h"


int main(int argc, char* argv[])  {


    CSOUND* csound = csoundCreate(0); // Create an instance of Csound
    csoundInitialize(argc); // Initialise the library

    csoundSetInput(csound,"6319-64726-0013.flac");

    CSOUND_PARAMS csparams;
    csparams.sample_rate_override = sampling_rate; // http://files.csound-tutorial.net/floss_manual/Release04/Cs_FM_04_ScrapBook/the-csound-api.html
                                                                             // http://csound.sourceforge.net/doc/html/structCSOUND__PARAMS.html#a7a77491c079d119b980632a7d369319c

    csoundSetParams(csound,&csparams);  // http://csound.sourceforge.net/doc/html/group__ATTRIBUTES.html#ga15cb37340ffddae130ba299e9a44c246

    csoundDestroy(csound);

}

After compiling:

g++ -std=c++17 -DUSE_DOUBLE -I /usr/include/csound -L /usr/lib/csound audio.cpp -lcsound64 -o audio;


./audio
0dBFS level = 32768.0
--Csound version 6.10 (double samples) 2018-01-27
[commit: none]
libsndfile-1.0.28
end of score.              overall amps:      0.0
           overall samples out of range:        0
0 errors in performance
        beep!
signalflowgraph: csoundModuleDestroy(0x557c0b2b3e70)


What's wrong with   csparams.sample_rate_override = sampling_rate;
                                    csoundSetParams(csound,&csparams);

?

Marco

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