annotate aim-mat/modules/usermodule/dualprofile/gendualprofile.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % generating function for 'aim-mat'
tomwalters@0 2 %
tomwalters@0 3 % INPUT VALUES:
tomwalters@0 4 %
tomwalters@0 5 % RETURN VALUE:
tomwalters@0 6 %
tomwalters@0 7 %
bleeck@3 8 % (c) 2011, University of Southampton
bleeck@3 9 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 10 % download of current version is on the soundsoftware site:
bleeck@3 11 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 12 % documentation and everything is on http://www.acousticscale.org
bleeck@3 13
tomwalters@0 14
tomwalters@0 15 function usermodule=gendualprofile(sai,options)
tomwalters@0 16
tomwalters@0 17 % find out about scaling:
tomwalters@0 18 maxval=-inf;
tomwalters@0 19 maxfreval=-inf;
tomwalters@0 20 maxsumval=-inf;
tomwalters@0 21
tomwalters@0 22 nr_frames=length(sai);
tomwalters@0 23 for ii=1:nr_frames
tomwalters@0 24 maxval=max([maxval getmaximumvalue(sai{ii})]);
tomwalters@0 25 maxsumval=max([maxsumval getscalesumme(sai{ii})]);
tomwalters@0 26 maxfreval=max([maxfreval getscalefrequency(sai{ii})]);
tomwalters@0 27 end
tomwalters@0 28
tomwalters@0 29 waithand = waitbar(0,'Generating dualprofile with peak detection');
tomwalters@0 30 for frame_number=1:nr_frames
tomwalters@0 31
tomwalters@0 32 waitbar(frame_number/nr_frames, waithand);
tomwalters@0 33
tomwalters@0 34 current_frame = sai{frame_number};
tomwalters@0 35 current_frame = setallmaxvalue(current_frame, maxval);
tomwalters@0 36 current_frame = setscalesumme(current_frame, maxsumval);
tomwalters@0 37 current_frame = setscalefrequency(current_frame, maxfreval);
tomwalters@0 38
tomwalters@0 39 usermodule{frame_number}.interval_sum = getsum(current_frame);
tomwalters@0 40 usermodule{frame_number}.frequency_sum = getfrequencysum(current_frame);
tomwalters@0 41 usermodule{frame_number}.channel_center_fq = getcf(sai{frame_number});
tomwalters@0 42 end
tomwalters@0 43 close(waithand);