Csound Csound-dev Csound-tekno Search About

Re: [Cs-dev] tests today

Date2007-08-26 09:06
FromVictor Lazzarini
SubjectRe: [Cs-dev] tests today
But how come you mentioned using the portaudio module?

In any case, with multiple instances you can either
implement your own output as you did or have a csound
'mixer' instance that would collect the signal from all
the existing instances, possibly add some global
effects and then use the rtalsa module.

Victor

>
> Right - I know about the rtaudio modules.  I'm mixing
> multiple   instances of Csound in my server.  I wasn't
> sure if you were   suggesting that I use the API somehow.
> If I was just using one   instance, I could pass that in
> with the command line settings to the   instance, but
> since I'm using multiple instances I can't imagine how
> it could be done
>
> OR  if you're suggesting I rip the code out of rtalsa.c,
> that might   work, but I have a working version now ..
> seems to be mildly   efficient, so ... I'll post a link to
> the code as soon as the git   repo starts behaving.
>
> greg
>
>
> On Aug 25, 2007, at 6:06 PM, Victor Lazzarini wrote:
>
> > what I am saying is that on Linux there are two
> > output modules, portaudio (default) and alsa; if you run
> > csound with -+rtaudio=alsa you will use the alsa
> > module. The code for the latter is in InOut/rtalsa.c
> > and is pretty efficient IMHO.
> >
> > Victgor
> >
> >>
> >> Sorry about that - the message wasn't meant to go to
> the >> list. :(
> >>
> >> The ALSA specific code was written to circumvent the
> need >> for   PortAudio.  You're saying there's an easy
> way to >> access the methods   for using ALSA via the API
> without >> using a Csound Instance?  (I'm   summing a
> group of >> instances and sending that summed set of
> samples   out to >> the DAC)
> >>
> >> greg
> >>
> >> On Aug 25, 2007, at 2:01 PM, Victor Lazzarini wrote:
> >>
> >>> But what about Istvan's alsa module; we were never
> >>> dependent on portaudio, in fact I never use portaudio
> >>> on Linux; Istvan's module is way faster.
> >>> Isn't this a bit of reinventing-wheel kind of thing?
> >>>
> >>> Victor
> >>>>
> >>>>
> >>>> So last night and this morning I wrote a simple ALSA
> >>>> specific audio I/  O module for the server.  I think
> >> its a >> bit of a speed improvement,   but mainly it
> means >> we're >> not dependent on PortAudio for the XO
> which   is >> a problem >> because they haven't updated to
> the latest >> port audio >> release which means none of my
> code can be >> built (easily) >> on the XO   without
> manually installing >> portaudio.  Now my >> server should
> be   compile-able on >> any XO with the >> following
> command and assuming they >> have my sources in a >>
> folder (and gcc and >> alsa-lib-devel.i386 yum
> installed): >> >>>> gcc main.c -o csoundserver -I
> /include -I/usr/include/ >>>> -I/usr/  include/csound/
> -DLINUX -lm ./src/*.c >>>> /src/Sequencer/*.c -lasound  /
> >> usr/lib/libcsound.so.5.1 >> /usr/lib/libsndfile.so.1
> >>>>
> >>>> Anyway - Ive been running a few more tests .. I have
> >> the >> 16k   "02GMGSBank1.sf2" fluid example running
> >> beet5.mid >> and it does pretty   well most of the time
> - >> but it >> definitely hits sections of the piece
> that >> spike the cpu >> to 100% which does cause
> occasional >> dropouts. >>
> >>>> My new code will be posted up on the dev.laptop.org
> >> site >> by the end   of the day.  So we can at least
> >> inform the >> TamTam group about it and   maybe they
> can >> even install >> and test the server.
> >>>>
> >>>> greg
> >>>>
> >>>>
> >>>>
> >>
> ----------------------------------------------------------
> >>>> --------------- This SF.net email is sponsored by: >>
> Splunk >> Inc. Still grepping through log files to find >>
> problems? >> Stop. Now Search log events and configuration
> >> files using >> AJAX and a browser. Download your FREE
> copy >> of Splunk now >>>>  http://get.splunk.com/
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Csound-devel mailing list
> >>>> Csound-devel@lists.sourceforge.net
> >>>>
> >>
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >>>>> >>>
> >>
> ----------------------------------------------------------
> >>> ------------  --- >>> This SF.net email is sponsored
> by: Splunk Inc. >>> Still grepping through log files to
> find problems? >>> Stop. Now Search log events and
> configuration files >>> using AJAX and a   browser.
> >>> Download your FREE copy of Splunk now >>
> >>> http://get.splunk.com/
> >>> _______________________________________________
> >>> Csound-devel mailing list
> >>> Csound-devel@lists.sourceforge.net
> >>
> https://lists.sourceforge.net/lists/listinfo/csound-devel
> >>> >>
> >
>
>
> ----------------------------------------------------------
> --------------- This SF.net email is sponsored by: Splunk
> Inc. Still grepping through log files to find problems?
> Stop. Now Search log events and configuration files using
> AJAX and a browser. Download your FREE copy of Splunk now
> >>  http://get.splunk.com/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2007-08-30 22:08
FromGreg Thompson
Subject[Cs-dev] API and audio input
AttachmentsNone  None  
So - I'm trying to write audio input into an instance with:


                inputBuffer = csoundGetInputBuffer(instance->csound);
                inBufferSize = csoundGetInputBufferSize(instance->csound);
memcpy(inputBuffer, AudioIO_inputBuffer(instances->audioIO), inBufferSize * sizeof(float));

I should also point out I use the following to initialize the instance - namely csoundSetHostImplementedAudioIO:


    csoundSetMessageCallback(instance->csound, csoundMessageHandler);

    csoundPreCompile(instance->csound);
    csoundSetMessageLevel(instance->csound, 0);
    csoundSetIsGraphable(instance->csound, 1); // uses ascii graph
    csoundSetHostImplementedAudioIO(instance->csound, 1, instance->periodSize);    

    csoundSetChannelIOCallback(instance->csound, channelCallback);
    csoundSetOutputValueCallback(instance->csound, outValueCallback);


//    csoundSetExternalMidiInOpenCallback(instance->csound, midiInOpen);
    csoundSetExternalMidiReadCallback(instance->csound, midiInRead);
//    csoundSetExternalMidiInCloseCallback(instance->csound, midiInClose);

    result = csoundCompile(instance->csound, argc, argv);



On my mac book pro - this works fine

    nchnls = 2
instr 1

    aIn1, aIn2        ins     
            outs aIn1, aIn2
endin

But on the XO - it get what sounds like a static buffer .. I've proven to myself that sound does come in on the XO from the mic and I can write it out to the DAC .. but when I try to run it through Csound like this - it does not.

Is there anything else I should know about this mechanism that might help me understand why?  BTW - I do not use command line flag for -i or anything.

Something even crazier:   
If I do this instead of the memcpy - I hear the noise on the XO!  I'm trying it now with a periodic signal to see what's going on.
                for(z = 0; z < inBufferSize; z++) {
                    float v;
                    v = ((float)(rand() % RAND_MAX) / (float)RAND_MAX) * 2.0 - 1.0;
                    inputBuffer[z] = v;
                }


greg


Date2007-08-30 22:15
FromGreg Thompson
SubjectRe: [Cs-dev] API and audio input
AttachmentsNone  None  
Ok - I dont know why - but - I figured - what else could be wrong other than memcpy itself!

                audioIn = AudioIO_inputBuffer(instances->audioIO);                
                for(z = 0; z < inBufferSize; z++) inputBuffer[z] = audioIn[z];


Works  ... oh well

greg


On Aug 30, 2007, at 5:08 PM, Greg Thompson wrote:

So - I'm trying to write audio input into an instance with:


                inputBuffer = csoundGetInputBuffer(instance->csound);
                inBufferSize = csoundGetInputBufferSize(instance->csound);
memcpy(inputBuffer, AudioIO_inputBuffer(instances->audioIO), inBufferSize * sizeof(float));

I should also point out I use the following to initialize the instance - namely csoundSetHostImplementedAudioIO:


    csoundSetMessageCallback(instance->csound, csoundMessageHandler);

    csoundPreCompile(instance->csound);
    csoundSetMessageLevel(instance->csound, 0);
    csoundSetIsGraphable(instance->csound, 1); // uses ascii graph
    csoundSetHostImplementedAudioIO(instance->csound, 1, instance->periodSize);    

    csoundSetChannelIOCallback(instance->csound, channelCallback);
    csoundSetOutputValueCallback(instance->csound, outValueCallback);


//    csoundSetExternalMidiInOpenCallback(instance->csound, midiInOpen);
    csoundSetExternalMidiReadCallback(instance->csound, midiInRead);
//    csoundSetExternalMidiInCloseCallback(instance->csound, midiInClose);

    result = csoundCompile(instance->csound, argc, argv);



On my mac book pro - this works fine

    nchnls = 2
instr 1

    aIn1, aIn2        ins     
            outs aIn1, aIn2
endin

But on the XO - it get what sounds like a static buffer .. I've proven to myself that sound does come in on the XO from the mic and I can write it out to the DAC .. but when I try to run it through Csound like this - it does not.

Is there anything else I should know about this mechanism that might help me understand why?  BTW - I do not use command line flag for -i or anything.

Something even crazier:   
If I do this instead of the memcpy - I hear the noise on the XO!  I'm trying it now with a periodic signal to see what's going on.
                for(z = 0; z < inBufferSize; z++) {
                    float v;
                    v = ((float)(rand() % RAND_MAX) / (float)RAND_MAX) * 2.0 - 1.0;
                    inputBuffer[z] = v;
                }


greg

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Csound-devel mailing list


Date2007-08-30 22:25
FromGreg Thompson
SubjectRe: [Cs-dev] API and audio input
AttachmentsNone  None  
Nevermind - I didn't manage the control of my experiment...  I'm pretty sure it's fout that has been the problem on the laptop - not memcpy :)

Maybe Victor's new changes to fout will solve this problem - so I will attempt to upgrade.

greg

instr 1
    aIn1, aIn2        ins     
                fout    "/home/olpc/Activities/CSRecorderActivity.activity/out.aif", 4, aIn2
    outs aIn1, aIn2

    

endin    

On Aug 30, 2007, at 5:15 PM, Greg Thompson wrote:

Ok - I dont know why - but - I figured - what else could be wrong other than memcpy itself!

                audioIn = AudioIO_inputBuffer(instances->audioIO);                
                for(z = 0; z < inBufferSize; z++) inputBuffer[z] = audioIn[z];


Works  ... oh well

greg


On Aug 30, 2007, at 5:08 PM, Greg Thompson wrote:

So - I'm trying to write audio input into an instance with:


                inputBuffer = csoundGetInputBuffer(instance->csound);
                inBufferSize = csoundGetInputBufferSize(instance->csound);
memcpy(inputBuffer, AudioIO_inputBuffer(instances->audioIO), inBufferSize * sizeof(float));

I should also point out I use the following to initialize the instance - namely csoundSetHostImplementedAudioIO:


    csoundSetMessageCallback(instance->csound, csoundMessageHandler);

    csoundPreCompile(instance->csound);
    csoundSetMessageLevel(instance->csound, 0);
    csoundSetIsGraphable(instance->csound, 1); // uses ascii graph
    csoundSetHostImplementedAudioIO(instance->csound, 1, instance->periodSize);    

    csoundSetChannelIOCallback(instance->csound, channelCallback);
    csoundSetOutputValueCallback(instance->csound, outValueCallback);


//    csoundSetExternalMidiInOpenCallback(instance->csound, midiInOpen);
    csoundSetExternalMidiReadCallback(instance->csound, midiInRead);
//    csoundSetExternalMidiInCloseCallback(instance->csound, midiInClose);

    result = csoundCompile(instance->csound, argc, argv);



On my mac book pro - this works fine

    nchnls = 2
instr 1

    aIn1, aIn2        ins     
            outs aIn1, aIn2
endin

But on the XO - it get what sounds like a static buffer .. I've proven to myself that sound does come in on the XO from the mic and I can write it out to the DAC .. but when I try to run it through Csound like this - it does not.

Is there anything else I should know about this mechanism that might help me understand why?  BTW - I do not use command line flag for -i or anything.

Something even crazier:   
If I do this instead of the memcpy - I hear the noise on the XO!  I'm trying it now with a periodic signal to see what's going on.
                for(z = 0; z < inBufferSize; z++) {
                    float v;
                    v = ((float)(rand() % RAND_MAX) / (float)RAND_MAX) * 2.0 - 1.0;
                    inputBuffer[z] = v;
                }


greg

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Csound-devel mailing list

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Csound-devel mailing list


Date2007-08-30 22:36
FromGreg Thompson
SubjectRe: [Cs-dev] API and audio input
AttachmentsNone  None  
Well - I believe I installed the RPMs and have the new version - when it runs it says : Csound version 5.06 beta (float samples) Aug 30 2007 - so I guess it has the new fout code ..

Unfortunately - I just get that static buffer sound when I do this and that's all fout records ..  So this must be a OS specific problem .. Haven't looked at the fout code yet - but I will shortly to see if I can come up with a theory about why it doesn't work. ;( 

greg


On Aug 30, 2007, at 5:25 PM, Greg Thompson wrote:

Nevermind - I didn't manage the control of my experiment...  I'm pretty sure it's fout that has been the problem on the laptop - not memcpy :)

Maybe Victor's new changes to fout will solve this problem - so I will attempt to upgrade.

greg

instr 1
    aIn1, aIn2        ins     
                fout    "/home/olpc/Activities/CSRecorderActivity.activity/out.aif", 4, aIn2
    outs aIn1, aIn2
    
endin    

On Aug 30, 2007, at 5:15 PM, Greg Thompson wrote:

Ok - I dont know why - but - I figured - what else could be wrong other than memcpy itself!

                audioIn = AudioIO_inputBuffer(instances->audioIO);                
                for(z = 0; z < inBufferSize; z++) inputBuffer[z] = audioIn[z];


Works  ... oh well

greg


On Aug 30, 2007, at 5:08 PM, Greg Thompson wrote:

So - I'm trying to write audio input into an instance with:


                inputBuffer = csoundGetInputBuffer(instance->csound);
                inBufferSize = csoundGetInputBufferSize(instance->csound);
memcpy(inputBuffer, AudioIO_inputBuffer(instances->audioIO), inBufferSize * sizeof(float));

I should also point out I use the following to initialize the instance - namely csoundSetHostImplementedAudioIO:


    csoundSetMessageCallback(instance->csound, csoundMessageHandler);

    csoundPreCompile(instance->csound);
    csoundSetMessageLevel(instance->csound, 0);
    csoundSetIsGraphable(instance->csound, 1); // uses ascii graph
    csoundSetHostImplementedAudioIO(instance->csound, 1, instance->periodSize);    

    csoundSetChannelIOCallback(instance->csound, channelCallback);
    csoundSetOutputValueCallback(instance->csound, outValueCallback);


//    csoundSetExternalMidiInOpenCallback(instance->csound, midiInOpen);
    csoundSetExternalMidiReadCallback(instance->csound, midiInRead);
//    csoundSetExternalMidiInCloseCallback(instance->csound, midiInClose);

    result = csoundCompile(instance->csound, argc, argv);



On my mac book pro - this works fine

    nchnls = 2
instr 1

    aIn1, aIn2        ins     
            outs aIn1, aIn2
endin

But on the XO - it get what sounds like a static buffer .. I've proven to myself that sound does come in on the XO from the mic and I can write it out to the DAC .. but when I try to run it through Csound like this - it does not.

Is there anything else I should know about this mechanism that might help me understand why?  BTW - I do not use command line flag for -i or anything.

Something even crazier:   
If I do this instead of the memcpy - I hear the noise on the XO!  I'm trying it now with a periodic signal to see what's going on.
                for(z = 0; z < inBufferSize; z++) {
                    float v;
                    v = ((float)(rand() % RAND_MAX) / (float)RAND_MAX) * 2.0 - 1.0;
                    inputBuffer[z] = v;
                }


greg

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Csound-devel mailing list

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Csound-devel mailing list

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Csound-devel mailing list


Date2007-08-31 10:04
FromVictor Lazzarini
SubjectRe: [Cs-dev] API and audio input
Fout will print a message when the file is closed. If it does not print it, 
then
it's not closed.

Also if you are using the input or output buffers, make sure you use
csoundPerformBuffer() instead of csoundPerformKsmps(), because
the first one will fill/consume the whole buffer, whereas the second
will not.

Victor

At 22:36 30/08/2007, you wrote:
>Well - I believe I installed the RPMs and have the new version - when it 
>runs it says : Csound version 5.06 beta (float samples) Aug 30 2007 - so I 
>guess it has the new fout code ..
>
>Unfortunately - I just get that static buffer sound when I do this and 
>that's all fout records ..  So this must be a OS specific problem .. 
>Haven't looked at the fout code yet - but I will shortly to see if I can 
>come up with a theory about why it doesn't work. ;(
>
>greg
>
>
>On Aug 30, 2007, at 5:25 PM, Greg Thompson wrote:
>
>>Nevermind - I didn't manage the control of my experiment...  I'm pretty 
>>sure it's fout that has been the problem on the laptop - not memcpy :)
>>
>>Maybe Victor's new changes to fout will solve this problem - so I will 
>>attempt to upgrade.
>>
>>greg
>>
>>instr 1
>>     aIn1, aIn2        ins
>>ins
>>             outs aIn1, aIn2
>>endin
>>
>>But on the XO - it get what sounds like a static buffer .. I've proven to 
>>myself that sound does come in on the XO from the mic and I can write it 
>>out to the DAC .. but when I try to run it through Csound like this - it 
>>do s not.
>>
>>Is there anything else I should know about this mechanism that might help 
>>me understand why?  BTW - I do not use command line flag for -i or anything.
>>
>>Something even crazier:
>>If I do this instead of the memcpy - I hear the noise on the XO!  I'm 
>>trying it now with a periodic signal to see what's going on.
>>                 for(z = 0; z < inBufferSize; z++) {
>>                     float v;
>>                     v = ((float)(rand() % RAND_MAX) / (float)RAND_MAX) * 
>> 2.0 - 1.0;
>>                     inputBuffer[z] = v;
>>                 }
>>
>>
>>< IV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; 
>>margin-left: 0px; ">greg
>>
>>-------------------------------------------------------------------------
>>This SF.net email is sponsored by: Splunk Inc.
>>Still grepping through log files to find problems?  Stop.
>>Now Search log events and configuration files using AJAX and a browser.
>>Download your FREE copy of Splunk now > 
>>gt; 
>>http://get.splunk.com/_______________________________________________
>>Csound-devel mailing list
>>Csound-devel@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems?  Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk 
>now >> 
>http://get.splunk.com/_______________________________________________
>Csound-devel mailing list
>Csound-devel@lists. ourceforge.net
>https://lists.sourceforge.net/lists/listinfo/csound-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk 
now >> 
http://get.splunk.com/_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/csound-devel


Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net