diff --git a/src/BeatTracker.m b/src/BeatTracker.m index 26fdddf..ba3e718 100644 --- a/src/BeatTracker.m +++ b/src/BeatTracker.m @@ -104,7 +104,7 @@ function init_model(obj) function init_train_data(obj) % set up the training data and load or compute the cluster % assignments of the bars/beats - fprintf('* Set up training data ...\n'); + fprintf('* Set up training data\n'); % check if features are already saved if isfield(obj.Params, 'stored_train_data_fln') && ... exist(obj.Params.stored_train_data_fln, 'file') && ... @@ -156,7 +156,7 @@ function init_train_data(obj) obj.train_data = obj.train_data.read_pattern_bars(... obj.Params.clusterIdFln, obj.Params.pattern_size); else - fprintf('* Clustering data by %s ...\n', ... + fprintf('* Clustering data by %s: ', ... obj.Params.cluster_type); if ismember(obj.Params.cluster_type, {'meter', ... 'rhythm'}) @@ -180,7 +180,7 @@ function init_train_data(obj) 'plotting_path', obj.Params.results_path); end end - fprintf('done\n %i clusters detected.\n', ... + fprintf(' %i clusters detected.\n', ... obj.train_data.clustering.n_clusters); end obj.Params.R = obj.train_data.clustering.n_clusters; @@ -198,7 +198,7 @@ function init_test_data(obj) end function train_model(obj) - fprintf('* Training model (%s) ...\n',... + fprintf('* Training model (%s)\n',... obj.Params.inferenceMethod) if isempty(obj.init_model_fln) obj.model.train_model(obj.Params.transition_params, ... @@ -233,7 +233,7 @@ function train_model(obj) function results = do_inference(obj, test_file_id) [~, fname, ~] = fileparts(obj.test_data.file_list{test_file_id}); - fprintf('* Started inference on %s', fname); + fprintf('* Inferring meter from %s\n', fname); % load feature observations = obj.feature.load_feature(... obj.test_data.file_list{test_file_id}, ... diff --git a/src/BeatTrackingModelHMM.m b/src/BeatTrackingModelHMM.m index 85df1e9..734e6ed 100644 --- a/src/BeatTrackingModelHMM.m +++ b/src/BeatTrackingModelHMM.m @@ -132,7 +132,7 @@ function make_initial_distribution(obj, train_data) do_output, fname, y); elseif strcmp(inference_method, 'HMM_viterbi') % decode MAP state sequence using Viterbi - fprintf('* Decoding (viterbi) .'); + fprintf('* Decoding (viterbi)'); if exist('belief_func', 'var') % use viterbi with belief functions hidden_state_sequence = obj.viterbi_iteration(obs_lik, ... diff --git a/src/ParticleFilter.m b/src/ParticleFilter.m index 80e67e8..44f310f 100644 --- a/src/ParticleFilter.m +++ b/src/ParticleFilter.m @@ -25,7 +25,6 @@ debug = 0; % initialize particles and preallocate memory n_frames = size(obs_lik, 3); - perc = round(0.1*n_frames); % add one frame, which corresponds to the initial distribution % at time 0 before the first observation comes in m = zeros(obj.n_particles, n_frames + 1, 'single'); @@ -66,11 +65,7 @@ logP_data_pf(:, 4, iFrame) = w; logP_data_pf(:, 5, iFrame) = g; end - if rem(iFrame, perc) == 0 - fprintf('.'); - end end - fprintf('\n'); % remove initial state m = m(:, 2:end); n = n(:, 2:end); r = r(:, 2:end); if debug, save('/tmp/data_pf.mat', 'logP_data_pf', 'obs_lik'); end diff --git a/tests/ExamplesTest.m b/tests/ExamplesTest.m index ec2c20f..c78ab1f 100644 --- a/tests/ExamplesTest.m +++ b/tests/ExamplesTest.m @@ -11,6 +11,7 @@ methods (Test) function testEx1(testCase) addpath(testCase.example_path) + fprintf('\ntestEx1: \n'); % Beat tracking with a pre-trained HMM Results = ex1_beat_tracking_with_pretrained_hmm(... testCase.audio_files{1}, testCase.result_folder); @@ -22,6 +23,7 @@ function testEx1(testCase) function testEx2(testCase) addpath(testCase.example_path) + fprintf('\ntestEx2: \n'); % Beat tracking with a pre-trained PF % Initialize the random number generator using a seed of 1 % to make the results in this example repeatable @@ -36,6 +38,7 @@ function testEx2(testCase) function testEx3(testCase) addpath(testCase.example_path) + fprintf('\ntestEx3: \n'); rng('default'); rng(1); % Train a HMM and test it Results = ex3_train_and_test_hmm(testCase.audio_files{1}, ... @@ -48,6 +51,7 @@ function testEx3(testCase) function testEx4(testCase) addpath(testCase.example_path) + fprintf('\ntestEx4: \n'); rng('default'); rng(1); % Train a HMM and test it Results = ex4_train_and_test_hmm(testCase.audio_files{1}, ... @@ -60,6 +64,7 @@ function testEx4(testCase) function testEx5(testCase) addpath(testCase.example_path) + fprintf('\ntestEx5: \n'); rng('default'); rng(1); % Train a HMM and test it Results = ex5_train_and_test_pf(testCase.audio_files{1}, ... diff --git a/tests/run_all_tests.m b/tests/run_all_tests.m index d218c13..012a1c9 100644 --- a/tests/run_all_tests.m +++ b/tests/run_all_tests.m @@ -5,6 +5,6 @@ suiteFolder = TestSuite.fromFolder(pwd); % Add the bayesbeat class to the search path [func_path, ~, ~] = fileparts(mfilename('fullpath')); -addpath(fullfile(func_path, '..')) +addpath(fullfile(func_path, '../src')) % Test it result = run(suiteFolder); \ No newline at end of file