LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sound input to file

Solved!
Go to solution

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?

 

Pixie9683_0-1587787975559.png

Kind regards 

0 Kudos
Message 1 of 8
(2,343 Views)

Does an error pop up?

0 Kudos
Message 2 of 8
(2,306 Views)
Solution
Accepted by topic author Pixie9683

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".

0 Kudos
Message 3 of 8
(2,278 Views)

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.    

Pixie9683_0-1587844172851.png 

Thank you. 😄

0 Kudos
Message 4 of 8
(2,252 Views)

Pixie9683_0-1587868542383.png

 

0 Kudos
Message 5 of 8
(2,251 Views)

Hi,

 

I didn´t know how to make the program records only a few seconds 🙂

0 Kudos
Message 6 of 8
(2,248 Views)

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.

0 Kudos
Message 7 of 8
(2,241 Views)

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

0 Kudos
Message 8 of 8
(2,212 Views)