WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Hello,

I think wavelets are the wave of the future also in audio measurements. There has been some interest on the wavelets recently in diyaudio and some of the benefits over other analysis methods have been noted. Take a look here for a snapshot what wavelets can do keeping in mind it only shows a part of what is possible
http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html


What-is?

I'll keep the introduction short because everyone wants to get into the point fast :D

Shortly put, a wavelet is a piece of 'wave' essentially having a defined center frequency and time duration. That's it!

Typically for this purpose the time domain waveform of the wavelet is 'smooth' avoiding abrupt changes.

The benefit using wavelets is to have improved resolution of the time-frequency domain information.





How-to?

A wavelet in the time domain looks for example like this:
An externally hosted image should be here but it was not working when we last tested it.



What we are interested in wavelets is the time-frequency information so we want to see the amplitude versus time. Amplitude of the wavelet can be seen in the envelope like this:
An externally hosted image should be here but it was not working when we last tested it.



To analyse a whole frequency band we generate a family of wavelets. Here is seen from 100Hz to 10kHz in 5 steps:
An externally hosted image should be here but it was not working when we last tested it.



And for the ampitude information we calculate the envelope for each like this:
An externally hosted image should be here but it was not working when we last tested it.



From now on in this case we are only interested of the envelope so we select only that and we have:
An externally hosted image should be here but it was not working when we last tested it.



Because a human is a logarithmic device, we take LOG of the above and see the envelope in 20dB scale here:
An externally hosted image should be here but it was not working when we last tested it.



Now we have some fun and visit the indian bazaar and get one of those colorful blankets and throw it on the top:
An externally hosted image should be here but it was not working when we last tested it.



And now we are almost done! For better visibility we choose the view angle at the zenith and finally we have this:
An externally hosted image should be here but it was not working when we last tested it.




- Elias
 
I found out the 'best' software to analyse wavelets is GNU Octave
Octave

Why it's the 'best'? It's free! It gives you almost everything that Matlab The MathWorks - MATLAB and Simulink for Technical Computing does with no cost. The visualisation tools are great. In mathematical capabilities only You are the limit.


Here's the code to plot the previous wavelets:
http://dl.dropbox.com/u/2400456/diyaudio/waveletdemo.m

How to run the code:

1) Download and instal Octave

2) In Octave command promt you can go the location of the waveletdemo.m file for example 'cd C:/your_folder'

3) Then type the name of the script file without the .m waveletdemo


Now you should be able to see the plots! :D


Ok, this was how-to generate a wavelet.

Next comes how-to get the use of it in analysing a loudspeaker impulse response for example.


- Elias
 
Basically wavelets and CSD are the same thing, although there is a subtle difference. The CSD truncates from a certain point and the wavelet does not, its full window slides so to speak. This is not a huge difference.

Mathematically wavelets can be defined and manipulated theoretically in an exact manner, but CSD cannot. This definately gives the wavelets an advantage in certain situations.

Octave is not very useful for windows users, it more of a unix based platform.

Wavelets can also be done in MathCAD and Mathmatica.
 
The honk horn thread has all of this discussion and yes Wavelets are CSDs. I just want be able to create the same wavelets that Elias was creating. They are much cleaner then the CSDs ARTA creates. I have many waveguides, many CDs and many crossovers to play around with.

Octave runs just fine in Vista and its free.

Is MathCAD or Mathmatica free?
 
I'll avoid that thread, thanks.

I was looking at Octave and from what I read it was not stable under windows and all my platforms are now Win 7. You have installed it on Vista and it runs with no trouble? That was not what I was reading, nor what Elias alluded to when I asked him.

No, neither MathCAD or Mathmatica is free, but I just find that in the long run free software fails to be well supported and my time is worth too much to waste on software that is going to become obsolete.
 
Hello,

I used to wrote under Matlab a spectrogram routine which gives very similar results to the continuous wavelets analysis illustrated by Elias.

It is based on the use of a gaussian envelop pulse having a constant number of periods (for what it seems theorically this pulse cannot be accepted as a wavelet though...).

You'll find my routine as an attached txt file that you can easily paste and run into Matlab.

Best regards from Paris, France

Jean-Michel Le Cléac'h
 

Attachments

  • spectrogram_JMLC.txt
    5.5 KB · Views: 171
I'll avoid that thread, thanks.

I was looking at Octave and from what I read it was not stable under windows and all my platforms are now Win 7. You have installed it on Vista and it runs with no trouble? That was not what I was reading, nor what Elias alluded to when I asked him.

No, neither MathCAD or Mathmatica is free, but I just find that in the long run free software fails to be well supported and my time is worth too much to waste on software that is going to become obsolete.

For my limited use, I had zero issues with Octave on Vista (SP2). I will find out if his package works without issues on Vista too.

Btw, You have limited experience with open source communities if you beleve free = obsolete because its not true in all cases.

1. The best webserver is apache, its free!! Its been around and stable for years with a big open source community.

2. Linux has been free forever (biggest open source community period). Companies just do not get the free idea because they like to pay and then blame someone when they screw up.

3. One of the best programming languages out there is called Python. Its free, it has A HUGE open source community and its everywhere, you would be amazed who uses it and what it can do. We run automated picking systems with it 24/7, Automation/PLC integration is easy with it. Its an extremely powerful language.

Conclusion, open source has proven itself to be extremely viable in the business world.

Thank you again Elias, I look forward to reading and understanding this stuff!
 
Last edited:
I did not say ALL free software was a problem, but if its only one, and that one happens to be what I am relying on, then it's a problem. But I will be honest here, only one of the pieces of software that I use regularly is open source. HolmImpulse is free, and I worry about its future because I am basing a lot of my work on it.
 
I did not say ALL free software was a problem, but if its only one, and that one happens to be what I am relying on, then it's a problem. But I will be honest here, only one of the pieces of software that I use regularly is open source. HolmImpulse is free, and I worry about its future because I am basing a lot of my work on it.

Fair enough, I agree on HOLM.

Back to the thread....sorry Elias.
 
Hello,

I used to wrote under Matlab a spectrogram routine which gives very similar results to the continuous wavelets analysis illustrated by Elias.

It is based on the use of a gaussian envelop pulse having a constant number of periods (for what it seems theorically this pulse cannot be accepted as a wavelet though...).

You'll find my routine as an attached txt file that you can easily paste and run into Matlab.

Best regards from Paris, France

Jean-Michel Le Cléac'h


Hi Jean-Michel, thanks for the code !

I gave it a try under XOctave – naturally there are some hurdles to jump.

First one is that Octave does not seem to support file handling by calling a small GUI.
I side stepped that for the moment by "hard coding" – but already have written a modular file import function that only needs to be adapted to chose IR import from several file types.

What is your variable "Nbits" telling us BTW ?

Second – and definitely a more severe - hurdle is the function "gauspulse" you call later on.
This is not a function supported by Octave / XOctave.
I got it on the web though – included in an package called the "Octave Signal Package" to be found here:

The 'signal' Package

After integration into Octave, "gauspulse" is available but sadly isn't as advanced in its functionality as the Matlab counterpart – meaning – it supports only *one* out variable.
This seems to do fine for the first call you use it (~ line 126) but fails on second call (~ line 129)

Any work around you could suggest ?
From there, its actually only few lines of code left to hopefully get it run !
:)

Michael
 
Last edited:
Hello Michael,

Nbits is related to the type of wave file used
.wav file may be stored under a 8bits (obsolete), 16bits or a 32bits format.

Gauspulse can be obtain simply applying a centered bell shaped (= gaussian) envelop on the sine and cosine ("singauss" and "cosgauss") of the given frequency. In that version of the spectrogram the bell shaped envelop possess a frequency variable width so it use a constant number of periods at the given frequency (12is a good starting value 7 is the min). Now if you use a constant duration width for the bell shaped envelop the results should be equivalent to a multiresolution wavelets graph or a CSD).

(Eventually you may use only half of the "Gauspuls" that means: the envelop only applied to the cosine = "cosgauss", like in a cosine transform... intuitively it should not lead to very different results)


Best regards from Paris, France

Jean-Michel Le Cléac'h


What is your variable "Nbits" telling us BTW ?

Second – and definitely a more severe - hurdle is the function "gauspulse" you call later on.
This is not a function supported by Octave / XOctave.

After integration into Octave, "gauspulse" is available but sadly isn't as advanced in its functionality as the Matlab counterpart – meaning – it supports only *one* out variable.

Any work around you could suggest ?
From there, its actually only few lines of code left to hopefully get it run !
:)
 
Last edited:
Administrator
Joined 2004
Paid Member
But I will be honest here, only one of the pieces of software that I use regularly is open source. HolmImpulse is free, and I worry about its future because I am basing a lot of my work on it.

I feel your pain! At the print shop where I worked we ran old OSes until 2008 because of legacy software problems. We had 6 machines with DOS, 2 with Mac OS9 and 1 with Mac OS8. :eek: The new software did not exist or was ridiculously expensive (kilo-dollars). Crazy. Tho I have to say I admire DOS for its singled minded simplicity.

At least with HOLM you can save the sweep files and export the impulse files. Maybe a good idea to do both for future use.
 
Finally arrived :D

it takes some time if you have to start from scratch installing and getting familiar with an "new" OS first.


Below we see the first "bunch of pretty pictures" I got - adapting Jean-Michel's code to QtOctave, to process my four honkers

0deg 60deg 120deg 180deg corresponding to :
http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted-8.html#post2126784


honker_0deg_deg+0_32_bearb.png


honker_60deg_deg+0_32_bearb.png


honker_120deg_deg+0_32_bearb.png


honker_180deg_deg+0_32_bearb.png



Those visualisations of my out door measurements are not perfect yet - as can be see – but, I'm loving it, and not having expected to catch up the many years of experience with Matlab / Octave of Elias or Jean-Michel in a few days anyway.

Next step will be to get things straight and to work on Elias code to get some beautiful IR processing from that as well.

I'll gonna switch over to the horn honk thread as soon as I feel comfortable with my skills...

BTW, I highly recommend to take the effort in setting up a Linux OS if you don't already have, as Octave – and especially QtOctave is a complete and excellent working environment for coding IMHO.




Michael
 
Last edited:
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.