LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound Card as an analog input for LV5.1: How to avoid the overwriting error? Simple increasing the input buffer size (as it recommended) is not helps in 100% of cases.

For data acquisition via sound card LV utilised Windows drivers. But in Win sound card has no higher priority as I guess, so if Win decides to do his own internal tasks, LV slowed down and has not enough time to read and treat all Sound input buffer and it is owerwrited. That leads to "Device Engaged" error and NAN on input until VI (or even all LV) shutted down (SIclear.vi is not helps). But I need to read the data for an hours as reliable as with real ADC. Is it possible to change the Sound Card priority in Windows by LV tools? Or: Is any way to clear sound input programmatically after "o
werwrite" reported?

Best regards,
Stas
0 Kudos
Message 1 of 5
(3,462 Views)
Hello Stas,
Well, I would be doing you a real disservice if I did not say, "Buy a real DAQ board!" You can get a 6023 for about 400 US.
So, if you asolutly have to use this sound card you can change the priority of the VI by going into the VI properties and execution. Then raise the priority one level at a time. I would not go to highest because you could block out the rest of your computer. I hope this helps,
Doug
0 Kudos
Message 2 of 5
(3,461 Views)
Hi Stas,

I am having the same problems with collection and processing of data from
sound cards. I do have a solution, which is to implement a double buffered
system, I haven't had the chance to implement yet but it should work.

To implement a double buffered system another buffer or queue is needed to
pass data out of a independently running VI. This VI just collects the
data from the sound card and puts it in the queue (you can play with
priorities with this VI). The rest of the software that does the
processing dequeues the data as it appears and displays the results etc.
No 'wait for ...' elements are needed since the loop for collecting data
will wait until the sound card vi returns and the processing loop will
wait for the queue or the processing to f
inish.

Hope this give you an idea on how to fix your problem.
Let me know how it goes.

Tim

Stas wrote:

> Sound Card as an analog input for LV5.1: How to avoid the overwriting
> error? Simple increasing the input buffer size (as it recommended) is
> not helps in 100% of cases.
>
> For data acquisition via sound card LV utilised Windows drivers. But
> in Win sound card has no higher priority as I guess, so if Win decides
> to do his own internal tasks, LV slowed down and has not enough time
> to read and treat all Sound input buffer and it is owerwrited. That
> leads to "Device Engaged" error and NAN on input until VI (or even all
> LV) shutted down (SIclear.vi is not helps). But I need to read the
> data for an hours as reliable as with real ADC. Is it possible to
> change the Sound Card priority in Windows by LV tools? Or: Is any way
> to clear sound input programmatically after "owerwrite" reported?
>
> Best regards,
> Stas
0 Kudos
Message 3 of 5
(3,461 Views)
Hi, Tim,

I tried the way you suggested, but it is not work in my case. Queue can operate with a string only and can put in a queue and take only one element a time. But I have an array of 2x25000 points every 2 sec and need to put it into buffer and then take all of them. May be it is possible by Write To File and Read From File? Currently I use immediate restart SI Initialise if the SI Read shows zero array. It helps in 90% of oferwriting cases, but still not in 100%

Anyhow, thank you for reply!
Stas
0 Kudos
Message 4 of 5
(3,461 Views)
Hi Stas,

You can convert your whole 2x25000 point array to a string, using 'flatten
to string' function, and put that in the queue and then retrieve from
queue using 'unflatten from string'.

What I would recommend thought is retrieve the data, from the sound card,
as five 2x5000 point segments and put it in the queue 5 times and then
retrieve from the queue 5 times. As long as you are not starting and
stopping the sound card in between each read you won't lose any data.

Also keep the data as integers while storing it in the queue and only
convert when needed. This will save time and memory in the queue.

Tim

Stas wrote:

> Hi, Tim,
>
> I tried the way you suggested, but it is not work in my case. Queue
> can operate with a string only an
d can put in a queue and take only
> one element a time. But I have an array of 2x25000 points every 2 sec
> and need to put it into buffer and then take all of them. May be it is
> possible by Write To File and Read From File? Currently I use
> immediate restart SI Initialise if the SI Read shows zero array. It
> helps in 90% of oferwriting cases, but still not in 100%
>
> Anyhow, thank you for reply!
> Stas
0 Kudos
Message 5 of 5
(3,461 Views)