[Stk] peaks in sin wave

Gary Scavone gary at ccrma.Stanford.EDU
Thu Jan 22 07:25:20 PST 2009


Hi Stefanie,

You probably should not be using the RtWvIn class for an application  
that needs to be absolutely robust and run for many days or weeks.   
Rather, you should work directly with the RtAudio class and read your  
audio data via a callback.

The RtWvIn class attempts to put a "blocking" front-end on top of  
RtAudio, using a large internal buffer.  It is not robust.

Regards,

--gary

On 20-Jan-09, at 12:02 PM, Stephen Sinclair wrote:

> Stefanie,
>
> Once in a while an operating system will interrupt processes because
> things like disk activity need to take place, or a number of other
> things.  Linux is not a "hard real-time" system, so these interrupts
> can be expected.  One solution is to try running your app with
> "real-time" priority.  You can set the priority to SCHED_FIFO and
> hopefully the timing behaviour will be more deterministic.  You need
> to run as 'sudo' to get this priority.
>
> Anyways, it's worth a try.  Check the "What to do" section of this
> article for info on how to set thread priority:
>
> http://www.linuxdevices.com/articles/AT5997007602.html
>
> Another thing you might try is using JACK instead, and running JACK at
> real-time priority.  (Which is as simple as an option in QJackCtl)
>
> Steve
>
>
> On Tue, Jan 20, 2009 at 10:47 AM,  <steffi at hoxel.org> wrote:
>> Hallo,
>>
>> I have the following problem.
>> I record a 50Hz sin wave from an USB soundcard with RtWvIn in a wav
>> file. Sometimes I get small peaks in the file, which come not from my
>> input wave.
>> When the sin has positive gradient the peaks are negative and when  
>> the
>> sin has negative gradient the peaks are positive.
>> For some reason the distance between those peaks equals the "period
>> length" or multiple of that. With "period length" I mean the value I
>> give to
>> RtWvIn :: RtWvIn( unsigned int nChannels, StkFloat sampleRate, int
>> device, int          bufferFrames, int nBuffers )
>> in the variable "bufferFrames".
>> Sometimes my program runs three days without those peaks and then  
>> they
>> appear for 20 minutes or something.
>> On an eee-pc with debian and ALSA version 1.0.16. this peaks appear
>> quite often, while I have not seen them on my laptop with debian and
>> ALSA version 1.0.12rc1.
>>
>> Do you have any ideas?
>> Thank you, Stefanie Schmidt
>>
>>
>> _______________________________________________
>> Stk mailing list
>> Stk at ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
>>
>>
>>
>
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk



More information about the Stk mailing list