comparison Code/Descriptors/Matlab/MPEG7/FromWeb/VoiceSauce/func_VS2ssff.m @ 4:92ca03a8fa99 tip

Update to ICASSP 2013 benchmark
author Dawn Black
date Wed, 13 Feb 2013 11:02:39 +0000
parents
children
comparison
equal deleted inserted replaced
3:e1cfa7765647 4:92ca03a8fa99
1 function func_VS2ssff(data, id, outfile, variables)
2 % func_VS2ssff(data, id, outfile, variables)
3 % Notes: Saves the contents of a matfile into an EMU compatible output.
4 %
5 % Author: Yen-Liang Shue and Henry Tehrani, UCLA
6 % Copyright UCLA SPAPL 2009
7
8 % ssffsize=str2mat('CHAR', 'BYTE', 'SHORT', 'LONG', 'FLOAT', 'DOUBLE');
9 % matsize =str2mat('uchar', 'int8', 'int16', 'int32', 'float32', 'float64');
10
11 %create ssff header
12 samplerate = 1000 / variables.frameshift;
13 starttime = 0.0;
14 hdr=sprintf('%s\n', 'SSFF -- (c) SHLRC');
15 hdr=sprintf('%s%s\n', hdr, 'Machine IBM-PC');
16 hdr=sprintf('%s%s %i\n', hdr, 'Record_Freq', samplerate);
17 hdr=sprintf('%s%s %5.2f\n', hdr, 'Start_Time',starttime);
18 %hdr=sprintf('%s%s %s\n', hdr, 'Comment', comment);
19
20 hdr = sprintf('%s%s %s %s %i\n', hdr, 'Column', id, 'FLOAT', 1);
21 hdr=sprintf('%s%s\n', hdr, '-----------------');
22 %done with ssff header
23
24 % added 3/17/2010 - EMU is unable to read NaN
25 NaNvalue = str2double(variables.NotANumber);
26 if (isnan(NaNvalue))
27 NaNvalue = 0; % this is the default NaN value
28 end
29
30 data(isnan(data)) = NaNvalue;
31 data(isinf(data)) = NaNvalue;
32
33 fid=fopen(outfile,'w');
34 %write the header
35 fprintf(fid, '%s', hdr);
36 %write the parameter
37 fwrite(fid,data,'float32', 0,'ieee-le');
38
39 fclose(fid);
40
41
42