Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Wavelet Packet Trasform help badly needed

Status
Not open for further replies.

Daddy07

Newbie level 4
Joined
Jan 3, 2013
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Singapore
Activity points
1,349
Hi,

I'm in a situation....

I need to analyse lung sounds samples to detect crackles present in them and further classify these crackles by their characteristics for a project.

Having read some articles that have done such analysis, I figured the wavelet toolbox in MATLAB is the best tool for this purpose.

Problem is, with my mechanical engineering background, I have limited understanding of the algorithms and techniques actually used.

I have been playing around with the Wavelet Toolbox and also the DSP Toolbox in Simulink to see if I can get anywhere but keep coming to dead ends.

What I think I have picked up is:

-The wavelet type I'm trying to pick up is the debauchies type 8 (db8).
-To use Wavelet Packet Transform to differentiate the stationary and non-stationary components of the original signal.
-The stationary signals are the crackle signals that I would later classify, and these have to be rebuilt by Inverse Wavelet Packet transform.
-There are levels in a wavelet decomposition tree (of which I need 5 for this purpose)
-A pair of FIR filters are used in WPT, but I am not sure what the settings for these filters are, except that one is a high-pass and the other a low-pass, with both having same cut-off frequency.
-Input signal may need to a 2n(?). My .wav sound files are 11025Hz.
-Some coefficients are involved, but am not exactly sure about these.

I have almost no code programming knowledge, so I'd prefer to do these in Simulink or using the MATLAB Wavelet Toolbox.

The part above is only for separating my crackle sounds from the lung sounds, but I'd be extremely grateful if someone could hold my hand through this and hopefully, lay some foundation for me to figure out the next part of the analysis.

Thank you in advance.
 

You'll want to examine the waveform while you listen to it, so that you will recognize what certain sounds look like.

Do you use a digital sound processing program? Example, a free one is Audacity. It will open a .wav audio file. You'll see its waveform just like it's on an oscilloscope. You can watch it travel across the screen while listening to it.

As I picture it, crackling sounds are tics (resembling pulses) occurring at a frequency of 1 to 10 per second.
This is against a background noise consisting of air hissing back and forth in the trachea.

To teach your software to recognize the crackling sounds, you must isolate their distinguishing characteristics. For instance, they may be found to be most prominent in a certain range of the frequency spectrum. You must examine a band of the spectrum by filtering it out with a bandpass filter (which is available in the Audacity program).

Or perhaps your program will need to go through all the data values of the audio signal, looking for any sudden rise or fall since the previous value. If the change is too great to be reckoned as background noise, then call it a crackling sound.
 

Hi BradtheRad

Thank you very much for replying.

I do have Audacity, MATLAB 2011b (with DSP and Wavelet Toolboxes) and LabVIEW 2011 to use.
Had thought MATLAB's Wavelet toolbox was the most appropriate tool for the job since articles I've read usually use it.

I do know that fine crackles are exclusively inspiratory and that these crackles don't last more than 20ms. I'm thinking of zooming into the earlier half of a respiratory cycle and apply a bandpass filter between, say, 40Hz and 120Hz. Shall do this in Audacity since I'm getting nowhere in MATLAB.

The bit bout recognising distinguishing characteristics is the bigger challenge. I do know the characteristics and dimensions of generic crackle waveforms, but how do I pick it out from the region I have specified.

FYI, I do not really need real-time analysis. At this stage, my aim is to detect crackles from three 10-second long .wav files of lung sounds: one with fine crackles, one with coarse crackles, and one without any crackles at all. After detecting the presence of crackles, I would want to use the characteristics of coarse and fince crackles; namely each waveform's Initial Deflection Width, 2-Cycle Duration, Largest Deflection Width; to identify and classify them into fine or coarse type.

Appreciate the help.
 

Is there a bandpass filter in Audacity?

I only see High-pass, low-pass and Notch (Bandstop) in the Effect menu.

I loaded a 10-second .wav file of lung sound with fine crackles into Audacity, zoomed into the first second and applied a high pass filter at 100Hz. The shape of the expected crackle waveform can be seen, but still not clear enough to find the dimensions I'm looking for.

I noticed a Draw tool in Audacity. Does it allow drawing a new waveform which I can use to superimpose on a filtered or zoomed-in signal to pick up similar waveforms present in that signal?

Hope I'm making sense here.
 

Is there a bandpass filter in Audacity?

I only see High-pass, low-pass and Notch (Bandstop) in the Effect menu.

I loaded a 10-second .wav file of lung sound with fine crackles into Audacity, zoomed into the first second and applied a high pass filter at 100Hz. The shape of the expected crackle waveform can be seen, but still not clear enough to find the dimensions I'm looking for.

I noticed a Draw tool in Audacity. Does it allow drawing a new waveform which I can use to superimpose on a filtered or zoomed-in signal to pick up similar waveforms present in that signal?

Hope I'm making sense here.

Yes, you can draw any arbitrary waveform in the window. Or it may give you a row of sliders (graphic equalizer).

Tutorial webpage:



Almost forgot... You can view your audio as a spectrogram. You can see exactly what frequencies are contained in the crackles.





I believe the crackles are in the category of 'plosives'. Not at any particular frequency. Sort of like bubbles popping. Each produces a momentary, weak pulse.
 

Thanks Brad,

I'll look at the links.

Btw, where do I find a bandpass filter in audacity?
 

Thanks very much for all the help so far.

So far, I've been able to manually isolate crackle waveforms by:
1) Loading the lung sound .wav into Audacity
2) Display the sound signal in Spectogram (Shift-M\spectogram). Here I get to see the explosive crackles along the signal.
3) VISUALLY approximate the frequency range in which the exlposive crackles occur. Since the y-axis in spectogram view is frequency, this can be done.
4) Apply a highpass and a lowpass filter to allow a bandpass in the frequency region where this explosive crackle waveforms exist, effectively filtering out the vesicular lung sounds and ambient (?) sound. The graphic EQ tool in Effect\Equalisation requires one to individually adjust each frequency band, so I prefer just applying a lowpass filter then highpass filter cos all that is needed is to key in the approximated cut-off frequencies.
5) Shift-M and select filtered signal to be displayed in amplitude-time waveforms. The accentuated crackles along a now-filtered waveform are more obvious now.
6) Zoom-in enough to obtain a clear visual of each crackle's waveform. Usually till about 0.035 seconds covers the screen.

For now, I use a ruler to measure the characteristic dimensions on these crackle waveforms I have filtered. There must be a better way to do this. Does Audacity have a function to measure point-to-point distances?

Now, even when using my primitive ruler-measurement method, I don't understand why all the crackles I've identified only satisfies the dimensions of fine crackles. Even when I know for sure a lung sound sample has COARSE crackles, the waveform dimensions still are characteristic of fine crackles......
 

Yes, what you're doing is the way to examine the audio characteristics.

For now, I use a ruler to measure the characteristic dimensions on these crackle waveforms I have filtered. There must be a better way to do this. Does Audacity have a function to measure point-to-point distances?

I have never seen a direct time readout when I highlight a segment.
For time measurements I zoom in (ctrl-1 or ctrl-e), look at the top markers and subtract the beginning point from the end point.

Or if you want to get finer resolution of the amplitude, expand it by clicking the numbered vertical scale to the left of the waveform display.
To reduce, use shift-Click.

Now, even when using my primitive ruler-measurement method, I don't understand why all the crackles I've identified only satisfies the dimensions of fine crackles. Even when I know for sure a lung sound sample has COARSE crackles, the waveform dimensions still are characteristic of fine crackles......

If you can hear a difference, then the difference should show up in the waveforms somehow.

Did your microphone pick up a signal with sufficient volume, and which covers the entire frequency range?

Do waveform peaks occupy a good proportion of the recordable area?

If volume is small then it may need amplification.
If the waveform extends to the extreme top or bottom then it is clipping and ought to be reduced.

You may want a closer resolution of the spectrogram. Click 'Preferences' and select Spectrogram.
There are a number of parameters such as window size, frequency range, frequency gain, etc.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top