02-19-2014 09:55 AM
Hello there!
How can I change the number of samples/ch from a microphone? I need my wave to be acquired and monotorized in real time.
Thanks!
02-19-2014 10:14 AM
How are you acquiring the signal now? DAQmx? Sound Input VIs?
I'll assume you are using the Sound Input VIs. I would recommend setting the Sample Mode to Continous Samples. Then there is an input for the Sound Input Read.vi for the number of samples to read.
02-19-2014 10:20 AM
I was doing that. But every time I change the number of samples, the signal takes too long to acquire. My goal is too show the wave in real time. Every time a person talks the wave shows and we don't have to wait almost 6s to see it.
02-19-2014 10:25 AM
Can you share your code? I have a feeling this is a case of not getting the samples fast enough and you are just getting old data out of the buffer.
02-19-2014 10:28 AM
@anariodrigues wrote:
I was doing that. But every time I change the number of samples, the signal takes too long to acquire. My goal is too show the wave in real time. Every time a person talks the wave shows and we don't have to wait almost 6s to see it.
If you increase the "number of samples" then you'll be acquiring more data and therefore it will take longer. If you want to show the data in real time, like an oscilloscope, then you need to be acquiring small amounts of data, and repeat that in a loop many times a second.
02-19-2014 10:30 AM
I'm trying to program something to, first, to show how does the sound wave varies. Then, if a sound is bigger than the max of that sound wave, it triggers a force resistence sensor to read a voltage (not yet implemented). For that, I need to show a real time wave.
Thanks!
02-19-2014 10:38 AM - edited 02-19-2014 10:39 AM
Sometimes it's better to post code, rather than a snapshot, so we can assist by modifying it directly.
Firstly, can I recommend you replace the Graph with a Chart, which will automatically concatenate your data for you without needing to Array Insert function, plus it will only store a certain amount of data and thus doesn't require endless RAM if the code runs for a long time. This also means you lose the uninitialised shift register (not helpful here).
Secondly, there's no reason (looking briefly at this code) why it shouldn't work for you. Can you describe what the symptoms of your problem are? Do you get an error code? So long as the "number of samples/Ch" is small this should execute fairly quickly for you.
02-19-2014 10:39 AM
Start the sound task before the While loop. That way you will be constantly acquiring the data and when you read you will get the number of samples you need. The way you are set up, the task has to start each time you try to do a read. You should also stop the task after the While loop before clearing it.
02-19-2014 10:48 AM
OK. Thanks!
I'll give it a try and let you know.
02-19-2014 10:48 AM
you mean using the start function before the while?
Thanks!