6 views

Uploaded by AngelRibeiro10

Matlab

- Broadband Wavelet Estimation
- DENOISER
- Income2018 Template (2)
- IECR Artikel
- Filter Calculation
- week2-6
- 3-8
- Jack Up Design
- es_sem04_paper_04307909
- Cep Strum
- Lecture 7
- Speech Assignment
- Sensing of Spectrum for SC-FDMA Signals in Cognitive Radio Networks
- 20071038
- nolisp07_version4
- Seismic capacity rating and reliability assessment of wood shear walls.pdf MJK
- Otc 23702
- SV03-999-71-001
- Chapter 05
- 2227-diana-cs-ICTS2007

You are on page 1of 6

Objectives

q know one way to estimate the fundamental frequency of a section of speech signal from its spectrum

q know one way to estimate the fundamental frequency of a section of speech signal from its waveform

q know one way to estimate the formant frequencies from a section of speech signal

q appreciate some of the problems of fundamental frequency and formant frequency estimation

Outline

The general problem of fundamental frequency estimation is to take a portion of signal and to find the dominant

frequency of repetition. Difficulties arise from (i) that not all signals are periodic, (ii) those that are periodic may

be changing in fundamental frequency over the time of interest, (iii) signals may be contaminated with noise, even

with periodic signals of other fundamental frequencies, (iv) signals that are periodic with interval T are also

periodic with interval 2T, 3T etc, so we need to find the smallest periodic interval or the highest fundamental

frequency; and (v) even signals of constant fundamental frequency may be changing in other ways over the

interval of interest.

A reliable way of obtaining an estimate of the dominant fundamental frequency for long, clean, stationary speech

signals is to use the cepstrum. The cepstrum is a Fourier analysis of the logarithmic amplitude spectrum of the

signal. If the log amplitude spectrum contains many regularly spaced harmonics, then the Fourier analysis of the

spectrum will show a peak corresponding to the spacing between the harmonics: i.e. the fundamental frequency.

Effectively we are treating the signal spectrum as another signal, then looking for periodicity in the spectrum itself.

The cepstrum is so-called because it turns the spectrum inside-out. The x-axis of the cepstrum has units of

quefrency, and peaks in the cepstrum (which relate to periodicities in the spectrum) are called rahmonics.

To obtain an estimate of the fundamental frequency from the cepstrum we look for a peak in the quefrency

region corresponding to typical speech fundamental frequencies. Here is an example:

[x,fs]=wavread('six.wav',[24120 25930]);

ms1=fs/1000; % maximum speech Fx at 1000Hz

ms20=fs/50; % minimum speech Fx at 50Hz

%

% plot waveform

t=(0:length(x)-1)/fs; % times of sampling instants

subplot(3,1,1);

plot(t,x);

legend('Waveform');

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html 1/6

6/6/2014 Introduction to Computer Programming with MATLAB

xlabel('Time (s)');

ylabel('Amplitude');

%

% do fourier transform of windowed signal

Y=fft(x.*hamming(length(x)));

%

% plot spectrum of bottom 5000Hz

hz5000=5000*length(Y)/fs;

f=(0:hz5000)*fs/length(Y);

subplot(3,1,2);

plot(f,20*log10(abs(Y(1:length(f)))+eps));

legend('Spectrum');

xlabel('Frequency (Hz)');

ylabel('Magnitude (dB)');

%

% cepstrum is DFT of log spectrum

C=fft(log(abs(Y)+eps));

%

% plot between 1ms (=1000Hz) and 20ms (=50Hz)

q=(ms1:ms20)/fs;

subplot(3,1,3);

plot(q,abs(C(ms1:ms20)));

legend('Cepstrum');

xlabel('Quefrency (s)');

ylabel('Amplitude');

To search for the index of the peak in the cepstrum between 1 and 20ms, and then convert back to hertz, use:

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html 2/6

6/6/2014 Introduction to Computer Programming with MATLAB

[c,fx]=max(abs(C(ms1:ms20)));

fprintf('Fx=%gHz\n',fs/(ms1+fx-1));

The cepstrum works best when the fundamental frequency is not changing too rapidly, when the fundamental

frequency is not too high and when the signal is relatively noise-free. A disadvantage of the cepstrum is that it

involves computationally-expensive frequency-domain processing.

The cepstrum looks for periodicity in the log spectrum of the signal, whereas our perception of pitch is more

strongly related to periodicity in the waveform itself. A means to estimate fundamental frequency from the

waveform directly is to use autocorrelation. The autocorrelation function for a section of signal shows how well

the waveform shape correlates with itself at a range of different delays. We expect a periodic signal to correlate

well with itself at very short delays and at delays corresponding to multiples of pitch periods.

This code plots the autocorrelation function for a section of speech signal:

[x,fs]=wavread('six.wav',[24120 25930]);

ms20=fs/50; % minimum speech Fx at 50Hz

%

% plot waveform

t=(0:length(x)-1)/fs; % times of sampling instants

subplot(2,1,1);

plot(t,x);

legend('Waveform');

xlabel('Time (s)');

ylabel('Amplitude');

%

% calculate autocorrelation

r=xcorr(x,ms20,'coeff');

%

% plot autocorrelation

d=(-ms20:ms20)/fs; % times of delays

subplot(2,1,2);

plot(d,r);

legend('Autocorrelation');

xlabel('Delay (s)');

ylabel('Correlation coeff.');

You can see that the autocorrelation function peaks at zero delay and at delays corresponding to 1 period,

2 periods, etc. We can estimate the fundamental frequency by looking for a peak in the delay interval

corresponding to the normal pitch range in speech, say 2ms(=500Hz) and 20ms (=50Hz). For example:

ms20=fs/50 % minimum speech Fx at 50Hz

% just look at region corresponding to positive delays

r=r(ms20+1:2*ms20+1)

[rmax,tx]=max(r(ms2:ms20))

fprintf('rmax=%g Fx=%gHz\n',rmax,fs/(ms2+tx-1));

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html 3/6

6/6/2014 Introduction to Computer Programming with MATLAB

The autocorrelation approach works best when the signal is of low, regular pitch and when the spectral content

of the signal is not changing too rapidly. The autocorrelation method is prone to pitch halving errors where a

delay of two pitch periods is chosen by mistake. It can also be influenced by periodicity in the signal caused by

formant resonances, particularly for female voices where F1 can be lower in frequency than Fx.

Estimation of formant frequencies is generally more difficult than estimation of fundamental frequency. The

problem is that formant frequencies are properties of the vocal tract system and need to be inferred from the

speech signal rather than just measured. The spectral shape of the vocal tract excitation strongly influences the

observed spectral envelope, such that we cannot guarantee that all vocal tract resonances will cause peaks in the

observed spectral envelope, nor that all peaks in the spectral envelope are caused by vocal tract resonances.

The dominant method of formant frequency estimation is based on modelling the speech signal as if it were

generated by a particular kind of source and filter:

This type of analysis is called source-filter separation, and in the case of formant frequency estimation, we are

interested only in the modelled system and the frequencies of its resonances. To find the best matching system

we use a method of analysis called Linear Prediction. Linear prediction models the signal as if it were

generated by a signal of minimum energy being passed through a purely-recursive IIR filter.

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html 4/6

6/6/2014 Introduction to Computer Programming with MATLAB

We will demonstrate the idea by using LPC to find the best IIR filter from a section of speech signal and then

plotting the filter's frequency response.

[x,fs]=wavread('six.wav',[24120 25930]);

% resample to 10,000Hz (optional)

x=resample(x,10000,fs);

fs=10000;

%

% plot waveform

t=(0:length(x)-1)/fs; % times of sampling instants

subplot(2,1,1);

plot(t,x);

legend('Waveform');

xlabel('Time (s)');

ylabel('Amplitude');

%

% get Linear prediction filter

ncoeff=2+fs/1000; % rule of thumb for formant estimation

a=lpc(x,ncoeff);

%

% plot frequency response

[h,f]=freqz(1,a,512,fs);

subplot(2,1,2);

plot(f,20*log10(abs(h)+eps));

legend('LP Filter');

xlabel('Frequency (Hz)');

ylabel('Gain (dB)');

To find the formant frequencies from the filter, we need to find the locations of the resonances that make up the

filter. This involves treating the filter coefficients as a polynomial and solving for the roots of the polynomial.

Details are outside the scope of this course (see readings). Here is the code to find estimated formant

frequencies from the LP filter:

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html 5/6

6/6/2014 Introduction to Computer Programming with MATLAB

r=roots(a); % find roots of polynomial a

r=r(imag(r)>0.01); % only look for roots >0Hz up to fs/2

ffreq=sort(atan2(imag(r),real(r))*fs/(2*pi));

% convert to Hz and sort

for i=1:length(ffreq)

fprintf('Formant %d Frequency %.1f\n',i,ffreq(i));

end

Formant 2 Frequency 2310.6

Formant 3 Frequency 2770.9

Formant 4 Frequency 3489.9

Formant 5 Frequency 4294.8

Reading

provides more detail about linear prediction.

A mathematical treatment can be found in: J. Makhoul. Linear prediction: A tutorial review. Proceedings of the

IEEE, 63(4):561-580, April 1975.

A good set of lecture notes on the mathematics of speech signal processing can be found at:

http://mi.eng.cam.ac.uk/~ajr/SA95/SpeechAnalysis.html

Exercises

For these exercises, use the editor window to enter your code, and save your answers to files under your

account on the central server. When you save the files, give them the file extension of ".m". Run your programs

from the command window.

1. Write a program (ex101.m) that asks the user for a filename (WAV file), and plots a fundamental frequency

track against time for the whole signal using the cepstrum method. Use a window size of 30ms and an output

frame rate of 100 Fx samples/second.

2. Modify the previous exercise to use the autocorrelation method (ex102.m). In this program set the

fundamental frequency value to zero when the peak of the autocorrelation function is less than 0.5. This acts

as a crude voicing decision.

3. Write a program (ex103.m) that asks the user for a filename (WAV file), and produces a scatter plot of

formant peaks against time. Use a window size of 30ms and an output frame rate of 100 per second.

4. (Homework) Write a GUI program which asks you to say a vowel and plots the location of the vowel on a

Vowel Quadrilateral diagram (effectively F1 vs F2).

http://www.phon.ucl.ac.uk/courses/spsci/matlab/lect10.html 6/6

- Broadband Wavelet EstimationUploaded byvalstav
- DENOISERUploaded byAlejandro Olea
- Income2018 Template (2)Uploaded byPedro Viegas
- IECR ArtikelUploaded bymlsimhan
- Filter CalculationUploaded byThomas Joseph
- week2-6Uploaded byhadaspeery
- 3-8Uploaded byKassaye Gizaw
- Jack Up DesignUploaded byKirti Bairathi
- es_sem04_paper_04307909Uploaded byruhuna013
- Cep StrumUploaded byOgungbe Temitope Solomon
- Lecture 7Uploaded byMubashir Ghaffar
- Speech AssignmentUploaded byAnithPalat
- Sensing of Spectrum for SC-FDMA Signals in Cognitive Radio NetworksUploaded byIJRASETPublications
- 20071038Uploaded bynguyendaibka
- nolisp07_version4Uploaded byAnis Ben Aicha
- Seismic capacity rating and reliability assessment of wood shear walls.pdf MJKUploaded bygeorgescribd33
- Otc 23702Uploaded byyusuf2mail
- SV03-999-71-001Uploaded byKalle Hahne
- Chapter 05Uploaded bytrungnt1981
- 2227-diana-cs-ICTS2007Uploaded byImam Fathur
- An Introduction to Matched FiltersUploaded bybalaji_gawalwad9857
- 05747363Uploaded byClaudinei Aguiar
- Short Dsp BooklistUploaded byRonald Mulinde
- NoiseUploaded byMichael Ross
- BBAA.pdfUploaded byThangadurai Senthil Ram Prabhu
- Voxengo SPAN User Guide EnUploaded bymaja91za
- IntroductionUploaded byjimmy
- EEE351PCSlect02Uploaded byLaal Ali Raja
- easybalancermanual1Uploaded byFaisal Shahzad
- dic PRACHUploaded byLuis Bovetko

- edital_poscomp 2018Uploaded byAngelRibeiro10
- A Survey of Heterogeneous Information Network AnalysisUploaded byAngelRibeiro10
- Language, Music and Computing - Mitrenina, Eds - 2019.pdfUploaded byAngelRibeiro10
- Overlap Coefficient - WikipediaUploaded byAngelRibeiro10
- Review Text BasedUploaded byAngelRibeiro10
- ontolog-social-web-keynote.pdfUploaded byAngelRibeiro10
- egc2013_tutoriel_MissaouiUploaded byAngelRibeiro10
- Guide to Unconventional Computing for MusicUploaded bySonnenschein
- Fundamentals of Algorithmics Brassard InglesUploaded byTusharVatsa
- inplementar.pdfUploaded byAngelRibeiro10
- Biopython_Tutorial.pdfUploaded byAngelRibeiro10
- Quando eu era um filhoteUploaded byAngelRibeiro10
- Ontolog Social Web KeynoteUploaded byAngelRibeiro10
- Text MiningUploaded byAngelRibeiro10
- curso_grafos_handout201009Uploaded byAngelRibeiro10
- Guia.politicamente.incorreto.da.Historia.do.BrasilUploaded byCleber Daniel Paiva
- acustica.txtUploaded byAngelRibeiro10
- Redes ComplexasUploaded byAngelRibeiro10
- jumping-nlp-curves.pdfUploaded byAngelRibeiro10
- How to Use the Hungarian Algorithm_ 10 Steps (With Pictures)Uploaded byAngelRibeiro10
- natural language processingUploaded byAngelRibeiro10
- Aristóteles - Arte PoéticaUploaded byFellipe Ferini dos Santos
- Sound LabUploaded byAngelRibeiro10
- Beethoven's Letters. (1790--1826.) Vol. iUploaded byAngelRibeiro10
- Redes Complexas 2Uploaded byAngelRibeiro10
- Jacard vs PMIUploaded byAngelRibeiro10
- inplementar.pdfUploaded byAngelRibeiro10
- book_270.pdfUploaded bygerman2210
- Programa Escola RCUploaded byAngelRibeiro10

- Tool - Sober DrumsUploaded byGraham M
- DATA VIDEO SE 800 MANUALUploaded byTheotech Eletron
- CA3102Uploaded bybonaparteCWB
- WVCS854BUploaded byCharlie Cahuich Albornos
- Final Exam Music AppreciationUploaded byTara Harris
- Boss Me20 EngUploaded byflipponzio
- R SIMILARUploaded bygayathridevikg
- SR6-RadarReflectoren DS en LRUploaded bygustian141
- JAYBEAM_5880200Uploaded byvyshy
- hamlet act ii questionsUploaded byapi-220782261
- Avid Understanding HD GuideUploaded byclaxpro
- YN560IVyUploaded byJupe PC
- Editors Interplay Workflow GuideUploaded byMENDES
- LINSAY F10XHD USER Manual.pdfUploaded bygeorgegarcia2794
- Hall and Oates - Kiss is on My List (Pro)Uploaded byCarlos Jimenez
- CradlePoint ARC CBA750Uploaded byBuchi Reddy
- Media ShortlistUploaded byadobo magazine
- Fourier Series(Signal Processing) NewUploaded byRidaNaeem
- Mic Nady CM100 UserguideUploaded bylg900df5063
- A340 Memory ItemsUploaded byPunthep Punnotok
- LearnEnglish Starting Out Episode 01 Support PackUploaded byHelder Prado
- Ana B'Koach Round 1Uploaded bybob
- Manual Corsair k70Uploaded bydreyes81
- 101056291 4 Songbook BeyonceUploaded byNinjasushii
- 2m_pa_4cx250.pdfUploaded byucnop
- CcmUploaded bySean MacNair
- WorkBook Answer KeyUploaded bykohlani
- X1_with_2014Uploaded byZaman Ashraf Uz
- JET AIRWAYS PILOT (TFO) WRITTEN EXAM PREPARATORY CLASSESUploaded byAaron Lim
- AW-NewspaperChase.pdfUploaded bysdasdasd