# HG changeset patch # User idamnjanovic # Date 1272375180 0 # Node ID fc395272d53e089e16e1d2b7c308d195c660a5fd # Parent 636a2a3d730200bc8b80ae02c920c76b45fed287 diff -r 636a2a3d7302 -r fc395272d53e util/AMT_analysis.m --- a/util/AMT_analysis.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/AMT_analysis.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,7 +1,15 @@ function AMT_res = AMT_analysis(Problem, solver) %%% Automatic Music Transcription results analysis -% Ivan Damnjanovic 2009 -% +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % If wav file that is transcribed is generated from midi file (i.e. if % groundtruth exists) transcription is comapred to the original notes and % AMT_res structure is generated. It contains following fields: diff -r 636a2a3d7302 -r fc395272d53e util/Pierre_reconstruct.m --- a/util/Pierre_reconstruct.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/Pierre_reconstruct.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,5 +1,15 @@ function reconstructed=Pierre_reconstruct(y, Problem) -%% Pierre Villars Example - reconstruction function +%%% Pierre Villars Example - reconstruction function +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This example is based on the experiment suggested by Professor Pierre % Vandergheynst on the SMALL meeting in Villars. diff -r 636a2a3d7302 -r fc395272d53e util/SL_A.m --- a/util/SL_A.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SL_A.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,20 +1,28 @@ - function y = SL_A(A, mode, m, n, x, I, dim) - % Ivan Damnjanovic 2009 - % This is auxilary function to allow implicit matrices from SPARCO - % to be used with SparsLab solvers - - global SMALL - if (mode == 1) +function y = SL_A(A, mode, m, n, x, I, dim) +%%% Sparco to SparseLab implicit matix conversion +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% This is auxilary function to allow implicit matrices from SPARCO +% to be used with SparsLab solvers + +if (mode == 1) - u = zeros(dim, 1); - u(I) = x; - y = A(u,1); - - elseif (mode == 2) + u = zeros(dim, 1); + u(I) = x; + y = A(u,1); - x2 = A(x,2); - y = x2(I); - - end - - end \ No newline at end of file +elseif (mode == 2) + + x2 = A(x,2); + y = x2(I); + +end + +end \ No newline at end of file diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_AMT_plot.m --- a/util/SMALL_AMT_plot.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_AMT_plot.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,21 +1,30 @@ function figAMT=SMALL_AMT_plot(SMALL, AMT_res) -% Ivan Damnjanovic 2010 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % Function gets as input SMALL structure and plots AMT - - figAMT=figure('Name','Automatic Music Transcription'); - - m=size(AMT_res,2); - + +figAMT=figure('Name','Automatic Music Transcription'); + +m=size(AMT_res,2); + for i =1:m - subplot(m,1, i);plot(AMT_res(i).tp_notes(:,2), AMT_res(i).tp_notes(:,1),'ko', ... - AMT_res(i).tp_notes(:,4), AMT_res(i).tp_notes(:,3),'gx', ... + subplot(m,1, i);plot(AMT_res(i).tp_notes(:,2), AMT_res(i).tp_notes(:,1),'ko', ... + AMT_res(i).tp_notes(:,4), AMT_res(i).tp_notes(:,3),'gx', ... AMT_res(i).oe_notes(:,2), AMT_res(i).oe_notes(:,1),'bo', ... - AMT_res(i).oe_notes(:,4), AMT_res(i).oe_notes(:,3),'bx', ... - AMT_res(i).fn_notes_wo_oe(:,2), AMT_res(i).fn_notes_wo_oe(:,1),'ro', ... - AMT_res(i).fp_notes_wo_oe(:,2), AMT_res(i).fp_notes_wo_oe(:,1),'rx') - title(sprintf('%s dictionary in %.2f s - TP=%d FN=%d (Octave Errors = %d) FP=%d', SMALL.DL(i).name, SMALL.DL(i).time, AMT_res(i).TP, AMT_res(i).FN, size(AMT_res(i).oe_notes,1), AMT_res(i).FP)); - xlabel('Time') - ylabel('Note Number') - + AMT_res(i).oe_notes(:,4), AMT_res(i).oe_notes(:,3),'bx', ... + AMT_res(i).fn_notes_wo_oe(:,2), AMT_res(i).fn_notes_wo_oe(:,1),'ro', ... + AMT_res(i).fp_notes_wo_oe(:,2), AMT_res(i).fp_notes_wo_oe(:,1),'rx') + title(sprintf('%s dictionary in %.2f s - TP=%d FN=%d (Octave Errors = %d) FP=%d', SMALL.DL(i).name, SMALL.DL(i).time, AMT_res(i).TP, AMT_res(i).FN, size(AMT_res(i).oe_notes,1), AMT_res(i).FP)); + xlabel('Time') + ylabel('Note Number') + end diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_AudioDeNoiseResult.m --- a/util/SMALL_AudioDeNoiseResult.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_AudioDeNoiseResult.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,4 +1,14 @@ function SMALL_AudioDeNoiseResult(SMALL) +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% fMain=figure('Name', sprintf('File %s (training set size- %d, sigma - %d)',SMALL.Problem.name, SMALL.Problem.n, SMALL.Problem.sigma)); m=size(SMALL.solver,2); diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_ImgDeNoiseResult.m --- a/util/SMALL_ImgDeNoiseResult.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_ImgDeNoiseResult.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,5 +1,14 @@ function SMALL_ImgDeNoiseResult(SMALL) -% Ivan Damnjanovic 2010 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % Function gets as input SMALL structure and plots Image Denoise % results: Original Image, Noisy Image and for learned dictionaries and % denoised images diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_denoise.m --- a/util/SMALL_denoise.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_denoise.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,7 +1,15 @@ function solver=SMALL_denoise(Problem, solver) - %%% SMALL denoising -% Ivan Damnjanovic 2009 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % Function gets as input SMALL structure that contains SPARCO problem to % be solved, name of the toolbox and solver, and parameters file for % particular solver. diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_init_DL.m --- a/util/SMALL_init_DL.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_init_DL.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,15 +1,24 @@ function DL = SMALL_init_DL(varargin) -% Ivan Damnjanovic 2010 - % Function initialise SMALL structure for Dictionary Learning. - % Optional input variables: - % toolbox - name of Dictionary Learning toolbox you want to use - % name - name of the algorithm from above toolbox - % param - parameters you want to set - %% - - DL.toolbox=[]; - DL.name=[]; - DL.param=[]; - DL.D=[]; - DL.time=[]; - end \ No newline at end of file +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% Function initialise SMALL structure for Dictionary Learning. +% Optional input variables: +% toolbox - name of Dictionary Learning toolbox you want to use +% name - name of the algorithm from above toolbox +% param - parameters you want to set +%% + +DL.toolbox=[]; +DL.name=[]; +DL.param=[]; +DL.D=[]; +DL.time=[]; +end \ No newline at end of file diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_init_solver.m --- a/util/SMALL_init_solver.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_init_solver.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,16 +1,26 @@ function solver = SMALL_init_solver(varargin) -% Ivan Damnjanovic 2010 - % Function initialise SMALL structure for Dictionary Learning. - % Optional input variables: - % toolbox - name of Dictionary Learning toolbox you want to use - % name - name of the algorithm from above toolbox - % param - parameters you want to set - %% - - solver.toolbox=[]; - solver.name=[]; - solver.param=[]; - solver.solution=[]; - solver.reconstructed=[]; - solver.time=[]; +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% Function initialise SMALL structure for Dictionary Learning. +% Optional input variables: +% toolbox - name of Dictionary Learning toolbox you want to use +% name - name of the algorithm from above toolbox +% param - parameters you want to set +%% + +solver.toolbox=[]; +solver.name=[]; +solver.param=[]; +solver.solution=[]; +solver.reconstructed=[]; +solver.time=[]; + end \ No newline at end of file diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_learn.m --- a/util/SMALL_learn.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_learn.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,6 +1,15 @@ function DL = SMALL_learn(Problem,DL) %%% SMALL Dictionary Learning -% Ivan Damnjanovic 2009 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % Function gets as input Problem and Dictionary Learning (DL) structures % In Problem structure field b with the training set needs to be defined % In DL fields with name of the toolbox and solver, and parameters file diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_midiGenerate.m --- a/util/SMALL_midiGenerate.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_midiGenerate.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,6 +1,14 @@ function reconstructed=SMALL_midiGenerate(V, Problem) %%% Reconstraction of midi file from representation in the given dictionary -% Ivan Damnjanovic 2009 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. % % SMALL_midiGenerate is a part of SMALLbox and can be use to reconstruct % a midi file given representation of the training set (V) in the @@ -9,7 +17,7 @@ % - reconstructed.notes - matrix with transcribed notes % - reconstructed.midi - midi representation of transcription - +%% U=Problem.A; % Dictionary used for representation fs=Problem.fs; % Sampling rate f=Problem.f; % vector of frequencies at wihch spectrogram is computed diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_playAudio.m --- a/util/SMALL_playAudio.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_playAudio.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,7 +1,17 @@ function SMALL_playAudio(SMALL) - % Ivan Damnjanovic 2009 - % Function gets as input SMALL structure and play the original and - % the reconstructed signal +%%% +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% Function gets as input SMALL structure and play the original and +% the reconstructed signal SMALL.solver.reconstructed = SMALL.Problem.reconstruct(SMALL.solver.solution); diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_plot.m --- a/util/SMALL_plot.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_plot.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,7 +1,17 @@ function SMALL_plot(SMALL) - % Ivan Damnjanovic 2009 - % Function gets as input SMALL structure and plots the solution and - % reconstructed signal +%%% Plots coefficients and reconstructed signals +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% Function gets as input SMALL structure and plots the solution and +% reconstructed signal figure; diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_solve.m --- a/util/SMALL_solve.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_solve.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,6 +1,15 @@ function solver = SMALL_solve(Problem, solver) %%% SMALL sparse solver -% Ivan Damnjanovic 2009 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % Function gets as input SMALL structure that contains SPARCO problem to % be solved, name of the toolbox and solver, and parameters file for % particular solver. diff -r 636a2a3d7302 -r fc395272d53e util/SMALL_swipe.m --- a/util/SMALL_swipe.m Tue Apr 27 13:32:46 2010 +0000 +++ b/util/SMALL_swipe.m Tue Apr 27 13:33:00 2010 +0000 @@ -1,13 +1,22 @@ function [p,s] = SMALL_swipe(X,fs, f, plim,dlog2p,dERBs,woverlap,sTHR) % -% Ivan Damnjanovic 2010 % -% This is modified swipep MATLAB code that is working directly in spectral -% domain and uses only one window size. The results are suboptimal -% comparing to original code. It is also converted to SWIPE which uses all -% the harmonics of the signal. +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. % -%SWIPEP Pitch estimation using SWIPE'. +% This program 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 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% +% +% This is modified swipep MATLAB code that is working directly in spectral +% domain and uses only one window size. The results are suboptimal +% comparing to original code. It is also converted to SWIPE which uses all +% the harmonics of the signal. +% +% SWIPEP Pitch estimation using SWIPE'. % P = SWIPEP(X,Fs,[PMIN PMAX],DT,DLOG2P,DERBS,STHR) estimates the pitch % of the vector signal X every DT seconds. The sampling frequency of % the signal is Fs (in Hertz). The spectrum is computed using a Hann @@ -60,6 +69,7 @@ % REFERENCES: Camacho, A., Harris, J.G, (2008) "A sawtooth waveform % inspired pitch estimator for speech and music," J. Acoust. Soc. Am. % 124, 1638-1652. + if ~ exist( 'plim', 'var' ) || isempty(plim), plim = [30 5000]; end %if ~ exist( 'dt', 'var' ) || isempty(dt), dt = 0.001; end if ~ exist( 'dlog2p', 'var' ) || isempty(dlog2p), dlog2p = 1/48; end