Clear Filters
Clear Filters

How to implement Haar wavelet from scratch

9 views (last 30 days)
Sudhir Kumar
Sudhir Kumar on 18 Apr 2022
Answered: Nithin on 11 Oct 2023
I have a audio signal recording sampling frequency of 16KHZ. I want to do sub band coding using Haar transform of that audio signal. How to impliment Haar wavelet transoform from scratch without using matlab inbuilt function. Is there any link to find please suggest me.

Answers (1)

Nithin
Nithin on 11 Oct 2023
Hi Sudhir,
I understand that you want to implement the "haar transform" of an audio signal without using inbuilt MATLAB function.
To implement this, kindly refer to the following steps:
1. Load your audio signal sampled at 16 kHz into MATLAB.
2. Implement the Haar wavelet transform as a custom function:
function output = haar_transform(signal)
N = length(signal);
output = zeros(size(signal));
for len = N/2:-1:1
avg = (signal(1:2:len) + signal(2:2:len)) / 2;
diff = (signal(1:2:len) - signal(2:2:len));
signal(1:len) = avg;
output(len+1:2*len) = diff;
end
end
3. Call the "haar_transform" function on your audio signal to obtain the Haar wavelet coefficients.
haar_coefficients = haar_transform(your_audio_signal);
For more information regarding "haar transform", kindly refer to the following documentation:
I hope this answer resolves your query.
Regards,
Nithin Kumar.

Categories

Find more on Discrete Multiresolution Analysis in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!