%Doug Van Nort
%
%This Matlab script computes the k means clustering part of an HMM timbre
%recgonition system. This is used for vector quantization of a discrete
%observation probability densities
%


%%for k-means clustering

 %***gather all of the data for cluserting and then apply k_means algorithm
%Warning:  using all 16600 samples and 75 cluster groups will cause a
%fairly long calculation (~15 minutes on G4 1.25 Ghz)

violin_cluster; 	

flute_cluster;

trumpet_cluster;


cluster_all = [clusterVall; clusterFall; clusterTall];

[cf,Centers_cluster] = doug_kmeans(cluster_all,75);	%apply k-means algorithm and return centerns 

codebook = [Centers_cluster(2:56,:);Centers_cluster(58:75,:)];      %there are two infs returned: at 1 and at 57. 									%We remove these.
%**********