Csound Csound-dev Csound-tekno Search About

[Cs-dev] Audio samples into host

Date2013-05-11 19:50
FromHenrik Andersson
Subject[Cs-dev] Audio samples into host
AttachmentsNone  None  
I have spent 2 hours looking into why i cant get audio samples into my host app from csound,
i wrote a test program which works out of the box with the same initialization as my host app, the only thing differing is that csoundPerformKsmp() is called on a audio backend thread and not the main thread such in my test.

Anyone having a clue or can point me in a direction ?

Please take a look at provided code to see if i do something fishy.

/Henrik

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

#include <stdio.h>
#include <csound/csound.h>

int g_midi_event=1;

static int
midi_in_device_open_cb(CSOUND *csound, void **userdata, const char *devname)
{
  return 0;
}

static int
midi_in_read_cb(CSOUND *csound, void *userdata, unsigned char *buf, int bytes)
{
  if (!g_midi_event)
    return 0;

  buf[0] = 0x90; // noteon channel 1
  buf[1] = 0x48; // c-3
  buf[2] = 0x7f;

  g_midi_event=0;

  return 3;
}

int main(int argc, char **argv)
{
  int res, i, ksmps,frames;
  CSOUND *cs;
  MYFLT *aout, scale;

  cs = csoundCreate(NULL);
  
  csoundSetOption(cs,"--nosound");
  csoundSetOption(cs,"--sample-rate=44100");
  csoundSetOption(cs,"--control-rate=4410");
  
  csoundSetOutput(cs, "dac", NULL, NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  csoundSetExternalMidiInOpenCallback(cs, midi_in_device_open_cb);
  csoundSetExternalMidiReadCallback(cs, midi_in_read_cb);

  csoundCompile(cs, argc, argv);
  
  csoundSetScorePending(cs, 1);
 
  aout = csoundGetSpout(cs);
  ksmps = csoundGetKsmps(cs);
  scale = csoundGet0dBFS(cs);

  FILE *f = fopen("./data.log","w");
  if (f == NULL)
    perror("Failed to open data.log:");

  frames = 44100;
  while(frames)
  {
    csoundPerformKsmps(cs);
    for(i = 0; i < ksmps; i++)
  fprintf(f, "%f\n", aout[i]/scale);

    frames -= ksmps;
  }
  fclose(f);
}

Date2013-05-11 20:12
FromRory Walsh
SubjectRe: [Cs-dev] Audio samples into host
I do a similar thing in Cabbage. I call performKsmps in my plugin
processing function, which runs in an audio thread. I don't get any
issues. So the while(frames) loop is effectively your processing
function, which runs away on it's own thread? Sounds fine. Are you
calling csoundSetHostData() in your code? Looks like something might
be up with aout but I can't tell what. Is your host code very large?
You writing this in C?


On 11 May 2013 19:50, Henrik Andersson  wrote:
> I have spent 2 hours looking into why i cant get audio samples into my host
> app from csound,
> i wrote a test program which works out of the box with the same
> initialization as my host app, the only thing differing is that
> csoundPerformKsmp() is called on a audio backend thread and not the main
> thread such in my test.
>
> Anyone having a clue or can point me in a direction ?
>
> Please take a look at provided code to see if i do something fishy.
>
> /Henrik
>
> -------------------------------------------------------
>
> #include 
> #include 
>
> int g_midi_event=1;
>
> static int
> midi_in_device_open_cb(CSOUND *csound, void **userdata, const char *devname)
> {
>   return 0;
> }
>
> static int
> midi_in_read_cb(CSOUND *csound, void *userdata, unsigned char *buf, int
> bytes)
> {
>   if (!g_midi_event)
>     return 0;
>
>   buf[0] = 0x90; // noteon channel 1
>   buf[1] = 0x48; // c-3
>   buf[2] = 0x7f;
>
>   g_midi_event=0;
>
>   return 3;
> }
>
> int main(int argc, char **argv)
> {
>   int res, i, ksmps,frames;
>   CSOUND *cs;
>   MYFLT *aout, scale;
>
>   cs = csoundCreate(NULL);
>
>   csoundSetOption(cs,"--nosound");
>   csoundSetOption(cs,"--sample-rate=44100");
>   csoundSetOption(cs,"--control-rate=4410");
>
>   csoundSetOutput(cs, "dac", NULL, NULL);
>   csoundSetRTAudioModule(cs, "null");
>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>   csoundSetExternalMidiInOpenCallback(cs, midi_in_device_open_cb);
>   csoundSetExternalMidiReadCallback(cs, midi_in_read_cb);
>
>   csoundCompile(cs, argc, argv);
>
>   csoundSetScorePending(cs, 1);
>
>   aout = csoundGetSpout(cs);
>   ksmps = csoundGetKsmps(cs);
>   scale = csoundGet0dBFS(cs);
>
>   FILE *f = fopen("./data.log","w");
>   if (f == NULL)
>     perror("Failed to open data.log:");
>
>   frames = 44100;
>   while(frames)
>   {
>     csoundPerformKsmps(cs);
>     for(i = 0; i < ksmps; i++)
>   fprintf(f, "%f\n", aout[i]/scale);
>
>     frames -= ksmps;
>   }
>   fclose(f);
> }
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-11 22:27
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Im going to get crazy if i continue with csound :),

here is what i found out... my csd does only handle integers :)

i just added following print
  print  100*0.25

Running with my host app:

new alloc for instr Deep_Bass_Nine:
instr 1:  #i1 = 0,000


Running with csound binary:

new alloc for instr Deep_Bass_Nine:
instr 1:  #i1 = 50.000


Please!! Help me with this madness... What is wrong with my build ???


/H


2013/5/11 Rory Walsh <rorywalsh@ear.ie>
I do a similar thing in Cabbage. I call performKsmps in my plugin
processing function, which runs in an audio thread. I don't get any
issues. So the while(frames) loop is effectively your processing
function, which runs away on it's own thread? Sounds fine. Are you
calling csoundSetHostData() in your code? Looks like something might
be up with aout but I can't tell what. Is your host code very large?
You writing this in C?


On 11 May 2013 19:50, Henrik Andersson <henrik.4e@gmail.com> wrote:
> I have spent 2 hours looking into why i cant get audio samples into my host
> app from csound,
> i wrote a test program which works out of the box with the same
> initialization as my host app, the only thing differing is that
> csoundPerformKsmp() is called on a audio backend thread and not the main
> thread such in my test.
>
> Anyone having a clue or can point me in a direction ?
>
> Please take a look at provided code to see if i do something fishy.
>
> /Henrik
>
> -------------------------------------------------------
>
> #include <stdio.h>
> #include <csound/csound.h>
>
> int g_midi_event=1;
>
> static int
> midi_in_device_open_cb(CSOUND *csound, void **userdata, const char *devname)
> {
>   return 0;
> }
>
> static int
> midi_in_read_cb(CSOUND *csound, void *userdata, unsigned char *buf, int
> bytes)
> {
>   if (!g_midi_event)
>     return 0;
>
>   buf[0] = 0x90; // noteon channel 1
>   buf[1] = 0x48; // c-3
>   buf[2] = 0x7f;
>
>   g_midi_event=0;
>
>   return 3;
> }
>
> int main(int argc, char **argv)
> {
>   int res, i, ksmps,frames;
>   CSOUND *cs;
>   MYFLT *aout, scale;
>
>   cs = csoundCreate(NULL);
>
>   csoundSetOption(cs,"--nosound");
>   csoundSetOption(cs,"--sample-rate=44100");
>   csoundSetOption(cs,"--control-rate=4410");
>
>   csoundSetOutput(cs, "dac", NULL, NULL);
>   csoundSetRTAudioModule(cs, "null");
>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>   csoundSetExternalMidiInOpenCallback(cs, midi_in_device_open_cb);
>   csoundSetExternalMidiReadCallback(cs, midi_in_read_cb);
>
>   csoundCompile(cs, argc, argv);
>
>   csoundSetScorePending(cs, 1);
>
>   aout = csoundGetSpout(cs);
>   ksmps = csoundGetKsmps(cs);
>   scale = csoundGet0dBFS(cs);
>
>   FILE *f = fopen("./data.log","w");
>   if (f == NULL)
>     perror("Failed to open data.log:");
>
>   frames = 44100;
>   while(frames)
>   {
>     csoundPerformKsmps(cs);
>     for(i = 0; i < ksmps; i++)
>   fprintf(f, "%f\n", aout[i]/scale);
>
>     frames -= ksmps;
>   }
>   fclose(f);
> }
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-11 22:27
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
I think this line is why you're not getting any sound. 

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-11 22:30
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-11 22:37
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
did you try adding  -DUSE_DOUBLE to your host app build?


On 11 May 2013, at 22:27, Henrik Andersson wrote:

Im going to get crazy if i continue with csound :),

here is what i found out... my csd does only handle integers :)

i just added following print
  print  100*0.25

Running with my host app:

new alloc for instr Deep_Bass_Nine:
instr 1:  #i1 = 0,000


Running with csound binary:

new alloc for instr Deep_Bass_Nine:
instr 1:  #i1 = 50.000


Please!! Help me with this madness... What is wrong with my build ???


/H


2013/5/11 Rory Walsh <rorywalsh@ear.ie>
I do a similar thing in Cabbage. I call performKsmps in my plugin
processing function, which runs in an audio thread. I don't get any
issues. So the while(frames) loop is effectively your processing
function, which runs away on it's own thread? Sounds fine. Are you
calling csoundSetHostData() in your code? Looks like something might
be up with aout but I can't tell what. Is your host code very large?
You writing this in C?


On 11 May 2013 19:50, Henrik Andersson <henrik.4e@gmail.com> wrote:
> I have spent 2 hours looking into why i cant get audio samples into my host
> app from csound,
> i wrote a test program which works out of the box with the same
> initialization as my host app, the only thing differing is that
> csoundPerformKsmp() is called on a audio backend thread and not the main
> thread such in my test.
>
> Anyone having a clue or can point me in a direction ?
>
> Please take a look at provided code to see if i do something fishy.
>
> /Henrik
>
> -------------------------------------------------------
>
> #include <stdio.h>
> #include <csound/csound.h>
>
> int g_midi_event=1;
>
> static int
> midi_in_device_open_cb(CSOUND *csound, void **userdata, const char *devname)
> {
>   return 0;
> }
>
> static int
> midi_in_read_cb(CSOUND *csound, void *userdata, unsigned char *buf, int
> bytes)
> {
>   if (!g_midi_event)
>     return 0;
>
>   buf[0] = 0x90; // noteon channel 1
>   buf[1] = 0x48; // c-3
>   buf[2] = 0x7f;
>
>   g_midi_event=0;
>
>   return 3;
> }
>
> int main(int argc, char **argv)
> {
>   int res, i, ksmps,frames;
>   CSOUND *cs;
>   MYFLT *aout, scale;
>
>   cs = csoundCreate(NULL);
>
>   csoundSetOption(cs,"--nosound");
>   csoundSetOption(cs,"--sample-rate=44100");
>   csoundSetOption(cs,"--control-rate=4410");
>
>   csoundSetOutput(cs, "dac", NULL, NULL);
>   csoundSetRTAudioModule(cs, "null");
>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>   csoundSetExternalMidiInOpenCallback(cs, midi_in_device_open_cb);
>   csoundSetExternalMidiReadCallback(cs, midi_in_read_cb);
>
>   csoundCompile(cs, argc, argv);
>
>   csoundSetScorePending(cs, 1);
>
>   aout = csoundGetSpout(cs);
>   ksmps = csoundGetKsmps(cs);
>   scale = csoundGet0dBFS(cs);
>
>   FILE *f = fopen("./data.log","w");
>   if (f == NULL)
>     perror("Failed to open data.log:");
>
>   frames = 44100;
>   while(frames)
>   {
>     csoundPerformKsmps(cs);
>     for(i = 0; i < ksmps; i++)
>   fprintf(f, "%f\n", aout[i]/scale);
>
>     frames -= ksmps;
>   }
>   fclose(f);
> }
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-11 22:42
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
i defined it before including csound.h to fix the channels enumeration in a previous issue.

/H 


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
did you try adding  -DUSE_DOUBLE to your host app build?


On 11 May 2013, at 22:27, Henrik Andersson wrote:

Im going to get crazy if i continue with csound :),

here is what i found out... my csd does only handle integers :)

i just added following print
  print  100*0.25

Running with my host app:

new alloc for instr Deep_Bass_Nine:
instr 1:  #i1 = 0,000


Running with csound binary:

new alloc for instr Deep_Bass_Nine:
instr 1:  #i1 = 50.000


Please!! Help me with this madness... What is wrong with my build ???


/H


2013/5/11 Rory Walsh <rorywalsh@ear.ie>
I do a similar thing in Cabbage. I call performKsmps in my plugin
processing function, which runs in an audio thread. I don't get any
issues. So the while(frames) loop is effectively your processing
function, which runs away on it's own thread? Sounds fine. Are you
calling csoundSetHostData() in your code? Looks like something might
be up with aout but I can't tell what. Is your host code very large?
You writing this in C?


On 11 May 2013 19:50, Henrik Andersson <henrik.4e@gmail.com> wrote:
> I have spent 2 hours looking into why i cant get audio samples into my host
> app from csound,
> i wrote a test program which works out of the box with the same
> initialization as my host app, the only thing differing is that
> csoundPerformKsmp() is called on a audio backend thread and not the main
> thread such in my test.
>
> Anyone having a clue or can point me in a direction ?
>
> Please take a look at provided code to see if i do something fishy.
>
> /Henrik
>
> -------------------------------------------------------
>
> #include <stdio.h>
> #include <csound/csound.h>
>
> int g_midi_event=1;
>
> static int
> midi_in_device_open_cb(CSOUND *csound, void **userdata, const char *devname)
> {
>   return 0;
> }
>
> static int
> midi_in_read_cb(CSOUND *csound, void *userdata, unsigned char *buf, int
> bytes)
> {
>   if (!g_midi_event)
>     return 0;
>
>   buf[0] = 0x90; // noteon channel 1
>   buf[1] = 0x48; // c-3
>   buf[2] = 0x7f;
>
>   g_midi_event=0;
>
>   return 3;
> }
>
> int main(int argc, char **argv)
> {
>   int res, i, ksmps,frames;
>   CSOUND *cs;
>   MYFLT *aout, scale;
>
>   cs = csoundCreate(NULL);
>
>   csoundSetOption(cs,"--nosound");
>   csoundSetOption(cs,"--sample-rate=44100");
>   csoundSetOption(cs,"--control-rate=4410");
>
>   csoundSetOutput(cs, "dac", NULL, NULL);
>   csoundSetRTAudioModule(cs, "null");
>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>   csoundSetExternalMidiInOpenCallback(cs, midi_in_device_open_cb);
>   csoundSetExternalMidiReadCallback(cs, midi_in_read_cb);
>
>   csoundCompile(cs, argc, argv);
>
>   csoundSetScorePending(cs, 1);
>
>   aout = csoundGetSpout(cs);
>   ksmps = csoundGetKsmps(cs);
>   scale = csoundGet0dBFS(cs);
>
>   FILE *f = fopen("./data.log","w");
>   if (f == NULL)
>     perror("Failed to open data.log:");
>
>   frames = 44100;
>   while(frames)
>   {
>     csoundPerformKsmps(cs);
>     for(i = 0; i < ksmps; i++)
>   fprintf(f, "%f\n", aout[i]/scale);
>
>     frames -= ksmps;
>   }
>   fclose(f);
> }
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-11 22:43
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Try this program

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}


built with 

gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib dir> -lcsound -lsndfile

run with

instr 1

out vco2(p4, p5)

endin

i1 0 1 10000 440

you should get

...
-6816.658489
-7011.315984
-7186.383909
-7443.511609
-7548.564586
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:  11564.4
  overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.212s, CPU: 0.119s





On 11 May 2013, at 22:30, Henrik Andersson wrote:

I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-11 22:54
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I get the same values as you except some out of range...

7443.511609
-7548.564586
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
number of samples out of range:    43978
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:11564.41026
  overall samples out of range:    43978
0 errors in performance
Elapsed time at end of performance: real: 1.095s, CPU: 0.170s



2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Try this program

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}


built with 

gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib dir> -lcsound -lsndfile

run with

instr 1

out vco2(p4, p5)

endin

i1 0 1 10000 440

you should get

...
-7011.315984
-7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:  11564.4
  overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.212s, CPU: 0.119s





On 11 May 2013, at 22:30, Henrik Andersson wrote:

I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-11 23:00
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
That's a good start. You might be running with 0dbfs=1. That's why the samples out of range. Try either removing that or
changing the score line for

i1 0 1 0.3 440

(0.3 instead of 10000)
On 11 May 2013, at 22:54, Henrik Andersson wrote:

I get the same values as you except some out of range...

7443.511609
-7548.564586
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
number of samples out of range:    43978
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:11564.41026
  overall samples out of range:    43978
0 errors in performance
Elapsed time at end of performance: real: 1.095s, CPU: 0.170s



2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Try this program

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}


built with 

gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib dir> -lcsound -lsndfile

run with

instr 1

out vco2(p4, p5)

endin

i1 0 1 10000 440

you should get

...
-7011.315984
-7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:  11564.4
  overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.212s, CPU: 0.119s





On 11 May 2013, at 22:30, Henrik Andersson wrote:

I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-11 23:06
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I fixed my other test program and it does not have the same strange problem as i have in my host app.


2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
That's a good start. You might be running with 0dbfs=1. That's why the samples out of range. Try either removing that or
changing the score line for

i1 0 1 0.3 440

(0.3 instead of 10000)

On 11 May 2013, at 22:54, Henrik Andersson wrote:

I get the same values as you except some out of range...

7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
number of samples out of range:    43978
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:11564.41026
  overall samples out of range:    43978
0 errors in performance
Elapsed time at end of performance: real: 1.095s, CPU: 0.170s



2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Try this program

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}


built with 

gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib dir> -lcsound -lsndfile

run with

instr 1

out vco2(p4, p5)

endin

i1 0 1 10000 440

you should get

...
-7011.315984
-7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:  11564.4
  overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.212s, CPU: 0.119s





On 11 May 2013, at 22:30, Henrik Andersson wrote:

I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-11 23:50
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Im really lost, it has definitly something to do with my hostapp build :/

One additional strange thing is that the ftable graph differs from running in my host application
compared with csound, it seems to default the 2 ftables to sinwave but when running csound
from command, it shows the proper square and saw graph..

Any clues would be appropiated.. 


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
I fixed my other test program and it does not have the same strange problem as i have in my host app.


2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
That's a good start. You might be running with 0dbfs=1. That's why the samples out of range. Try either removing that or
changing the score line for

i1 0 1 0.3 440

(0.3 instead of 10000)

On 11 May 2013, at 22:54, Henrik Andersson wrote:

I get the same values as you except some out of range...

7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
number of samples out of range:    43978
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:11564.41026
  overall samples out of range:    43978
0 errors in performance
Elapsed time at end of performance: real: 1.095s, CPU: 0.170s



2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Try this program

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}


built with 

gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib dir> -lcsound -lsndfile

run with

instr 1

out vco2(p4, p5)

endin

i1 0 1 10000 440

you should get

...
-7011.315984
-7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:  11564.4
  overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.212s, CPU: 0.119s





On 11 May 2013, at 22:30, Henrik Andersson wrote:

I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel




Date2013-05-12 01:43
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Ok i have missed on thing in my code that differed with my test case,
there are several instance created csoundCreate(), tried to come around
with a csoundInitialize() in main() but it doesn't help.

What is the correct way of handling of multiple CSOUND instances ?


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
Im really lost, it has definitly something to do with my hostapp build :/

One additional strange thing is that the ftable graph differs from running in my host application
compared with csound, it seems to default the 2 ftables to sinwave but when running csound
from command, it shows the proper square and saw graph..

Any clues would be appropiated.. 


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
I fixed my other test program and it does not have the same strange problem as i have in my host app.


2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
That's a good start. You might be running with 0dbfs=1. That's why the samples out of range. Try either removing that or
changing the score line for

i1 0 1 0.3 440

(0.3 instead of 10000)

On 11 May 2013, at 22:54, Henrik Andersson wrote:

I get the same values as you except some out of range...

7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
number of samples out of range:    43978
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:11564.41026
  overall samples out of range:    43978
0 errors in performance
Elapsed time at end of performance: real: 1.095s, CPU: 0.170s



2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Try this program

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}


built with 

gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib dir> -lcsound -lsndfile

run with

instr 1

out vco2(p4, p5)

endin

i1 0 1 10000 440

you should get

...
-7011.315984
-7443.511609
-7884.549374
-7898.780294
-8341.223838
-8231.409403
-8819.427944
-8529.999288
-9352.616239
-8744.794868
-10025.464549
-8661.532768
-11564.410262
B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
Score finished in csoundPerformKsmps().
inactive allocs returned to freespace
end of score.   overall amps:  11564.4
  overall samples out of range:        0
0 errors in performance
Elapsed time at end of performance: real: 0.212s, CPU: 0.119s





On 11 May 2013, at 22:30, Henrik Andersson wrote:

I do get sound, but its all truncated, see my previous post...

this will fail:

 kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
 a1 oscil 0dbfs*kdec, ifreq, 1+iW
                out a1

out will always be 0 :/


2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I think this line is why you're not getting any sound.

On 11 May 2013, at 19:50, Henrik Andersson wrote:

>   csoundSetOption(cs,"--nosound");

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel





Date2013-05-12 02:47
FromRory Walsh
SubjectRe: [Cs-dev] Audio samples into host
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson  wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson 
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson 
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini 
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini 
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I  -L>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini 
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-12 10:16
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-12 13:55
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 14:00
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 14:08
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I do override and set kr as in csladspa.

The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
as do printi 10000*ivel.

I cant do any calculations which is < 1.0 because its truncated to closets integer.





2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-12 14:10
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
as for want_frames is dont see any problem with my code. iframes are static and if want_frames is fulfilled
in the middle of ksmps smapels it will continue from there next round.


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
I do override and set kr as in csladspa.

The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
as do printi 10000*ivel.

I cant do any calculations which is < 1.0 because its truncated to closets integer.





2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel




Date2013-05-12 16:37
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Well, in your code, you don't do exactly as in csladspa, because there we set the sr/kr to whatever the host tell us to do.
In your code that seems to be fixed.

Victor
On 12 May 2013, at 14:08, Henrik Andersson wrote:

I do override and set kr as in csladspa.

The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
as do printi 10000*ivel.

I cant do any calculations which is < 1.0 because its truncated to closets integer.





2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 16:38
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
But the counting always start from 0, and if you have an unfilled buffer, there might be a gap.
On 12 May 2013, at 14:10, Henrik Andersson wrote:

as for want_frames is dont see any problem with my code. iframes are static and if want_frames is fulfilled
in the middle of ksmps smapels it will continue from there next round.


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
I do override and set kr as in csladspa.

The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
as do printi 10000*ivel.

I cant do any calculations which is < 1.0 because its truncated to closets integer.





2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 16:45
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-12 17:03
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-12 17:09
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input
On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 17:10
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I dont understand this, could you explain a bit more detailed ?

what buffer is unfilled Spout ? Isn't csoundGetSpout() buffers
valid to next call of csoundPerormKsmps() ?

The only thing i think is not handled is if score has ended and csoundPerformKsmps()
in that case uninitialized ksmps are copied which is fine by now.. this is not my main problem.
 


2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
But the counting always start from 0, and if you have an unfilled buffer, there might be a gap.

On 12 May 2013, at 14:10, Henrik Andersson wrote:

as for want_frames is dont see any problem with my code. iframes are static and if want_frames is fulfilled
in the middle of ksmps smapels it will continue from there next round.


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
I do override and set kr as in csladspa.

The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
as do printi 10000*ivel.

I cant do any calculations which is < 1.0 because its truncated to closets integer.





2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-12 17:10
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
i already did earlier in this thread..

printi 10000*0.5

shows 0.0




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input

On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-12 17:21
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I see you are you using a static frames counter (iframes). That should be OK as long as you don't have another instance of
the process function in between, writing somewhere else. I'd say you're better off keeping that count in your RTCsoundInstrument struct.

Victor
On 12 May 2013, at 17:10, Henrik Andersson wrote:

I dont understand this, could you explain a bit more detailed ?

what buffer is unfilled Spout ? Isn't csoundGetSpout() buffers
valid to next call of csoundPerormKsmps() ?

The only thing i think is not handled is if score has ended and csoundPerformKsmps()
in that case uninitialized ksmps are copied which is fine by now.. this is not my main problem.
 


2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
But the counting always start from 0, and if you have an unfilled buffer, there might be a gap.

On 12 May 2013, at 14:10, Henrik Andersson wrote:

as for want_frames is dont see any problem with my code. iframes are static and if want_frames is fulfilled
in the middle of ksmps smapels it will continue from there next round.


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
I do override and set kr as in csladspa.

The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set 
oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
as do printi 10000*ivel.

I cant do any calculations which is < 1.0 because its truncated to closets integer.





2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
By the way, have a look at the csladspa.cpp code, where we do something like what I described in the constructor (ksmps overrride).

On 12 May 2013, at 13:55, Victor Lazzarini wrote:

Ok, two things:

1) unrelated to your particular problem, but important. Make sure you check the value that
csoundPerformKsmps() return, if it is 0, then the processing went fine, otherwise, it didn't
(csound might have reached the end of the score, or other error occurred etc).

2) Can you describe the audio you are getting out of your app? Is it made up of
gaps (zeros/dropouts), are these regularly spaced (giving a zing tone to the sound), etc?
This could be synchronisation between you writing to your right/left buffers

right[i] = left[i] = (csound->priv->aout[iframes] / scale);

and the part of your program that consumes it. For instance, if want_frames is
smaller  than ksmps or if it is >= ksmps and does not divide it evenly, you will
probably get a problem.

Try enforcing ksmps to divide want_frames evenly by setting the sr/kr = N, where
N is a whole number. Eg,, want_frames = 128, ksmps = 32.

Otherwise, you will need to take care of that in your code.

Victor

On 12 May 2013, at 10:16, Henrik Andersson wrote:

Ah, that sound like an nifty way (singel csound instance) but in my project,
csound is just a corner of the audio pipe.

I my project i have a csound intrument plugin which holds its own instance of
csound csoundCreate(), and my host does instantiate this csound instrument
two times, first time is when it is discovering available instrument on the system
and the second is the actual instance for playback. The first instrument is destroyed
after its discover before the second instrument is instantiated.

Here follows the current code for the csound instrument, please take a look when you
get some time to see if you can spot anything strange.

rt_csound_instrument_init() : instantiate of instrument

rt_csound_instrument_load() : load of csd

_csound_instrument_process() : audio processing pipe callback from audiobackend





Regards,

Henrik Andersson




2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I could be wrong, but as far as I know there is no special trick to
handling several instances, so long as each one has its own processing
thread. If you are using Csound6 then you can use Csound to create
your signal graph. This means you only have to deal with one Csound
processing thread and you simply add instruments to the graph in
realtime. In my host I create plugins that hold a single instance of
Csound. Each plugin runs its own processing thread which calls
performKsmps(). In the following screencast there is an instance of
Csound running in each of the GUI objects:

https://vimeo.com/62518410

It works fine for me, but using Csound to create the signal graph is
far more flexible as you can send channel messages between plugins, so
you could create you own protocol for parameter changes,
side-chainging etc. In my host this is not possible without some
serious hacking.

If in your host each instance is already running its own processing
thread, I can't really say what the problem might be without seeing
more of your host code. But the good news is there are plenty on this
list that should be able to spot the problem, once they return en
masse from the LAC!






On 12 May 2013 01:43, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Ok i have missed on thing in my code that differed with my test case,
> there are several instance created csoundCreate(), tried to come around
> with a csoundInitialize() in main() but it doesn't help.
>
> What is the correct way of handling of multiple CSOUND instances ?
>
>
> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>
>> Im really lost, it has definitly something to do with my hostapp build :/
>>
>> One additional strange thing is that the ftable graph differs from running
>> in my host application
>> compared with csound, it seems to default the 2 ftables to sinwave but
>> when running csound
>> from command, it shows the proper square and saw graph..
>>
>> Any clues would be appropiated..
>>
>>
>> 2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
>>>
>>> I fixed my other test program and it does not have the same strange
>>> problem as i have in my host app.
>>>
>>>
>>> 2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>
>>>> That's a good start. You might be running with 0dbfs=1. That's why the
>>>> samples out of range. Try either removing that or
>>>> changing the score line for
>>>>
>>>> i1 0 1 0.3 440
>>>>
>>>> (0.3 instead of 10000)
>>>>
>>>> On 11 May 2013, at 22:54, Henrik Andersson wrote:
>>>>
>>>> I get the same values as you except some out of range...
>>>>
>>>> 7443.511609
>>>> -7548.564586
>>>> -7884.549374
>>>> -7898.780294
>>>> -8341.223838
>>>> -8231.409403
>>>> -8819.427944
>>>> -8529.999288
>>>> -9352.616239
>>>> -8744.794868
>>>> -10025.464549
>>>> -8661.532768
>>>> -11564.410262
>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:11564.41026
>>>> number of samples out of range:    43978
>>>> Score finished in csoundPerformKsmps().
>>>> inactive allocs returned to freespace
>>>> end of score.   overall amps:11564.41026
>>>>   overall samples out of range:    43978
>>>> 0 errors in performance
>>>> Elapsed time at end of performance: real: 1.095s, CPU: 0.170s
>>>>
>>>>
>>>>
>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>
>>>>> Try this program
>>>>>
>>>>> int main(int argc, char **argv){
>>>>>   MYFLT *aout;
>>>>>   CSOUND *cs = csoundCreate(NULL);
>>>>>   csoundSetRTAudioModule(cs, "null");
>>>>>   csoundSetOption(cs, "-odac");
>>>>>   csoundSetHostImplementedAudioIO(cs, 1, 0);
>>>>>
>>>>>   csoundCompile(cs, argc, argv);
>>>>>   aout = csoundGetSpout(cs);
>>>>>   while(csoundPerformKsmps(cs)==0)
>>>>>   {
>>>>>     int i;
>>>>>     for(i = 0; i < csoundGetKsmps(cs); i++)
>>>>>      printf("%f\n", aout[i]);
>>>>>   }
>>>>>   csoundDestroy(cs);
>>>>>   return 0;
>>>>> }
>>>>>
>>>>>
>>>>> built with
>>>>>
>>>>> gcc -o prg prg.c  -DUSE_DOUBLE  -I<csound header dir>  -L<csound lib
>>>>> dir> -lcsound -lsndfile
>>>>>
>>>>> run with
>>>>>
>>>>> instr 1
>>>>>
>>>>> out vco2(p4, p5)
>>>>>
>>>>> endin
>>>>>
>>>>> i1 0 1 10000 440
>>>>>
>>>>> you should get
>>>>>
>>>>> ...
>>>>> -6816.658489
>>>>> -7011.315984
>>>>> -7186.383909
>>>>> -7443.511609
>>>>> -7548.564586
>>>>> -7884.549374
>>>>> -7898.780294
>>>>> -8341.223838
>>>>> -8231.409403
>>>>> -8819.427944
>>>>> -8529.999288
>>>>> -9352.616239
>>>>> -8744.794868
>>>>> -10025.464549
>>>>> -8661.532768
>>>>> -11564.410262
>>>>> B  0.000 ..  1.000 T  1.000 TT  1.000 M:  11564.4
>>>>> Score finished in csoundPerformKsmps().
>>>>> inactive allocs returned to freespace
>>>>> end of score.   overall amps:  11564.4
>>>>>   overall samples out of range:        0
>>>>> 0 errors in performance
>>>>> Elapsed time at end of performance: real: 0.212s, CPU: 0.119s
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On 11 May 2013, at 22:30, Henrik Andersson wrote:
>>>>>
>>>>> I do get sound, but its all truncated, see my previous post...
>>>>>
>>>>> this will fail:
>>>>>
>>>>>  kdec linsegr 0.0, 0.01, 1.0, 10.0, 0.0, 0.15, 0.0
>>>>>  a1 oscil 0dbfs*kdec, ifreq, 1+iW
>>>>>                 out a1
>>>>>
>>>>> out will always be 0 :/
>>>>>
>>>>>
>>>>> 2013/5/11 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
>>>>>>
>>>>>> I think this line is why you're not getting any sound.
>>>>>>
>>>>>> On 11 May 2013, at 19:50, Henrik Andersson wrote:
>>>>>>
>>>>>> >   csoundSetOption(cs,"--nosound");
>>>>>>
>>>>>> Dr Victor Lazzarini
>>>>>> Senior Lecturer
>>>>>> Dept. of Music
>>>>>> NUI Maynooth Ireland
>>>>>> tel.: +353 1 708 3545
>>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their applications. This 200-page book is written by three acclaimed
>>>>>> leaders in the field. The early access version is available now.
>>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>>> _______________________________________________
>>>>>> Csound-devel mailing list
>>>>>> Csound-devel@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today!
>>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>>
>>>>> Dr Victor Lazzarini
>>>>> Senior Lecturer
>>>>> Dept. of Music
>>>>> NUI Maynooth Ireland
>>>>> tel.: +353 1 708 3545
>>>>> Victor dot Lazzarini AT nuim dot ie
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their applications. This 200-page book is written by three acclaimed
>>>>> leaders in the field. The early access version is available now.
>>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>>> _______________________________________________
>>>>> Csound-devel mailing list
>>>>> Csound-devel@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today!
>>>> http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>>
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their applications. This 200-page book is written by three acclaimed
>>>> leaders in the field. The early access version is available now.
>>>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>>>> _______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 17:26
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Can you try with sound, replacing ampmidi? That could be a printing issue.

Victor
On 12 May 2013, at 17:10, Henrik Andersson wrote:

i already did earlier in this thread..

printi 10000*0.5

shows 0.0




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input

On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 17:34
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
In my host app code i get channel hints and process them which also is truncated...

and the ftable output is invalid, showing two sinewaves instead of saw and pulse :/

Here is my code logic:

First a RTCsoundInstrument is created in a discovery processing logic which enumerates
available insturments, which in my case is only one, here everything is fine values are not
truncated and Ftable output looks all good.

After this discover process the RTCsoundInstrument is disposed, calling csoundDestroy() etc..

Then the host app creates a neew RTCsoundInstrument and loading the one he discovered, 
here, everything is wrong, truncation of values, FTABLE prints two sinewaves instead of saw
and pulse etc..


So i believe this is about multi instances of CSOUND which missbehaves, as i understand
csoundInitialize() is created in the first call to csoundCreate() which happens on an object
which is then destroyed is this a problem ?

I tried call csoundInitialize() in my main() but no changes.

 



2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Can you try with sound, replacing ampmidi? That could be a printing issue.

Victor

On 12 May 2013, at 17:10, Henrik Andersson wrote:

i already did earlier in this thread..

printi 10000*0.5

shows 0.0




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input

On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-12 17:38
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
It is OK to have multiple instances of CSOUND, Rory does it with his code.
I'll check it anyway later.

Victor
On 12 May 2013, at 17:34, Henrik Andersson wrote:

In my host app code i get channel hints and process them which also is truncated...

and the ftable output is invalid, showing two sinewaves instead of saw and pulse :/

Here is my code logic:

First a RTCsoundInstrument is created in a discovery processing logic which enumerates
available insturments, which in my case is only one, here everything is fine values are not
truncated and Ftable output looks all good.

After this discover process the RTCsoundInstrument is disposed, calling csoundDestroy() etc..

Then the host app creates a neew RTCsoundInstrument and loading the one he discovered, 
here, everything is wrong, truncation of values, FTABLE prints two sinewaves instead of saw
and pulse etc..


So i believe this is about multi instances of CSOUND which missbehaves, as i understand
csoundInitialize() is created in the first call to csoundCreate() which happens on an object
which is then destroyed is this a problem ?

I tried call csoundInitialize() in my main() but no changes.

 



2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Can you try with sound, replacing ampmidi? That could be a printing issue.

Victor

On 12 May 2013, at 17:10, Henrik Andersson wrote:

i already did earlier in this thread..

printi 10000*0.5

shows 0.0




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input

On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 17:40
FromVictor Lazzarini
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
I've tested this code and it runs as expected.

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  csoundDestroy(cs);

  cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}

On 12 May 2013, at 17:34, Henrik Andersson wrote:

In my host app code i get channel hints and process them which also is truncated...

and the ftable output is invalid, showing two sinewaves instead of saw and pulse :/

Here is my code logic:

First a RTCsoundInstrument is created in a discovery processing logic which enumerates
available insturments, which in my case is only one, here everything is fine values are not
truncated and Ftable output looks all good.

After this discover process the RTCsoundInstrument is disposed, calling csoundDestroy() etc..

Then the host app creates a neew RTCsoundInstrument and loading the one he discovered, 
here, everything is wrong, truncation of values, FTABLE prints two sinewaves instead of saw
and pulse etc..


So i believe this is about multi instances of CSOUND which missbehaves, as i understand
csoundInitialize() is created in the first call to csoundCreate() which happens on an object
which is then destroyed is this a problem ?

I tried call csoundInitialize() in my main() but no changes.

 



2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Can you try with sound, replacing ampmidi? That could be a printing issue.

Victor

On 12 May 2013, at 17:10, Henrik Andersson wrote:

i already did earlier in this thread..

printi 10000*0.5

shows 0.0




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input

On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2013-05-12 18:25
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Yea i have recreated the code i use in my host to a smaller application and i got no problems either..


2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
I've tested this code and it runs as expected.

int main(int argc, char **argv){
  MYFLT *aout;
  CSOUND *cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  csoundDestroy(cs);

  cs = csoundCreate(NULL);
  csoundSetRTAudioModule(cs, "null");
  csoundSetOption(cs, "-odac");
  csoundSetHostImplementedAudioIO(cs, 1, 0);
  csoundCompile(cs, argc, argv);
  aout = csoundGetSpout(cs);
  while(csoundPerformKsmps(cs)==0)
  {
    int i;
    for(i = 0; i < csoundGetKsmps(cs); i++)
     printf("%f\n", aout[i]);
  }
  csoundDestroy(cs);
  return 0;
}

On 12 May 2013, at 17:34, Henrik Andersson wrote:

In my host app code i get channel hints and process them which also is truncated...

and the ftable output is invalid, showing two sinewaves instead of saw and pulse :/

Here is my code logic:

First a RTCsoundInstrument is created in a discovery processing logic which enumerates
available insturments, which in my case is only one, here everything is fine values are not
truncated and Ftable output looks all good.

After this discover process the RTCsoundInstrument is disposed, calling csoundDestroy() etc..

Then the host app creates a neew RTCsoundInstrument and loading the one he discovered, 
here, everything is wrong, truncation of values, FTABLE prints two sinewaves instead of saw
and pulse etc..


So i believe this is about multi instances of CSOUND which missbehaves, as i understand
csoundInitialize() is created in the first call to csoundCreate() which happens on an object
which is then destroyed is this a problem ?

I tried call csoundInitialize() in my main() but no changes.

 



2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
Can you try with sound, replacing ampmidi? That could be a printing issue.

Victor

On 12 May 2013, at 17:10, Henrik Andersson wrote:

i already did earlier in this thread..

printi 10000*0.5

shows 0.0




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
can you try setting ivel to 0.5 (commenting out ampmidi?) That will indicate something wrong with the MIDI input

On 12 May 2013, at 17:03, Henrik Andersson wrote:

ivel is a the variable in csd from ampmidi

ivel  ampmidi 1
aout   oscil 10000*ivel ....


aout will always be 0 because ivel is either 0 or 1.




2013/5/12 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
and ivel is coming from where? MIDI? Bus channels? That might be where the truncation is happening.

On 12 May 2013, at 14:08, Henrik Andersson wrote:

> The audio problem i have is not to the "porcessing" logic, if i set 0dbs to 32765 and set
> oscil amp to 10000 it all sounds good.. until is use 10000*ivel where ivel is a scale 0->1
> which is always truncated to 0 value within csound computing, printi 10000*0.5  always shows value 0.0.
> as do printi 10000*ivel.

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-12 18:28
FromRory Walsh
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsMulitInstance.cpp  test1.csd  test2.csd  test3.csd  None  None  
Here's a simple C++ test that should show there are no problems
running multiple instances of Csound, so your problem is likely
somewhere else.

Date2013-05-12 18:36
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Thats clean and simple, but in my case, i use alot of csound api that could trigger a bug..


2013/5/12 Rory Walsh <rorywalsh@ear.ie>
Here's a simple C++ test that should show there are no problems
running multiple instances of Csound, so your problem is likely
somewhere else.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel



Date2013-05-12 18:53
FromRory Walsh
SubjectRe: [Cs-dev] Audio samples into host
That's what's making it hard to fix!



On 12 May 2013 18:36, Henrik Andersson  wrote:
> Thats clean and simple, but in my case, i use alot of csound api that could
> trigger a bug..
>
>
> 2013/5/12 Rory Walsh 
>>
>> Here's a simple C++ test that should show there are no problems
>> running multiple instances of Csound, so your problem is likely
>> somewhere else.
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-12 19:19
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Im lost, accidentally i stumble upon the offending line:

csoundSetHostImplementedAudioIO(self->priv->csound, 1, 0);

with this set, the values are truncated without it, values are ok,

so how does this affect csoundCompile()

Henrik



2013/5/12 Rory Walsh <rorywalsh@ear.ie>
That's what's making it hard to fix!



On 12 May 2013 18:36, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Thats clean and simple, but in my case, i use alot of csound api that could
> trigger a bug..
>
>
> 2013/5/12 Rory Walsh <rorywalsh@ear.ie>
>>
>> Here's a simple C++ test that should show there are no problems
>> running multiple instances of Csound, so your problem is likely
>> somewhere else.
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-12 19:23
FromRory Walsh
SubjectRe: [Cs-dev] Audio samples into host
I've no idea, none of my frontends ever call csoundSetHostImplementedAudioIO().

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-12 20:44
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Finally i found source to this annoying bug, its really a itching one.. 

Its all about locale in my host application;

between the 2 csound instances which is created the locale are changed, starts with locale "C" and while loading some
plugins dssi/ladspa which is kind to set the locale for me specially LC_NUMERIC=sv_SE.utf-8 which will change floating
point sep "." to "," :) and here begins the fun with csound.

easily reproducable by setting locale setlocale(LC_NUMERIC,"se_SV.utf-8") between two csoundCreate()


/Henrik



2013/5/12 Rory Walsh <rorywalsh@ear.ie>
I've no idea, none of my frontends ever call csoundSetHostImplementedAudioIO().

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-12 21:05
FromRory Walsh
SubjectRe: [Cs-dev] Audio samples into host
This is all above my head, but I'm glad you found the problem!

On 12 May 2013 20:44, Henrik Andersson  wrote:
> Finally i found source to this annoying bug, its really a itching one..
>
> Its all about locale in my host application;
>
> between the 2 csound instances which is created the locale are changed,
> starts with locale "C" and while loading some
> plugins dssi/ladspa which is kind to set the locale for me specially
> LC_NUMERIC=sv_SE.utf-8 which will change floating
> point sep "." to "," :) and here begins the fun with csound.
>
> easily reproducable by setting locale setlocale(LC_NUMERIC,"se_SV.utf-8")
> between two csoundCreate()
>
>
> /Henrik
>
>
>
> 2013/5/12 Rory Walsh 
>>
>> I've no idea, none of my frontends ever call
>> csoundSetHostImplementedAudioIO().
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-05-12 22:07
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
This is a online fix to csound, ill fix a pullrequest if i have SF on my side this time..


2013/5/12 Rory Walsh <rorywalsh@ear.ie>
This is all above my head, but I'm glad you found the problem!

On 12 May 2013 20:44, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Finally i found source to this annoying bug, its really a itching one..
>
> Its all about locale in my host application;
>
> between the 2 csound instances which is created the locale are changed,
> starts with locale "C" and while loading some
> plugins dssi/ladspa which is kind to set the locale for me specially
> LC_NUMERIC=sv_SE.utf-8 which will change floating
> point sep "." to "," :) and here begins the fun with csound.
>
> easily reproducable by setting locale setlocale(LC_NUMERIC,"se_SV.utf-8")
> between two csoundCreate()
>
>
> /Henrik
>
>
>
> 2013/5/12 Rory Walsh <rorywalsh@ear.ie>
>>
>> I've no idea, none of my frontends ever call
>> csoundSetHostImplementedAudioIO().
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Date2013-05-12 22:32
FromHenrik Andersson
SubjectRe: [Cs-dev] Audio samples into host
AttachmentsNone  None  
Finally i got the repo in sync and update, a new merge request is created (#5) which
includes 2 fixes.

Merge request 4 can be closed.

/H


2013/5/12 Henrik Andersson <henrik.4e@gmail.com>
This is a online fix to csound, ill fix a pullrequest if i have SF on my side this time..


2013/5/12 Rory Walsh <rorywalsh@ear.ie>
This is all above my head, but I'm glad you found the problem!

On 12 May 2013 20:44, Henrik Andersson <henrik.4e@gmail.com> wrote:
> Finally i found source to this annoying bug, its really a itching one..
>
> Its all about locale in my host application;
>
> between the 2 csound instances which is created the locale are changed,
> starts with locale "C" and while loading some
> plugins dssi/ladspa which is kind to set the locale for me specially
> LC_NUMERIC=sv_SE.utf-8 which will change floating
> point sep "." to "," :) and here begins the fun with csound.
>
> easily reproducable by setting locale setlocale(LC_NUMERIC,"se_SV.utf-8")
> between two csoundCreate()
>
>
> /Henrik
>
>
>
> 2013/5/12 Rory Walsh <rorywalsh@ear.ie>
>>
>> I've no idea, none of my frontends ever call
>> csoundSetHostImplementedAudioIO().
>>
>>
>> ------------------------------------------------------------------------------
>> Learn Graph Databases - Download FREE O'Reilly Book
>> "Graph Databases" is the definitive new guide to graph databases and
>> their applications. This 200-page book is written by three acclaimed
>> leaders in the field. The early access version is available now.
>> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel