06-28-2021 11:07 AM
Hi,
I am very new to LabView and am self-taught so please forgive any mistakes. I am trying to write a program that will 1.) record boolean data and 2.) record audio input with date and time into an Excel sheet. I have successfully created step 1, but am having issues with step 2. It is recording audio (I think, though I am not sure what the units of amplitude are in this case- decibels?) but it is greatly slowing down my program and causing lags of up to 15 seconds where I just lose that data, which is not acceptable for the application of this. I tried to create a "producer/consumer" loop in a separate VI just to see if that would get rid of the lag, but it doesn't look like it is. I will attach both VIs below (they are messy-sorry). Any help would be greatly appreciated, as no one I work with has ever worked with audio and I have hit a wall.
06-28-2021 02:30 PM - edited 06-28-2021 02:32 PM
Hi mnchem,
@mnchem wrote:
2.) record audio input with date and time into an Excel sheet.
It is recording audio (I think, though I am not sure what the units of amplitude are in this case- decibels?) but it is greatly slowing down my program and causing lags of up to 15 seconds where I just lose that data, which is not acceptable for the application of this
There are some bugs in "PatientTest":
In the QueueTest VI there are basically the very same problems/bugs, but spread over two loops…
06-28-2021 02:44 PM
Hi GerdW,
Like I said, I am very new (to LV and coding in general), so most of what I have done comes from tutorials I've found on Youtube. The program was working fine before I added the audio component, so I thought building the array in the loop then writing to an Excel file (as I saw in a tutorial) was okay. Can you describe how to create a CSV file (or point me in the direction of a tutorial/instructions?).
The second bullet point is the only part that I really came up with myself, so I am not surprised that it is wrong. Basically, the end goal is to measure the average volume of what the mic is picking up every second, and logging that with the other boolean data. I need to know what the patient is doing (reading, coughing, etc.) along with their volume every second when I look back at this data. Do you have any suggestions on how to record the audio in a less "suspicious" way?
Again, beginner language so I really appreciate any help in layman's terms. Thank you!
06-28-2021 03:02 PM
Hi mnchem,
@mnchem wrote:
The program was working fine before I added the audio component, so I thought building the array in the loop then writing to an Excel file (as I saw in a tutorial) was okay. Can you describe how to create a CSV file (or point me in the direction of a tutorial/instructions?).
Why do you go to Yutube when there are "Training resources" at the top of the LabVIEW board?
To create a CSV file (which basically is a formatted text file) you can either use the WriteDelimitedFile function - or WriteTextFile with some formatted strings…
@mnchem wrote:Basically, the end goal is to measure the average volume of what the mic is picking up every second, and logging that with the other boolean data. I need to know what the patient is doing (reading, coughing, etc.) along with their volume every second when I look back at this data. Do you have any suggestions on how to record the audio in a less "suspicious" way?
The you should read samples of one second, so at 22.050kHz you should read 22050 samples.
Then you use WaveformGetCompontents function to get the samples from each waveform, and finally use a Mean function on the samples array to get the average!
06-29-2021 11:40 AM - edited 06-29-2021 12:04 PM
Hi GerdW,
Thank you for your help so far. Would you mind taking a look at this revised version and tell me where I am going wrong? When I save as a .txt file (there were errors when I tried to save either as csv or xlsx), I get the headers (Date, Time, "aaah"ing, etc.) but it is not recording any of the data, boolean or audio.
I tried to use the lightbulb (not sure what it is called) and it looks like the data is getting stuck getting out of the while loop. I tried putting the build array and write delimited spreadsheet inside the loop just to see, and the data was able to get through those but again something got stuck at the loop I think. I tried removing the loop just to see what would happen, and it did successfully record the data, but just once (as expected), so there must be a problem with the loop that I'm not understanding.
Also, could you describe what the amplitude measurements I will be getting physically mean? i.e are they volume in decibels..?
Thank you again!