Sei sulla pagina 1di 6

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 Ill be doing some multimodal speech recognition soon, I downloaded the HTK and tried to compile it for Snow Leopard. This didnt work right away, and after scraping the bowels of the internet for help, Ive 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, dont 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 HTKDemo mkdir -p hmms/{tmp,hmm.{0,1,2,3}} proto acc test perl 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');

%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,'y axis'); title('Narrowband'); subplot(313) spectrogram(speech,wideband_N,wideband_OL,0:100:8000,F s,'yaxis'); title('Wideband');

Part d
length_30ms = round(.03*Fs); % find appropriate sample start positions vowelOneStartSample = round(0.29*Fs); vowelTwoStartSample =round(1.14*Fs); % isolate 30ms of interest for both vowels wave1 = speech(vowelOneStartSample:vowelOneStartSample+length_ 30ms); wave2 = speech(vowelTwoStartSample:vowelTwoStartSample+length_ 30ms); waveOne = wave1*hamming(length(wave1))'; waveTwo = wave2*hamming(length(wave2))';

% find the transform of the two segments WAVEONE = fft(waveOne,2^nextpow2(waveOne)); WAVETWO = fft(waveTwo,2^nextpow2(waveTwo)); W1_Mag = W2_Mag = W1_Phase W2_Phase 20*log10(abs(WAVEONE)); 20*log10(abs(WAVETWO)); = unwrap(angle(WAVEONE)); = unwrap(angle(WAVETWO));

figure(1) subplot(311) plot(linspace(vowelOneStartSample/Fs,vowelOneStartSamp le/Fs+.03,length(wave1)),wave1); axis tight,grid on title('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 on title('Magnitude Spectrum'),xlabel('Frequency (Hz)'),ylabel('Magnitude (dB)'); subplot(313) plot(linspace(0,Fs/2,length(W1_Phase)/2),W1_Phase(1:le ngth(W1_Phase)/2)) axis tight,grid on title('Phase Spectrum'),xlabel('Frequency (Hz)'),ylabel('Radius'); figure(2) subplot(311) plot(linspace(vowelTwoStartSample/Fs,vowelTwoStartSamp le/Fs+.03,length(wave2)),wave2); axis tight,grid on title('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 on title('Magnitude Spectrum'),xlabel('Frequency (Hz)'),ylabel('Magnitude (dB)');

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

Published with MATLAB 7.7

Potrebbero piacerti anche