Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] matlab interface

Date2008-03-15 22:11
Fromvictor
SubjectRe: [Cs-dev] matlab interface
AttachmentsNone  None  
That seems correct. Can you quote your code?
----- Original Message -----
Sent: Saturday, March 15, 2008 10:03 PM
Subject: Re: [Cs-dev] matlab interface

I hope I'm not being a nuisance but I am currently getting an error when I call csoundScoreEvent().  The error is "invalid instrument number or name".  I am testing with a very simple instrument so I'm not entirely sure what could be wrong.
I am making several assumptions though:

1) I shouldn't need a score file since i am providing score events
2) I can put the score events wherever as long as they are before the csoundPerformKsmps() call

Am I completely screwing this up or is it more subtle?  Thanks again for all of the help.

Balan,


instr 1
a1 oscil p4,p5,p6
out a1
endin


// test app for csound api
#include "csound.hpp"

int main(int argc, char* argv[])
{
    // csound object
    CSOUND* csound = csoundCreate(0);
   
    // init
    csoundInitialize(&argc, &argv, 0);
   
    // compile csound
    int rslt = csoundCompile(csound,argc,argv);
   
    // quick hack to create ftable and p-field values
    MYFLT ftable[5] = {1, 0, 4096, 10, 1};
    MYFLT pvals[6] = {1, 1.0, 1.0, 10000, 440, 1};
   
    // ftable creation seems fine but the call
    // to send the p-fields fails...
    csoundScoreEvent(csound,'f',&ftable[0],5);   
    csoundScoreEvent(csound,'i',&pvals[0],6);
   
    // not sure how this works exactly...
    if(!rslt)
        while(csoundPerformKsmps(csound)==0);
   
    // cleanup
    csoundDestroy(csound);
    return rslt;
}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Date2008-03-15 22:25
FromRory Walsh
SubjectRe: [Cs-dev] matlab interface
Balan posted the code at the end of his email. I had a quick look but 
couldn't spot anything obvious. Is it Ok to call csoundScoreEvent() 
before a performance has started?

Rory.


victor wrote:
> That seems correct. Can you quote your code?
> 
>     ----- Original Message -----
>     *From:* Balan Clockfactory 
>     *To:* Developer discussions 
>     *Sent:* Saturday, March 15, 2008 10:03 PM
>     *Subject:* Re: [Cs-dev] matlab interface
> 
>     I hope I'm not being a nuisance but I am currently getting an error
>     when I call csoundScoreEvent().  The error is "invalid instrument
>     number or name".  I am testing with a very simple instrument so I'm
>     no

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-03-15 22:41
From"Balan Clockfactory"
SubjectRe: [Cs-dev] matlab interface
AttachmentsNone  None  None  None  

Date2008-03-16 16:47
FromJonatan Liljedahl
SubjectRe: [Cs-dev] matlab interface
Rory Walsh wrote:
> Balan posted the code at the end of his email. I had a quick look but 
> couldn't spot anything obvious. Is it Ok to call csoundScoreEvent() 
> before a performance has started?

Yes, I do this in AlgoScore and it works fine.
But I don't think it's correct to call csoundInitialize() after
csoundCreate()! In AlgoScore I call csoundInitialize(0,0,0) (once)
before I do anything else with csound.

static naRef f_create(naContext ctx, naRef me, int argc, naRef *args) {
    static cs_initialized=0;
    HostData *data;
    if(!cs_initialized) {
        csoundInitialize(0,0,0);
        cs_initialized=1;
    }
    data = (HostData*)malloc(sizeof(HostData));
    data->tag = NUMARG(0);
    data->graph_cb = naNil();
    data->outvalues = naNil();
    CSOUND *cs = csoundCreate((void*)data);
    return newCsoundGhost(ctx,cs);
}
> 
> Rory.
> 
> 
> victor wrote:
>> That seems correct. Can you quote your code?
>>
>>     ----- Original Message -----
>>     *From:* Balan Clockfactory 
>>     *To:* Developer discussions 
>>     *Sent:* Saturday, March 15, 2008 10:03 PM
>>     *Subject:* Re: [Cs-dev] matlab interface
>>
>>     I hope I'm not being a nuisance but I am currently getting an error
>>     when I call csoundScoreEvent().  The error is "invalid instrument
>>     number or name".  I am testing with a very simple instrument so I'm
>>     no
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


-- 
/Jonatan         [ http://kymatica.com ]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2008-03-16 21:15
From"Balan Clockfactory"
SubjectRe: [Cs-dev] matlab interface
AttachmentsNone  None  None  None