LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to parse the wav file

Hi Sir,

 

I have a MEMS mic, it will generate the wav file by fw, then i try to use labview to parse this file, get the sensitivity, SNR, THD, frequency.

 

I saw that someone use python to make this happen.

Any labview function to support this ?

Thanks.

 

Brzhou_0-1682132071929.png

 

Learning from other people
0 Kudos
Message 1 of 17
(1,274 Views)

About a decade ago, I was briefly involved with a project to analyze animal calls recorded as .wav files.  I remember looking up the specifications for these files, and building a parser for the "simple stuff", but the project was dropped by my colleague before I got too involved.  You might try a search for "Wave File Format", which is the name of the HTML document I still have ...  You might also try looking in the LabVIEW Tools Network (VIPM) to see if there are any Wave "readers".

 

Bob Schor

0 Kudos
Message 2 of 17
(1,230 Views)
Hi Sir, Is it able to parse the wav file, get the level, SNR, THD, etc ? Thanks.
Learning from other people
0 Kudos
Message 3 of 17
(1,208 Views)

Thanks. In VI package management, i saw "open sound control" package, but not sure whether it can parse the wav file.

 

Learning from other people
0 Kudos
Message 4 of 17
(1,213 Views)

Hi Brzhou,

 


@Brzhou wrote:

not sure whether it can parse the wav file.


Your problem can be divided into two sup-problems:

  1. read the wave file data
  2. analyze the waveform data

Suggestions:

  1. Read the wav file unsing the WAV file functions in the waveform file palette.
  2. Use any of those signal processing functions in the signal processing palette.

 

Please explain what you have tried and where you are stuck.

Please show your current VI(s)/project.

(We will not do your homework for free, so please show some effort on your own.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 17
(1,201 Views)

Hi GerdW, 

 

Thanks for your info, I will try it.

Learning from other people
0 Kudos
Message 6 of 17
(1,193 Views)

I also need to thank @GerdW -- I (foolishly) didn't look carefully at the Sound VIs, and, sure enough, there is a Files section that has "Simple Read" and "Simple Write" that know how to read and write .wav files!  It even comes with an Example that you can use to get started exploring what (simple) things you can do with these files.  [The reason I said "simple" is this treats the data in the .wav file as a simple stream of (usually  2) channels of sampled analog data (I believe 16 bit, but I'll check on this, without explicitly returning all the encoded data that is part of the .wav specification].

 

I've looked at the Example, which is pretty "bare-bones".  I'm going to play with it a bit, and plan to explore some ideas about how to extract the waveforms from, say, the 2-channel sound example presented and how you might start to analyze the data in those signals.  Stay tuned ...

 

Bob Schor

 

 

0 Kudos
Message 7 of 17
(1,174 Views)

Thanks for your help Bob and GerdW.

 

The wav file is like this in "“Audacity", it is mono MEMS microphone:

 

 

Brzhou_0-1682260926861.png

 

I try to read via Labview, but report error, not sure what is wrong, thanks.

 

Brzhou_1-1682260998617.png

 

 

Learning from other people
0 Kudos
Message 8 of 17
(1,168 Views)

Hi Brzhou,

 


@Brzhou wrote:

The wav file is like this in "“Audacity", it is mono MEMS microphone:

 

I try to read via Labview, but report error, not sure what is wrong, thanks.


Unfortunately you don't attach your WAV file and unfortunately that Audacity image is scaled too small to be readable.

 

The error message is quite clear: unsupported file format. But again we cannot check the file format because yoou don't provide (readable) information…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 17
(1,161 Views)

OK, now we are getting somewhere (on two different paths).

 

First, here is how you read a .wav file that represents ordinary stereo sound waveforms, such as from a music CD, where you have two channel analog samples taken at 44.1 kHz.  This is a derivative of one of the examples that ships with LabVIEW, after I tested it and added some additional processing to show such things as the sampling frequency.  I'm attaching this as a Project file (with the sound sample embedded in a \Data subfolder of the Project), and also posting a Snippet (which will probably not work, as it won't have the data file handy).

Read and Play Wave File.png

This works, actually.  I should mention that the "Play Waveform" function you see here is the Icon view of the Play Waveform Express VI that you'll find in the Sound Files sub-Pallet -- I prefer Icon views as the Error Line appears in the right position and the Inputs and Outputs are better organized.

 

Did you ever attach the .wav file from your "mono MEMS microphone" for us to examine?  According to the "pictures" (I really dislike "pictures" in the Forum -- it "teases" those of us who want to help, but who don't get information in a form we can see, can study, can edit, can play with ...) you just attached, it appears that it might be a digital output that might need to be further "decoded" to become a conventional audio signal capable of being "heard" by our "analog" ears.

 

In any case, please attach the .wav file itself that you are trying to read.  If it is too large for the Forum, see if you can compress it and attach it as a .zip file.

 

Bob Schor

 

 

0 Kudos
Message 10 of 17
(1,158 Views)