gerard@1: % Copyright 2013 MUSIC TECHNOLOGY GROUP, UNIVERSITAT POMPEU FABRA gerard@1: % gerard@1: % Written by Gerard Roma gerard@1: % gerard@1: % This program is free software: you can redistribute it and/or modify gerard@1: % it under the terms of the GNU Affero General Public License as published by gerard@1: % the Free Software Foundation, either version 3 of the License, or gerard@1: % (at your option) any later version. gerard@1: % gerard@1: % This program is distributed in the hope that it will be useful, gerard@1: % but WITHOUT ANY WARRANTY; without even the implied warranty of gerard@1: % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the gerard@1: % GNU Affero General Public License for more details. gerard@1: % gerard@1: % You should have received a copy of the GNU Affero General Public License gerard@1: % along with this program. If not, see . gerard@1: gerard@1: function [ features ] = analyze_files( input_files, tmp_path ) gerard@1: use_stored_features = 1; gerard@1: gerard@1: features = []; gerard@1: for i=1:length(input_files) gerard@1: disp(strcat('analyzing',input_files(i))); gerard@1: features = [features; analyze(input_files(i))]; gerard@1: end gerard@1: gerard@1: function ftrs = analyze(in_file) gerard@1: w = 40; gerard@1: h = 20; gerard@1: r = 0.03; gerard@1: dl = 2; gerard@1: vl = 2; gerard@1: [pathstr, name, ext] = fileparts(char(in_file)); gerard@1: tmp_fname = strcat(tmp_path,'/',name,'.mat'); gerard@1: if use_stored_features && (exist(tmp_fname)==2) gerard@1: load(tmp_fname); gerard@1: else gerard@1: [x,fs] = wavread(char(in_file)); gerard@1: x = x(:,1); gerard@1: mfcc = melfcc(x,fs,'minfreq',0,'maxfreq',900,'dither',1)'; gerard@1: N = max(size(mfcc)); gerard@1: steps = round(N/h); gerard@1: wrqa = []; gerard@1: for i = 0:steps-1 gerard@1: init = (i*h)+1; gerard@1: final = min((i*h)+w,N); gerard@1: ftr = mfcc(init:final,:); gerard@1: d = squareform(pdist(ftr,'cosine')); gerard@1: D = d