function h_SoundModelToXML(Y,filename) % h_SoundModelToXML(SoundModelDS, filename) % - generates an XML file for SoundModelDS % % Author: Michael A. Casey % Language: Matlab % Based on ISO/IEC FDIS 15938-4 % % Version 2.0 % created 12/08/2003 Mpeg7_wrapper='Mpeg7_wrapper.xml'; if ~isempty(vargs.outputFile) fileName=vargs.outputFile; end %-------------------------- %determines the number of sample vectors %and the number of frequency bands [vectorSize totalNumOfSamples ]=size(V); %-------------------------- %creation of the xml file: try xmlFile=fopen(vargs.outputFile,'w'); %opens the file in write mode catch error(lasterr); end %------------------------- %XML generation: %Mpeg7 wrapper: try mpeg7File=fopen(Mpeg7_wrapper,'r'); %opens the file containing the Mpeg7 wrapper catch error(lasterr); end %copies the wrapper in the new XML file: while ~feof(mpeg7File) line=fgets(mpeg7File); fprintf(xmlFile,'%s',line); end fclose(mpeg7File); %Descriptor generation: fid = fopen(filename, 'wt'); if(fid<0) error('Could not open mp7 output file');end % % % fprintf(fid, '\t\n'); fprintf(fid, '\t\t\n', size(Y.T,1), size(Y.T,1)); for k=1:size(Y.T,1) fprintf(fid, '\t\t\t\t'); fprintf(fid, '%6.3f ', Y.T(k,:)); fprintf(fid, '\n'); end fprintf(fid, '\t\t\t\n'); % % % % % % % % SeriesOfVector % for m=1:size(Y.S,2) fprintf(fid, '\t\t\t\n'); fprintf(fid, '\t\t\t\t\n',m); fprintf(fid, '\t\t\t\n'); fprintf(fid, '\t\t\t\n'); fprintf(fid, '\t\t\t\t\n'); fprintf(fid, '\t\t\t\t\t',floor(median(Y.numFrames))); fprintf(fid, '\t\t\t\n'); fprintf(fid, '\t\t\tSeriesOfVector'); fprintf(fid, '\t\t\t\n'); % % 1.245 7.299 0.942 -3.185 -0.486 -0.552 -0.101 -0.373 -0.127 -0.159 -0.120 -0.064 -0.010 -0.088 -0.063 0.007 0.068 -0.038 -0.013 0.007 0.030 % fprintf(fid, '\t\t\t\n'); fprintf(fid, '\t\t\t\t', size(Y.M,2)); fprintf(fid, '%6.3f ', Y.M(m,:) ); fprintf(fid, '\n'); fprintf(fid, '\t\t\t\t\n', size(Y.C(:,:,m),1),size(Y.C(:,:,m),2)); C = Y.C(:,:,m); for l=1:size(C,1) fprintf(fid, '\t\t\t\t\t'); fprintf(fid, '%6.3f ', C(l,:)); % inv(K) fprintf(fid, '\n'); end fprintf(fid, '\t\t\t\t\n'); fprintf(fid, '\t\t\t\n'); end % % % % % % fprintf(fid, '\t\t\t< fprintf(fid, '\t\t\n'); fprintf(fid, ... '\t\t\t\n', ... size(Y.V,1), size(Y.V,2)); fprintf(fid, '\t\t\t\t\n', size(Y.V,1),size(Y.V,2)); for l=1:size(Y.V,1) fprintf(fid,'\t\t\t\t\t'); fprintf(fid,'%6.3f ', Y.V(l,:)); fprintf(fid,'\n'); end fprintf(fid, '\t\t\t\t\n'); fprintf(fid, '\t\t\t\n'); fprintf(fid, '\t\t\n'); fprintf(fid, '\n');