LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer/Consumer Multi-Microphone Capturing

Solved!
Go to solution

I was getting buffer overflow problems when I foolishly used multiple "Capture Sound" Express VIs to listen to several mics and process them. 

 

I then created a producer/consumer structure where I produced 2 signals (2 producer loops) and processed them in 1 loop. It worked great!

 

I expanded this idea today to 3 microphones (and hoped for more later). Trouble is I'm getting errors again. I can't quite explain the errors, so I've attached images (in sequence). By highlighting execution, it seemed the error happens on the SECOND iteration of the "Sound Input Read" in each of the 3 "Producer" loops.

 

 

I hope someone can shed light on this issue. Seems strange that it would work for 2 mics but not for 3.

 

I briefly tried playing with the sampling rates with no apparent results.  

 

 

 

Message Edited by ap8888 on 03-17-2010 07:43 PM
0 Kudos
Message 1 of 7
(3,511 Views)
0 Kudos
Message 2 of 7
(3,508 Views)

Now the strangest thing happened! It worked fine for about 5 seconds. After which I was tempted to stop and start again to see if it would work. Only to get the following error:

 

greenshot_2010-03-17_21-40-44.jpg 

Could it be that there is some buffer that's getting cleared once in a while and allows the program to run for only some time before producing another error? 

0 Kudos
Message 3 of 7
(3,495 Views)

I now think it's because the peak detector doesn't have enough samples in the first cycle. Therefore it causes the error. If you agree this is the error, how could I prevent this from happening? I tried adding a delay in the consumer loop, but I don't think that's the proper way of fixing this problem. 

Message Edited by ap8888 on 03-17-2010 10:30 PM
Message Edited by ap8888 on 03-17-2010 10:32 PM
0 Kudos
Message 4 of 7
(3,478 Views)

Could anyone shed some light?

 

The problem persists. 

0 Kudos
Message 5 of 7
(3,449 Views)

Hi ap,

 

You can use the First Call VI to tell whether a section of code has been run yet.

Stephen Meserve
National Instruments
Message 6 of 7
(3,429 Views)
Solution
Accepted by topic author ap8888
Try doubling the number of samples going into the configure VI while leaving the number of points going into the read VI the same.  The configure VI sets the buffer size.  The read VI input sets how many points are read at each iteration.  The buffer should always be bigger than the number of points read so the computer has time between the buffer having enough points to read and the actual read to not overflow (which appears to be your problem).  Adding another input added more processing burden, so servicing the reads is now not occurring fast enough (the computer has less than a single sample period to respond to prevent an overflow).  I have made this mistake myself more than once.
Message 7 of 7
(3,410 Views)