annotate core/magnatagatune/MTTRandomFeature.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 % --
wolffd@0 2 % This class loads and hanles the aufdio features included with the MTT
wolffd@0 3 % Library
wolffd@0 4 % ---
wolffd@0 5 classdef MTTRandomFeature < MTTAudioFeature & handle
wolffd@0 6
wolffd@0 7 properties(Constant = true)
wolffd@0 8
wolffd@0 9 my_revision = str2double(substr('$Rev: 167 $', 5, -1));
wolffd@0 10 end
wolffd@0 11
wolffd@0 12 properties
wolffd@0 13
wolffd@0 14 % ---
wolffd@0 15 % Set default parameters
wolffd@0 16 % ---
wolffd@0 17 my_params = struct(...
wolffd@0 18 'nrandoms', 100 ...
wolffd@0 19 );
wolffd@0 20 end
wolffd@0 21 % ---
wolffd@0 22 % member functions
wolffd@0 23 % ---
wolffd@0 24 methods
wolffd@0 25
wolffd@0 26 % ---
wolffd@0 27 % constructor: pointer to feature in database
wolffd@0 28 % ---
wolffd@0 29 function feature = MTTRandomFeature(varargin)
wolffd@0 30
wolffd@0 31 feature = feature@MTTAudioFeature(varargin{:});
wolffd@0 32 end
wolffd@0 33
wolffd@0 34 % ---
wolffd@0 35 % load feature data from xml file
wolffd@0 36 % ---
wolffd@0 37 function data = extract(feature, clip)
wolffd@0 38 % load feature data by parsing xml
wolffd@0 39
wolffd@0 40 global globalvars;
wolffd@0 41
wolffd@0 42 % fprintf('parsing features for clip %d \n',clip.id());
wolffd@0 43
wolffd@0 44 % parse feature
wolffd@0 45 data.random = rand(feature.my_params.nrandoms, 1);
wolffd@0 46
wolffd@0 47 % save info data
wolffd@0 48 data.info.type = 'MTTRandomFeature';
wolffd@0 49 data.info.owner_id = clip.id;
wolffd@0 50 data.info.creatorrev = feature.my_revision;
wolffd@0 51
wolffd@0 52 % save param data
wolffd@0 53 data.info.params = feature.my_params;
wolffd@0 54
wolffd@0 55 % prepare field for final features
wolffd@0 56 data.final.vector = data.random;
wolffd@0 57 data.final.dim = numel(data.final.vector);
wolffd@0 58
wolffd@0 59 info = {'random'};
wolffd@0 60 info(2:data.final.dim) = num2cell(2:data.final.dim);
wolffd@0 61 data.final.vector_info.labels = info;
wolffd@0 62 end
wolffd@0 63
wolffd@0 64 function visualise(feature)
wolffd@0 65 % ---
wolffd@0 66 % plots the different data types collected in this feature
wolffd@0 67 % ---
wolffd@0 68
wolffd@0 69 end
wolffd@0 70 end
wolffd@0 71 end