LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to do simple audio measurements with a sound card?

Solved!
Go to solution

Hello,

 

I would like to do simple audio measurements (level, THD, frequency) in LabVIEW with a sound card.

The audio signal is a simple analog 1kHz sine tone.
I know it's better to do this with a real audio analyzer, but this would be a significant investment.
So how can this be achieved with a standard PC sound card?Thanks.

0 Kudos
Message 1 of 9
(6,031 Views)

Yes, in the 'sound input' palette, there are VIs for configuring, starting and stopping the recording of your computers audio input in LabVIEW. There are numerous examples in the Example Finder in LabVIEW (Help -> Find Examples... -> type 'sound').


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 9
(6,029 Views)

Ok, and what do I do with the recording (e.g. a WAV file) to get these values like level, THD, frequency?

0 Kudos
Message 3 of 9
(5,993 Views)

@schuller wrote:

Ok, and what do I do with the recording (e.g. a WAV file) to get these values like level, THD, frequency?


If you looked at the Examples, you would know how to get the data into a LabVIEW Array of Waveforms.  Now you need to do a little more research (= learning = tutorials) to know how (a) "level" is represented in a Wav file, (b) what "level" means, and (c) how to analyze the frequency content of a waveform.

 

Once you've done that, start coding.  I'd start with just reading the Wav file, outputting (for yourself) some simple parameters such as number of channels, number of points, frequency of sampling, and total time represented by the file (just to see if your code seems to be doing the right thing, and you know how to do these simple steps).  Then start on the analysis.

 

If you get stuck, come back here, post your code (attach the actual VIs, don't waste our time showing a picture of part of the VI), and we'll try to help.  But you need to "do the work" ...

 

Bob Schor

0 Kudos
Message 4 of 9
(5,974 Views)

I apologize if you got the impression I'm not willing to do the work by myself. I just thought it would speed things up, if somebody would point me to right direction. That's what the board is for, right?

0 Kudos
Message 5 of 9
(5,955 Views)

@schuller wrote:

I apologize if you got the impression I'm not willing to do the work by myself. I just thought it would speed things up, if somebody would point me to right direction. That's what the board is for, right?


What Bob means when saying "do the work" is that you have to do the legwork necessary to understand what a waveform is and how to take measurements before you can even begin coding.

 

And Bob is stressing to upload "real code" because a picture of a block diagram is as useful to us as this picture

not helpful.PNG

is not useful to someone trying to troubleshoot an xml file.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 9
(5,945 Views)

There are a lot of soundcard based signal analysing tools for free ... audacity .. speclab ... 

 

For a correct level measurement you would need a calibrated mic / sound aquisition system... for 1kHz at least a pistophon..

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 9
(5,915 Views)
Solution
Accepted by topic author schuller

I could perform a basic measurement (amplitude, frequency) with the following code:

soundcard.png

0 Kudos
Message 8 of 9
(5,908 Views)

Just add the vi for THD and your done 🙂

 

Create a producer consumer architecture

producer : cont. mic input 

consumer : your data analysis ...

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 9 of 9
(5,899 Views)