5
$\begingroup$

I have recorded samples of lungs sound (person breath) signals from electronic stethoscope.

How can I measure (In percentage) the similarity between two audio signals (lung sound), the general idea is to take a clean recorded signal(without environmental noises, Laboratory conditions) and compare it with the regular recorded lung sound. If the percent is high enough then it is valid, else it is with too much environmental noises. I thought to do it by cross-correlation but after a research I found out that it is more suitable for time lag between signals. Any good idea to start with? I want to implement it in MATLAB.

** the recorded files are in AAC format.

$\endgroup$
1
  • $\begingroup$ Could you please review my answer? $\endgroup$
    – Royi
    Jun 3, 2022 at 22:55

3 Answers 3

6
$\begingroup$

You can use the Normalized Cross Correlation for that.

Basically, representing each recorded sound as a vector, this gives the angle between them.

Another approach is dealing with features of the sound instead of the signal itself.
You can start by reading how Shazam works:

$\endgroup$
4
  • 1
    $\begingroup$ The problem with that is that two sounds can sound absolutely identical and still be entirely orthogonal. $\endgroup$
    – Jazzmaniac
    Jun 28, 2014 at 17:30
  • $\begingroup$ If that the case, I guess there are features which can create "Vector Space" and then be applied in such way. I would start with "How does Shazam works". $\endgroup$
    – Royi
    Jun 28, 2014 at 19:32
  • 1
    $\begingroup$ The idea of spanning a signal subspace with a feature basis is good. Still, this won't work. Auditory perception is nonlinear, and I can demonstrate this using a very simple example. Let's say you take a signal of length N that corresponds to a real vector space of dimensions N. Now consider a basis that consists of N orthogonal white noise vectors. Each basis is classified as noise, but because it spans the full space, all signals with any content are spanned by this basis, even if they're not noise. Thumbs up for the Shazam idea! Feature detection is the way to go. $\endgroup$
    – Jazzmaniac
    Jun 28, 2014 at 20:42
  • $\begingroup$ The Shazam algorithm is designed for music signals and detect shar $\endgroup$ Jun 29, 2014 at 10:40
1
$\begingroup$

Music fingerprinting algorithms (like the one used by Shazam) will not work. They work by identifying areas of the spectrogram in which there are sharp increase of energy in a narrow frequency band (the attack of a note partial) - and "noisy" sounds like breathing never have such features.

Cross-correlation will not work either because of the predominantly noisy component in breathing signals. For example, two realizations of white gaussian noise filtered by the same band-pass filter will sound absolutely identical but the correlation between waveforms will be null. The notion of similarity given by our ears, or by the experience of a physician, is not waveform correlation.

It is not clear from your question if what you want to measure is just how "clean" the signal ("is it similar enough to this clean recording of breathing?") or if you will actually need to match a recorded sample to several reference recordings (for example for diagnosis). In both cases, you will have to define your own features using your own expertise of the field, and probably rely on statistical/machine learning techniques.

The former situation is easier because temporal information probably doesn't matter much. It seems doable with features like spectral envelope (for example, energy in a handful of frequency band), a contrast measure on the spectral envelope (smooth the spectrum, compute kurtosis or geometric/arithmetic mean ratio), and a contrast measure on the correlation (to discriminate against sounds which are too "pitched" - just like voiced/unvoiced detection in speech analysis). From there, you could have a few examples of "good" and "bad" signals, and train a classifier.

For diagnosis, you would have to define features taking into account temporal information (such as the autocorrelation of the envelope).

$\endgroup$
1
  • $\begingroup$ You are right -> +1 $\endgroup$
    – jojek
    Jun 29, 2014 at 11:12
0
$\begingroup$

In the past i did the shazam algorithm, I dont know if it can give to you the expected results, but you can try do it using the same principles, you can measure using scoring system of ascending order and why not if you want you can measure in percentage.

First look at sounds lungs and analizer to find where are the bands frequencies of you interest or what are the best bands that can define your breath signal.

I consider the basic idea behind the shazam algorithm very easy.

Construct database song

1. Record your Full Song
2. Transform the sound to spectrum
3. slice your Spectrogram in chunks(three or four bands) and get the high Frequencies
4. Store all the points

Match the song

1. Record one short sample or another full song.
2. Transform the sound into another spectrum 
3. slice your Spectrogram in chunks(three or four bands) and get hight Frequencies
4. Compare the collected frequencies with your database song.
5. your match is the song with have the high hit !

I remember that when i test it in a relative large database my results was amazing, but I used it for audio fingerprint, your approach seems to be a little different.

$\endgroup$
1
  • $\begingroup$ Hi @ederwander do you mind sharing your code ? thanks $\endgroup$ Nov 16, 2017 at 3:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.