05-30-2015 02:48 PM
Hi ,
im last semester student and during my final project im recroding lung sound with electret microphone sampling it with myDAQ and writing it to a wav file. the acquisition mode is "continuous samples" , the recording time is changing from time , i want to add a "STOP" button , which will be pushed when i finished my recording . If i push on the "abort execution" button , the wav file is empty , and so on the graph. any suggestions ?
thank you in advance.
05-30-2015 03:10 PM - edited 05-30-2015 03:11 PM
Like this
By the way, that Abort VI button is not for stopping your loops. I just kills execution wherever it may be. It should only be used as a last resort if your stopping code is not working properly.
05-31-2015 04:45 AM
i'v added the stop control as you explained , and it seems that this is not working , it continue do collect data , and the final length is always the same (samples/sample rate).
05-31-2015 10:49 AM
That is because you are only logging the last acquisition. Maybe you should move the saving of the data into the loop. You should open the file before the loop and pass the reference into the loop. You can then write to the file inside of the loop. You really should also be sure to close the file after your loop.
06-01-2015 08:22 AM
can you please explain how it should be look like .
06-01-2015 08:34 AM - edited 06-01-2015 08:34 AM
Like this
06-03-2015 04:24 AM
i did exactly as you told , and it is not working , for example if my sampling rate is 44.1k , and samples to read is 441k , if i push on stop after 5 seconds , it records me everyting , (10 sec).
06-03-2015 06:41 AM
Yes, it is doing exactly as you have programmed. You told the DAQ Assistant to read 10 seconds worth of data. So it will do that or timeout trying. If you want more precision in your stop, then tell the DAQ Assistant to read fewer samples. If you have the sampling rate at 44.1kHz, set the number of samples to read to 44100. That will cause the DAQ Assistant to read 1 second worth of data, giving your stop condition a 1 second resolution.