04-24-2020 11:13 PM
Hello everyone,
I found a very useful labview example (sound input to file) and I wanted to know if someone could explain me how to make that the program only captures 7 seconds of the sound signal?
Kind regards
Solved! Go to Solution.
04-25-2020 01:35 AM
Does an error pop up?
04-25-2020 08:47 AM - edited 04-25-2020 08:49 AM
As you configured the acquisition, you are acquiring 10,000 samples of (stereo) sound at a rate of 22,500 Hz. To acquire 7 seconds of sound, you would need to acquire 7 * 22500 = 1575000 samples. If you ran the loop 157 times, you'd have 1570000 samples, so you'd do one more sample and only write out the first 5000 samples to get 1575000 samples (or 7 seconds).
Bob Schor
P.S. -- oops, I see that I read the sampling rate wrong (you have 22050), so my arithmetic is wrong. I'll leave the correct arithmetic as an "Exercise for the Reader".
04-25-2020 09:34 PM
Thank you Bob Schor,
I did the math and changed it to 6 seconds and now on the waveform graph shows only this. But, another question popped up. When I opened the audio file it has more than 6 seconds, only stops recording if I push the stop button, so... I thought that I could use the elapsed time and I did and put as a time target (6 seconds). Now it stops but at 12 seconds I think that I'm doing it wrong.
Thank you. 😄
04-25-2020 09:35 PM
04-25-2020 09:46 PM
Hi,
I didn´t know how to make the program records only a few seconds 🙂
04-25-2020 10:44 PM
Then you need to get rid of the while loop.
What "few seconds" do you want to record? You could put it in a case structure to record once you press a button.
04-26-2020 10:03 AM
Pixie,
Please attach your VI. Pictures cannot be executed, and we cannot see what isn't showing in the picture. Also, attach a sample Sound File so we have the same Data that you are trying to use.
Bob Schor