annotate nonExposed/maxWindowEBR.m @ 51:ebf92ed7d680 tip master

Added -fd (--full-duration) argument.
author Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk>
date Sun, 30 Sep 2018 13:21:49 +0100
parents b1901e8d8f5f
children
rev   line source
mathieu@14 1 function s = maxWindowEBR(fg, bg, offset, fgScale)
mathieu@14 2 % Computes the maximum EBR on 1/4s windows of a FG relative to a BG when
mathieu@14 3 % that FG is at a given position in time.
mathieu@14 4 % Optional argument fgScale allows to compute what the EBR would be if FG
mathieu@14 5 % was scaled by that much.
mathieu@14 6
mathieu@14 7 % This program was written by Mathias Rossignol & Grégoire Lafay
mathieu@14 8 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr>
mathieu@14 9 %
mathieu@14 10 % This program is free software: you can redistribute it and/or modify it
mathieu@14 11 % under the terms of the GNU General Public License as published by the Free
mathieu@14 12 % Software Foundation, either version 3 of the License, or (at your option)
mathieu@14 13 % any later version.
mathieu@14 14 %
mathieu@14 15 % This program is distributed in the hope that it will be useful, but
mathieu@14 16 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
mathieu@14 17 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mathieu@14 18 % for more details.
mathieu@14 19 %
mathieu@14 20 % You should have received a copy of the GNU General Public License along
mathieu@14 21 % with this program. If not, see <http://www.gnu.org/licenses/>.
mathieu@14 22
mathieu@14 23 if (nargin==3) fgScale=1; end
mathieu@14 24 len=10000;
mathieu@14 25 for k=1:floor(2*length(fg)/len)
mathieu@14 26 t1 = (len/2)*(k-1)+1;
mathieu@14 27 t2 = min(t1+len-1, length(fg));
mathieu@14 28 if (t2-t1>10) snrs(k) = snr(fg(t1:t2), bg, offset+t1, fgScale); end
mathieu@14 29 end
mathieu@14 30 s = max(snrs);
mathieu@14 31 end