Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
Anybody out there to help unveil secrets of wavelet analysis – and possibly to develop towards moduls / scripts or a front end – stupid monkey like me can handle ?

Background are Elias' breathtaking and challenging visualisations regarding "quarter wave honk" here (and subsequent):


http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted-6.html#post2122009

An externally hosted image should be here but it was not working when we last tested it.




So to get things started - I think I contribute as far as a I can - not *that* much anyway..
Software - more or less a Matlab clone I've been told - can be downloaded for free (~ 60MB):


http://www.gnu.org/software/octave/
http://www.gnu.org/software/octave/download.html/


Setup is straight (I didn't make any changes) :)


Then I was looking for a entry in the "program folder" and as this did not show up I manually launched "octave-3.2.3.exe" from the subfolder "bin" (happily found it there after some sarch ;) )

Expectations at first start up were high - but reality popping up is a thumb black box with a few lines of text followed by a prompt – ufff :(

What's that ???

Looking for help I searched the web and came up with the (proudly announced !) 500+ pages manual – ufffffff !!!


http://www.gnu.org/software/octave/doc/interpreter/


Skipping the first entries and especially the "How You Can Contribute to Octave" as I'm considering my hard work here already as my 2ct :D – I finally arrived at "simple examples", kinda tutorial:


http://www.gnu.org/software/octave/doc/interpreter/Simple-Examples.html#Simple-Examples.


Lacy as I am, I wanted to hurry through by copy and paste commands - joyfully watching pretty pictures popping up or anything – no way – have to type character by character into that stupid black box - uffffffffff

Getting the first matrix at least displayed, already is kind a climax – well you have to adapt your expectations – no?



first_matrix.gif




:cubehead:
... to be continued ...

need a break now ..
:faint:
possibly better don't hold your breath ..
:wchair:


Michael
 
Last edited:
hi

Wow - that looks interesting too - seems to have an easier user interface - I'm just downloading to give it a closer look

Seems there is wavelet analysis available for SciLab too:

Scilab Wavelet Toolbox

Have you used it ?


#############
BTW

*proudly* present:
(My first plot)

first_plot.gif


what the hack do that traces tell me ?? - anyway - I LOOOVE pretty pictures...
:D

AND such a beautiful white background ! AND you can scale it ! AND you have cursor readout ! whoooaaa !!!

Michael
 
Last edited:
SciLab on my PC was a disaster –
- needed additional download at installation
- installed some openoffice math package ??
- didn't make it past three or four demo examples
- got stuck and crashed all
- de - installed

###########

found graphic user interface for Octave here:

Xoctave : GNU Octave Interface - About Xoctave

Looks good at a first glance though is label "last beta version"


Xoctave.gif



allows for copy and past :) through clip board into command area...

Michael
 
Might be I should outline that I'm highly motivated to use wavelet analysis rather then Fourier analysis.
This is due to the fact that when investigating into reflections and subsequent comb filtering effects, the time invariance Fourier analysis relays on - exactly in the interval we are most interested in for those "quarter wave honk" – simply is not a given.
:)


comb_filter_delay_summ.png


http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted-7.html#post2123744


######

Back to track...

Being not only a monkey but being a lazy monkey at first – I got bored by that much "button pressing" soon.
;)
So I started to have a look after automation
– great – those guys provide scripting option !!

Below the first lines (for download) to make life easier...
Over the course, 'will need a lot more of that trick I'm afraid
:D

http://www.kinotechnik.edis.at/pages/diyaudio/GD_HighPass/honk_wanted/octave/start_wavelet.m


first call by "start_wavelet"
and importing IR file (plus providing the plot seen above to check function) by calling "load_ir"

...well, only if you have set up anything else properly of course



Michael
 
Last edited:
After having made first stumbling steps in an unfamiliar environment lets have a look at how to climb the next hurdle :)

Sadly Octave does not provide wavelet analysis – but as its reported to be pretty similar to Mathcad those clever guys that coded the wavelet package (named "WaveLab") for Matlab assume that this package also may work in Octave as can be read here and at subsequent pages:

WaveLab802


Free download is available and installation was straight – if you do not care about the time and effort to include a heavy bunch of path's to include in XOctave.
;)


So – now finally arrived in the middle of that "desert of math" – a few examples of "how to" for the noob would be highly welcome....
:Popworm:


Michael
 
Last edited:
Had a look into free UviWave 300 wavelet toolbox in the mean time.

http://cas.ensmp.fr/~chaplais/UviWave/About_UviWave.html


After a lot of debugging (matlab <> Octave and version conflicts as it seems) and additional necessary installation of free plplot package

http://plplot.sourceforge.net/download.php

- I finally got some of the UviWave demos running under XOctave.

Sadly the most stuff there is for picture processing and only very few functions seem to be for audio processing.
Those demos I had a look into didn't look that much promising either.

Bottom line – a lot of wasted time IMO...

:(


Michael
 
Last edited:
Also gave the WaveLab package, mentioned earlier, a try .
They seem to concentrate on picture processing as well .

Also for many of the WaveLab functions to work, there seems to be a special "signal processing toolbox" required (if I shall believe, what's popping up as an error message) - which I think isn't available nor is substitutable by freeware IMO.

Bottom line – here too - no free lunch for audio guys...
:D


Michael
 
Last edited:
Just for the record :

Commercial Clio software:

http://www.audiomatica.com/clio/8wavelet.htm

I am currently upgrading to 8.5.

[If wavelets were in 7.x, I never stumbled upon them in 5 years of using it.... ;) ]

Zilch, those Clio guys seem to be quick - when did they release the wavelet version?
Sadly, software is way too expensive for my taste, and also no demo available as it seems - would love to see you posting some wavelet plots though

Michael



##########


Free FaWave software :

Hello,

A friend indicated me that freeware:

FAWAVE

according to the website:

"FAWAVE is free software for performing digital signal processing on digital audio and images. It also can be used to teach the fundamentals of Fourier and wavelet analysis. "

Best regards from Paris, France

Jean-Michel Le Cléac'h

Did you get anything meaningful - regarding our topic - out of this software ?

Seems this one has more strength at picture processing - havn't made it towards something interesting - but maybe I have overlooked ??

Michael

Hello Michael,

I gave a look yesterday evening and find this freeware totally unsatisfactory for our purposes (analysis of pulse responses). Better to forget it...

Best regards from Paris, France

Jean-Michel Le Cléac'h

:)

Michael
 
Last edited:
Hi folks

finally got around some starting point.
:)

Special thanks to main contributors for the package I proudly present :

Elias
Jean Michel LeCleach
Jacques Lewalle


For now it features / is implemented :

- simple user menu
- file import of wav-file, ARTA-txt-file, plain-ascii-file (two and one column)
- display of first 100ms of unprocessed IR
- IR peak normalizing and display of IR peak in zoom
- Jean-Michel LeCleach wavelet analysis
- Jacques Lewalle wavelet analysis
- display of standard wavelet analysis
- display of normalized wavelet analysis

Hope you'll find it any useful so far
;)

Michael
 
content of Diy_Audio_WTF package :
April 2010

start_wavelet, load_arta_txt_ir, load_ascii_ir, load_ascii1_ir, load_wav_ir, shape_ir, matrix_norm, wtf_mag_norm, wtf_lecleach, wtf_morlet_lewalle, lewa_fftfreq, lewa_mymorlet, content

% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle: Prof. Jacques Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
%--------------------------------------------------------
% start_wavelet
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%
% "start_wavelet" is a script to load impulse response files of various formats
% and to check valid import by simple impulse response and frequency response plot
%
% ir_time is the vector containing the time dat a of the IR file
% ir_amp is the vector containing the amplitude of the IR file
%
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii1_ir.m, fft_ir_raw, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle: Prof. Jacques Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------

%
%--------------------------------------------------------
% global declaration
%--------------------------------------------------------

global ir_file_name;

%--------------------------------------------------------
% introduction and prompt for debug option
%--------------------------------------------------------
disp("")
disp("")
disp("#######+++++++++++++++++++++++++++++++++++++++++##########")
disp("")
disp("")
disp("HELLO ! Wecome to DIY Audio Wavelet Analysis ! ")
disp("contributing authors : ")
disp("Michael Gerstgrasser ")
disp("Elias ")
disp("Jeaques Lewalle ")
disp("Jean-Michel Le Clea'ch")
disp("")
disp("You will be promted to pick your choices... ")
disp("")

k=0;
d_bug=1;
k=menu("Enter 1 for normal operation"," normal operation"," debug mode", "EXIT");

if k==1;
d_bug = 0;
endif;
if k==2;
d_bug=1;
disp("")
disp("DEBUG mode selected ! Additional progress information will be displayed")
endif;
if k==3;
disp("")
disp("DIY wavlet analysis will be terminated")
quit;
endif;


%--------------------------------------------------------
% prompt for file name
%--------------------------------------------------------

disp("")
disp("Make sure your impulse response file is located where it can be found by Octave")
disp("Make sure your impulse response file name avoids spaces and special characters")
disp("")
fflush (stdout);
ir_file_name=input("HELLO ! Please type in file name ( press ENTER for ir_file.wav )","s");

if isempty(ir_file_name);
ir_file_name="ir_file.wav"; % assign default
endif;

ir_file_name % display selected file name
disp("")
disp("")



%--------------------------------------------------------
% prompt for file type
%--------------------------------------------------------

k=0;


k=menu("HELLO ! Please select your impulse response file type","32 bit or 16 bit WAV file","ARTA txt file","two column TEXT file","one column TEXT file","EXIT");



if k==1,
disp("")
disp("please wait... ")
disp(ir_file_name) % display selected file name
disp("16 bit or 32 bit WAV file will be imported")
disp("")
disp("Make sure to use a 16 bit or 32 bit WAV impulse respones file")
[ir_time ir_amp] = load_wav_ir(d_bug); % load wav32 impulse response file and assign to variables ir_time, ir_amp
endif
if k==2,
disp("")
disp("please wait... ")
disp(ir_file_name)
disp("ARTA text file will be imported")
disp("")
disp("Make sure to use a TEXT impulse respones file exported from ARTA")
[ir_time ir_amp] = load_arta_txt_ir(d_bug); % load ARTA txt impulse response file and assign to variables ir_time, ir_amp
endif
if k==3,
disp("")
disp("please wait... ")
disp(ir_file_name) % display selected file name
disp("Two column TEXT file will be imported")
disp("")
disp("Make sure to use a plain TEXT, headerless, two column impulse response file")
disp("Make sure first column in your impulse response file contains time")
disp("Make sure second column in your impulse response file contains amplitude")
[ir_time ir_amp] = load_ascii_ir(d_bug); % load ascii impulse response file and assign to variables ir_time, ir_amp
endif
if k==4,
disp("")
disp("please wait... ")
disp(ir_file_name) % display selected file name
disp("One column TEXT file will be imported")
disp("")
disp("Make sure to use a plain TEXT, headerless, one column impulse response file")
disp("Make sure first column in your impulse response file contains amplitude")
disp("Check the following plot for correct impulse response file import")
[ir_time ir_amp] = load_ascii1_ir(d_bug); % load ascii impulse response file and assign to variables ir_time, ir_amp
endif
if k==5,
disp("")
disp("DIY wavlet analysis will be terminated")
quit;
endif;
%--------------------------------------------------------
% restore and display : samplerate , sample count , total time
%--------------------------------------------------------

disp("")
disp("")
disp("HELLO ! Properties of imported file :")
disp("")
sample_rate = 10/(ir_time(110)-ir_time(100)) % reconstruckt sample rate
samples = length(ir_amp) % sample count
total_time = samples / sample_rate % calculate total time of measurement


%--------------------------------------------------------
%--------------------------------------------------------


%--------------------------------------------------------
% plot impulse response to check correct import
%--------------------------------------------------------
clf;
disp("")
disp("")
disp("HELLO ! Please check the following plot for correct impulse respones file import")


figure(1)
plot (ir_time,ir_amp,"-;Impulse Response;")
set (gca (), "xlim", [0 0.1]);
title(["HELLO ! Please check plot below for correct impulse response import (first 100ms) ! "," Imported file: ",(ir_file_name)])

xlabel ("Time");
ylabel ("Amplitude");


disp("marker")
samples_trim = 1024;
ir_time_trim=ir_time;
ir_amp_trim=ir_amp;
[ir_time_trim, ir_amp_trim] = shape_ir (ir_time, ir_amp, samples_trim, d_bug);


%--------------------------------------------------------
% select wavelet analysis
%--------------------------------------------------------



k=0;
k=menu("HELLO ! please select wavlet analysis"," Jean-Michael LeCleach Wavelet Analysis"," Jeaques Lewalle Morlet Wavelet Analysis", " EXIT");

if k==1;
disp("")
disp("HELLO ! Wavelet analysis in progress - this may take a few minutes")
disp("------------ normalised impulse response will be displayed ------------ ")
disp("------------ wavelet plot will be displayed ------------ ")
disp("------------ normalised wavelet plot will be displayed ------------ ")
[wtf_t, wtf_f, wtf_mag] = wtf_lecleach (ir_time_trim, ir_amp_trim, d_bug) ;
endif;
if k==2;
disp("")
disp("HELLO ! Wavelet analysis in process - this may take a few minutes")
disp("------------ normalised impulse response plot will be displayed ------------ ")
disp("------------ wavelet plot will be displayed ------------ ")
disp("------------ normalised wavelet plot will be displayed ------------ ")
[wtf_t, wtf_f, wtf_mag] = wtf_morlet_lewalle (ir_time_trim, ir_amp_trim, d_bug);
endif;
if k==3;
disp("")
disp("DIY wavelet analysis will be terminated")
quit;
endif;


%--------------------------------------------------------
% plot normalised impulse response
%--------------------------------------------------------




figure(2)
clf(2);
plot (ir_time_trim,ir_amp_trim,"-;Impulse Response;")
set (gca (), "xlim", [0 0.1]);
title(["HELLO ! Please check plot below for correct impulse response import (first 100ms) ! "," Imported file: ",(ir_file_name)])
set (gca (), "xlim", [0 0.013]);
xlabel ("Time");
ylabel ("Amplitude");


%--------------------------------------------------------
% plot wavlet analysis
%--------------------------------------------------------

fmin = 1000; % or check for min freqeuncy to plot min(wtf_f);
fmax = max (wtf_f); % check for max freqeuncy to plot
mag_low_limit=-40; % set minimum magnitude


max_wtf_mag = max(max(wtf_mag)); % set peak magnitude to 0 dB
wtf_mag_norm = wtf_mag - max_wtf_mag;
wtf_mag_norm = max(mag_low_limit,wtf_mag_norm); % set minimum magnitude to mag_low_limit


figure (3);
clf(3);
pcolor (wtf_t, wtf_f, wtf_mag_norm);
shading ("interp");
colorbar (); % optional : colorbar ();
xlabel ("Time [ms]");
ylabel ("Freq [Hz]");
set (gca (), "yscale", "log");
set (gca (), "xlim", [-3 10]);
set (gca (), "ylim", [fmin fmax]);
title(["WTF spectrogram ",(ir_file_name)])
grid("on");



%--------------------------------------------------------
% plot normalised wavlet analysis
%--------------------------------------------------------


matrixx_norm = matrix_norm(wtf_mag, d_bug); % normalization feature


max_wtf_mag = max(max(matrixx_norm)); % set peak magnitude to 0 dB
matrixx_norm = matrixx_norm - max_wtf_mag;
matrixx_norm = max(mag_low_limit,matrixx_norm); % set minimum magnitude to mag_low_limit


figure (4);
clf(4);
pcolor (wtf_t, wtf_f, matrixx_norm);
shading ("interp");
colorbar (); % optional : colorbar ();
xlabel ("Time [ms]");
ylabel ("Freq [Hz]");
set (gca (), "yscale", "log");
set (gca (), "xlim", [-3 10]);
set (gca (), "ylim", [fmin fmax]);
title(["WTF spectrogram normalized ",(ir_file_name)])
grid("on");
 
function [ir_time, ir_amp] = load_arta_txt_ir (d_bug);

%--------------------------------------------------------
% load_arta_txt_ir
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software

% Copyright (C) 2010 Elias Pekonen % Contact information: user 'Elias' at www.diyaudio.com
% rewritten by Michael Gerstgrasser % Contact information: user 'mige0' at www.diyaudio.com
%
% " load_arta_txt_ir" is a functon to load impulse response files of ARTA txt export format
%
% inpt variables:
% d_bug is for providing additional information in case of debug mode
%
% output variables:
% "ir_time" is the vector containing the time data of the IR file
% "ir_amp" is the vector containing the amplitude of the IR file
%
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii_ir.m, load_ascii1_ir.m, load_arta_txt_ir, start_wavelet, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------
%

if d_bug == 1;
disp ("DEBUG REPORT: processing function : load_arta_txt_ir , please WAIT !" )
endif
%--------------------------------------------------------
% global declaration
%--------------------------------------------------------

global ir_file_name;

%--------------------------------------------------------


ir_file_name
disp("")

point_pos=rindex (ir_file_name, "."); % string extension detect
ir_local=ir_file_name(1:point_pos-1); % string extension delete


fid = fopen (ir_file_name);
fgetl (fid)
fgetl (fid)
fgetl (fid)
fgetl (fid)
data = zeros (2^18, 2);
i = 1;
while (! feof (fid) )
data (i++, :) = str2num (fgetl (fid));
endwhile
fclose (fid);

data = data(1 : i - 1, :);

% figure (1)
% plot (data:), 1), data:), 2));


ir_time = data:), 1);
ir_amp = data:), 2);


if d_bug == 1;
disp ("DEBUG REPORT: function : load_arta_txt_ir processed successfully" )
endif

endfunction
 
function [ir_time, ir_amp] = load_ascii1_ir(d_bug);

%--------------------------------------------------------
% load_ascii1_ir
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%
% "load_ascii1_ir" is a functon to load impulse response files of ARTA txt export format
%
%
% inpt variables:
% d_bug is for providing additional information in case of debug mode
%
% output variables:
% "ir_time" is the vector containing the time data of the IR file
% "ir_amp" is the vector containing the amplitude of the IR file
%
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii_ir.m, load_ascii1_ir.m, load_arta_txt_ir, start_wavelet, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------

if d_bug == 1;
disp ("DEBUG REPORT: processing function : load_ascii1_ir , please WAIT !" )
endif

global ir_file_name;
point_pos=rindex (ir_file_name, "."); % string extension detect
ir_local=ir_file_name(1:point_pos-1); % string extension delete
load ("-ascii", (ir_file_name));
ir=eval(ir_local); % save file content into varaible ir
ir_amp=ir;

%--------------------------------------------------------
% prompt for sampling rate
%--------------------------------------------------------

disp("")
fflush (stdout);
sampling_freq =input("type in sample rate [Hz], or press enter for 44100 Hz");

if isempty(sampling_freq);
sampling_freq =44100; % assign default
endif;

%--------------------------------------------------------

sampling_freq % display sampling frequency

time_incr=1/sampling_freq; % calculate sample time interval
samples=length(ir_amp);
last_sample=samples*time_incr-time_incr; % calculate sampling time
ir_time=(0:time_incr:last_sample); % calculate ir_time vector

%--------------------------------------------------------

if d_bug == 1;
disp ("DEBUG REPORT: function : load_ascii1_ir processed successfully" )
endif

endfunction
 
function [ir_time, ir_amp] = load_ascii_ir (d_bug) ;

%--------------------------------------------------------
% load_ascii_ir
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%
% "load_ascii_ir" is a functon to load impulse response files of ARTA txt export format
%
% inpt variables:
% d_bug is for providing additional information in case of debug mode
%
% output variables:
% "ir_time" is the vector containing the time data of the IR file
% "ir_amp" is the vector containing the amplitude of the IR file
%
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii_ir.m, load_ascii1_ir.m, load_arta_txt_ir, start_wavelet, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------
%

if d_bug == 1;
disp ("DEBUG REPORT: processing function : load_ascii_ir , please WAIT !" )
endif
%--------------------------------------------------------
% global declaration
%--------------------------------------------------------

global ir_file_name;

%--------------------------------------------------------

point_pos=rindex (ir_file_name, "."); % string extension detect
ir_local=ir_file_name(1:point_pos-1); % string extension delete
load ("-ascii", (ir_file_name));
ir=eval(ir_local); % save file content into varaible ir

ir_time=ir:),1);
ir_amp=ir:),2);

if d_bug == 1;
disp ("DEBUG REPORT: function : load_ascii_ir processed successfully" )
endif

endfunction
 
function [ir_time, ir_amp] = load_wav_ir (d_bug);

%--------------------------------------------------------
% load_wav_ir
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%
% "load_wav_ir" is a functon to load impulse response files of ARTA txt export format
%
% inpt variables:
% d_bug is for providing additional information in case of debug mode
%
% output variables:
% "ir_time" is the vector containing the time data of the IR file
% "ir_amp" is the vector containing the amplitude of the IR file
%
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii_ir.m, load_ascii1_ir.m, load_arta_txt_ir, start_wavelet, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------

if d_bug == 1;
disp ("DEBUG report: processing function : load_wav_ir , please WAIT !" )
endif
%--------------------------------------------------------
% global declaration
%--------------------------------------------------------

global ir_file_name;

%--------------------------------------------------------


point_pos=rindex (ir_file_name, "."); % string extension detect
ir_local=ir_file_name(1:point_pos-1); % string extension delete
[ir_amp,sampling_freq,Nbits]=wavread(ir_file_name);
sampling_freq % display sampling frequency
Bit=Nbits;
Bit % display resolution

time_incr=1/sampling_freq; % calculate sample time interval
samples=length(ir_amp);

last_sample=samples*time_incr-time_incr; % calculate sampling time
ir_time=(0:time_incr:last_sample); % calculate ir_time vector

if d_bug == 1;
disp ("DEBUG report: function : load_wav_ir processed successfully" )
endif

endfunction
 
function [ir_time_trim, ir_amp_trim] = shape_ir (ir_time, ir_amp, samples_trim, d_bug);

%--------------------------------------------------------
% shape_ir
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%
% "shape_ir" is a functon to shape teh response files for further processing.
% set IR peak to positive
% set IR peak to 3ms
% normalise IR peak to 1
% set IR length to samples_trim variabel
%
%
% output variables:
% "ir_time_shaped" is the vector containing the time data of the IR file
% "ir_amp_shaped" is the vector containing the amplitude of the IR file
%
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii_ir.m, load_ascii1_ir.m, load_arta_txt_ir, start_wavelet, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------

if d_bug == 1;
disp ("DEBUG report: processing function : load_wav_ir , please WAIT !" )
endif

ir_time_trim = ir_time;
ir_amp_trim = ir_amp;

%----------- set IR peak to positive --------------------------

amp_max = max (ir_amp_trim);
amp_min = min (ir_amp_trim);

if abs(amp_min) >= abs(amp_max) % ceck if impulse is positive
ir_amp_trim = ir_amp_trim .* -1; % in case not : invert IR
endif



%----------- set peak to 3 ms --------------------------

samples = length (ir_time); % total number of samples
time_incr = (ir_time(110)-ir_time(100)) / 10; % check out time interval between samples
s_r_rec = 1 / time_incr; % reconstruckt sample rate
samples_3ms = fix(0.003 / time_incr); % sample count for 3ms


[max_amp, max_amp_pos] = max (ir_amp_trim);
max_amp_pos;
sample_diff = max_amp_pos - samples_3ms;

if sample_diff > 0
ir_amp_trim = ir_amp_trim(abs(sample_diff):end);
ir_time_trim = ir_time_trim(abs(sample_diff):end);
endif



%----------- set samples to "samples_trim" --------------------------

amp_length=length(ir_amp_trim);

if amp_length >= samples_trim % for sample numbers > samples_trim : truncate
ir_amp_trim = ir_amp_trim (1 : samples_trim);
endif

amp_length=length(ir_amp_trim);

if amp_length < samples_trim % for sample numbers < samples_trim : add samples
ir_amp_trim(amp_length:samples_trim) = [0];
endif

end_time = (samples_trim -1) * time_incr;
ir_time_trim =[0 : time_incr : end_time]; % restore correct frequency vecror



%----------- set IR peak to 1 --------------------------

ir_amp_f = 1 / max_amp;
ir_amp_trim = ir_amp_trim * ir_amp_f;



%-------------------------------------

disp("")
disp ("HELLO ! Samples got trimmed to : ")
samples_trim

if d_bug == 1;
disp ("DEBUG report: function : load_wav_ir processed successfully" )
endif

endfunction
 
function [matrixx_norm] = matrix_norm( matrixx, d_bug);

%--------------------------------------------------------
% function matrix_norm
%--------------------------------------------------------
% This file is part of Diy_Audio_WTF package, intended to get started on Audio Wavelet Transformation
% on free Octave software
% Copyright (C) 2010 Michael Gerstgrasser
%
% "matrix_norm" is a function to normalize a time frequency matrix and ploting
%
%
% matrixx is the input matix that has to be normalized
% matrixx_norm is the output matrix for any further processing
%
% see also load_wav_ir.m, load_ascii_ir.m, load_ascii_ir.m, load_ascii1_ir.m, load_arta_txt_ir, start_wavelet, waveletdemo.m

% Contributing authors to the Diy_Audio_WTF package in order of code publishing date:
%
% Michael Gerstgrasser - Contact information: user 'mige0' at www.diyaudio.com
% Elias Pekonen - Contact information: user 'Elias' at www.diyaudio.com
% J. Lewalle
%
% check out on www.diyaudio.com :
% "Help on making MULTIRESOLUTION WAVELET ANALYSIS available ?"
% http://www.diyaudio.com/forums/soft...ltiresolution-wavelet-analysis-available.html
% "WTF!? Wavelet TransForm for audio measurements - What-is? and How-to?"
% http://www.diyaudio.com/forums/mult...et-transform-audio-measurements-what-how.html
% "Horn Honk $$ WANTED $$"
% http://www.diyaudio.com/forums/multi-way/161627-horn-honk-wanted.html
%
% Diy_Audio_WTF (Wavelet Audio Analysis) is free software; you can redistribute it and/or modify it
% under the terms of the GNU General Public License as published by the
% Free Software Foundation; either version 2, or (at your option) any
% later version.
%
% Diy_Audio_WTF is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
% for more details.
%
% You should have received a copy of the GNU General Public License
% along with Diy_WAA; see the file COPYING. If not, write to the Free
% Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
%
%--------------------------------------------------------

if d_bug == 1;
disp ("DEBUG report: processing function : function matrix_norm , please WAIT !" )
endif


%------------------------ normalize matix ----------------------------------


max_max = max (max (matrixx)); % max-value in matrix

x_y_size = size(matrixx); % check for row and column lengrh of matrix
time_length = x_y_size(2); % check for x lengrh of matrix
ampl_length = x_y_size(1); % check for y lengrh of matrix

i = ampl_length;
while i > 0
max_max = max (max (matrixx)); % max-value in matrix
amp_max = max(matrixx(i, :)); % max-value of each colum (y)
norm_f = amp_max - max_max; % if matrix-z-value is scaled linear, use: norm_f = amp_max / max_max;

matrixx_norm(i, :) = [matrixx(i, :) .- norm_f]; % normalize matrix by each row to max_max value - if matrix-z-value is scaled linear, use : matrixx_norm(i, :) = [matrixx(i, :) ./ norm_f];
i = i-1;
endwhile



if d_bug == 1;
disp ("DEBUG report: matrix_norm processed successfully " )
endif

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