code - function [th] = specgram_nist(winlgh, framerate,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
function [th] = specgram_nist(winlgh, framerate, sampling_rate, wavedir, nist_file, ieee); % % specgram_nist(winlgh, framerate, sampling_rate, wavedir, nist_file, ieee) % % function to compute a spectrogram % % winlgh = window length in samples - 400 % framerate = frame rate in num frames per second - 200 % sampling_rate = samples/sec - 16000 % wavedir = directory of the nist files - 'd:/TIMIT/TRAIN/DR1/MCPM0' % nist_file = nist file name - sa1 % ieee = ieee-be or ieee-le - ieee-le % % Created: Veton Kepuska, May 2005 % vkepuska@fit.edu; vkepuska@cfl.rr.com %---------------------------------------------------------------------------% % PARAMETERS % figure; %sampling_rate = 10000; % sampling rate lfft = 4*1024; % FFT length lfft2 = lfft/2; frmlgh = sampling_rate/framerate; noverlap = winlgh - frmlgh; %---------------------------------------------------------------------------% % Reading transcription transfile = sprintf( '%s/%s.txt' , wavedir, nist_file); disp(transfile); fid = fopen(transfile); if (fid ~= -1) titleline = fgetl(fid); strtitle = char(titleline); %disp(strtitle); firstch = 1; for i=2:length(strtitle) %disp(sprintf('%s isletter=%d ischar=%d %d', strtitle(i), isletter(strtitle(i)), ischar(strtitle(i)), i)); if isletter(strtitle(i)) firstch = i; break ; end end j=1; for i=firstch:length(strtitle) newtitle(j) = strtitle(i); j = j + 1; end newtitle = sprintf( '"%s"' , newtitle); %disp(newtitle); fclose(fid); else newtitle = sprintf( '????' );
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
end %---------------------------------------------------------------------------% %getting phoneme and corresponding sample number phnfile = sprintf( '%s/%s.phn' , wavedir, nist_file); fid = fopen(phnfile); phnFlag = 0; if (fid ~= -1) phnFlag = 1; i = 1; while 1 tline = fgetl(fid); if ~ischar(tline), break , end [s,e,ph] = strread(tline, '%d%d%s' , 'delimiter' , ' ' ); first(i) = s; last(i) = e; phn(i) = ph; % Not used since phoneme lables are rotated %l(i) = length(char(ph)); %disp(sprintf('[%d] %s', l(i), char(ph))); %disp(sprintf('[%d, %d]',s, e)); %disp(tline); i = i + 1; end fclose(fid); else disp(sprintf( 'Unable to open phoneme file: %s\n' , phnfile)); end %-------------------------------------------------------------------------- %getting word label file labfile = sprintf( '%s/%s.wrd' , wavedir, nist_file); fid = fopen(labfile); labFlag = 0 if (fid ~= -1) labFlag = 1; i = 1; while
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/11/2012 for the course ECE 5526 taught by Professor Staff during the Summer '09 term at FIT.

Page1 / 7

code - function [th] = specgram_nist(winlgh, framerate,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online