7
Compiling HTK for Mac OS X Snow Leopard 01.22.10 Posted in Mac OS X by Patrick The Hidden Markov Model Toolkit (HTK) is widely used in speech recognition research. Since I’ll be doing some multimodal speech recognition soon, I downloaded the HTK and tried to compile it for Snow Leopard. This didn’t work right away, and after scraping the bowels of the internet for help, I’ve finally managed to get it working. Use the following option to configure the Makefile: ./configure – -build=i686-apple-macos No space between the dashes in case you are copying and pasting this. And for one of my machines I had to add an option to the CFLAGS in the Makefile. Open the makefile with your favorite text editor and add the following to CFLAGS: -I/usr/include/malloc Also, don’t follow the instructions in the README for testing the installation. Instead, perform the following commands as found on the official HTK site for testing a Mac OS/Linux install. cd HTKDemomkdir -p hmms/{tmp,hmm.{0,1,2,3}} proto acc testperl runDemo configs/monPlainM1S1.dcf Problem 1

Compiling HTK for Mac OS X Snow Leopard

Embed Size (px)

Citation preview

Page 1: Compiling HTK for Mac OS X Snow Leopard

Compiling HTK for Mac OS X Snow Leopard01.22.10 Posted in Mac OS X by Patrick

The Hidden Markov Model Toolkit (HTK) is widely used in speech recognition research. Since I’ll be doing some multimodal speech recognition soon, I downloaded the HTK and tried to compile it for Snow Leopard. This didn’t work right away, and after scraping the bowels of the internet for help, I’ve finally managed to get it working.Use the following option to configure the Makefile: ./configure – -build=i686-apple-macosNo space between the dashes in case you are copying and pasting this. And for one of my machines I had to add an option to the CFLAGS in the Makefile. Open the makefile with your favorite text editor and add the following to CFLAGS:-I/usr/include/mallocAlso, don’t follow the instructions in the README for testing the installation. Instead, perform the following commands as found on the official HTK site for testing a Mac OS/Linux install.cd HTKDemomkdir -p hmms/{tmp,hmm.{0,1,2,3}} proto acc testperl runDemo configs/monPlainM1S1.dcf

Problem 1

Contents

• Record Audio • Parts a, b, and c • Part d Record Audio

r = audiorecorder(16000,16,1);recordblocking(r,2)recspeech = getaudiodata(r,'double');

Page 2: Compiling HTK for Mac OS X Snow Leopard

%figure(1)%plot(recspeech) 

Parts a, b, and c

[speech Fs] = wavread('PatOKeefe');

t = 0:1/Fs:length(speech)/Fs-1/Fs;

figure(1)subplot(311)plot(t,speech)

narrow_N = round(.02*Fs);narrow_OL = round(0.97*narrow_N);

wideband_N = round(narrow_N/4);wideband_OL = round(0.9*wideband_N);

subplot(312)spectrogram(speech,narrow_N,narrow_OL,0:100:8000,Fs,'yaxis');title('Narrowband');

subplot(313)spectrogram(speech,wideband_N,wideband_OL,0:100:8000,Fs,'yaxis');title('Wideband');

Page 3: Compiling HTK for Mac OS X Snow Leopard

Part d

length_30ms = round(.03*Fs);

% find appropriate sample start positionsvowelOneStartSample = round(0.29*Fs);vowelTwoStartSample =round(1.14*Fs);

% isolate 30ms of interest for both vowelswave1 = speech(vowelOneStartSample:vowelOneStartSample+length_30ms);wave2 = speech(vowelTwoStartSample:vowelTwoStartSample+length_30ms);

waveOne = wave1*hamming(length(wave1))';waveTwo = wave2*hamming(length(wave2))';

Page 4: Compiling HTK for Mac OS X Snow Leopard

% find the transform of the two segmentsWAVEONE = fft(waveOne,2^nextpow2(waveOne));WAVETWO = fft(waveTwo,2^nextpow2(waveTwo));

W1_Mag = 20*log10(abs(WAVEONE));W2_Mag = 20*log10(abs(WAVETWO));W1_Phase = unwrap(angle(WAVEONE));W2_Phase = unwrap(angle(WAVETWO));

figure(1)subplot(311)plot(linspace(vowelOneStartSample/Fs,vowelOneStartSample/Fs+.03,length(wave1)),wave1);axis tight,grid ontitle('Waveform for /@/'),xlabel('Time (sec)'),ylabel('Amplitude');

subplot(312)plot(linspace(0,Fs/2,length(W1_Mag)/2),W1_Mag(1:length(W1_Mag)/2));axis tight,grid ontitle('Magnitude Spectrum'),xlabel('Frequency (Hz)'),ylabel('Magnitude (dB)');

subplot(313)plot(linspace(0,Fs/2,length(W1_Phase)/2),W1_Phase(1:length(W1_Phase)/2))axis tight,grid ontitle('Phase Spectrum'),xlabel('Frequency (Hz)'),ylabel('Radius');

figure(2)subplot(311)plot(linspace(vowelTwoStartSample/Fs,vowelTwoStartSample/Fs+.03,length(wave2)),wave2);axis tight,grid ontitle('Waveform for /o/'),xlabel('Time (sec)'),ylabel('Amplitude');

subplot(312)plot(linspace(0,Fs/2,length(W2_Mag)/2),W2_Mag(1:length(W2_Mag)/2));axis tight,grid ontitle('Magnitude Spectrum'),xlabel('Frequency (Hz)'),ylabel('Magnitude (dB)');

Page 5: Compiling HTK for Mac OS X Snow Leopard

subplot(313)plot(linspace(0,Fs/2,length(W2_Phase)/2),W2_Phase(1:length(W2_Phase)/2))axis tight,grid ontitle('Phase Spectrum'),xlabel('Frequency (Hz)'),ylabel('Radius');

 

Page 6: Compiling HTK for Mac OS X Snow Leopard

Published with MATLAB® 7.7