[Clam-devel] [patch] patch for finding polynomial roots: the route to formants

abe kazemzadeh kazemzad at usc.edu
Thu Jul 5 10:18:33 PDT 2007

Hi All,

Here's a patch of what I've been working on.  I added a method to LPModel
to get the roots (poles) of the LPC coefficients.  Since it is a general
not specific to LPC, I made a new class, Polynomial, in CLAM/src/Standard.
I'm not sure if this is the best location to put it.  Also, in this class
there are
methods that might be better in separate classes (eg, finding the
of a matrix:  there seem to be some stubs for this purpose in
CLAM/src/Standard/MatrixTmplDec.hxx:217), so let me know if anyone has
ideas about this.

I added a method to LPModel, LPModel::ToRoots(), which just calls the root
solving function of the new class, Polynomial::PolyRoots() on the lpc
PolyRoots takes the lpc coefficients, creates a companion matrix
(Polynomial::BuildCompanion()), balances it,and then gets the eigenvalues of

this matrix (Polynomial::EigenHessenberg()).  This output is the roots,
are the formants of speech.  However, I haven't converted them from their
representation to the frequency yet.  Also, for actual formant tracking, I
still need to add
ways to smooth the output.  It's still a bit rough, but I wanted to get
feedback before
further work.

Some issues:

-right now the default lpc order is 11.  This seems like the textbook value
people quote, but I think that it applies to speech coding in 8kHz, so for
sampling rates it might be better to have a higher
order.  I dug out the notes from
the speech processing class that I took and there is a nice derivation of
how to pick
the order (based on the sampling rate, the length of the vocal tract, and
the speed of
sound).  I'm not sure how feasible it would be to get the LPModel class to
itself based on the sampling rate, but this would make it convenient for the
user.  Either
that or downsampling to 8kHz before calculating the LPC/formants (it seems
that that
might be what Sandra Gilabert did).

-I implemented one of the algorithms that I found online that seemed good.
considered LAPACK++, but didn't use it b/c it seemed like a lot to learn
when I
was already learning clam.  In retrospect, it took me a fair amount of time
translate, debug, and test the algorithm I used, making LAPACK seem good in
so I wanted to see if anyone on the list is familiar with it LAPACK.

-one of the constants in the algorithm is epsilon, a tiny value such that
less is negligible.  I was trying to see if CLAM has such a constant and I
something in CLAM/test/UnitTests/cppUnitHelper.hxx:174, but I couldn't
figure out
what it was or how to use it.

-The patch has some extraneous details, but I didn't want to edit the
file b/c I'm not sure if
that would screw up the patch format (eg, taking out what seems to be a
binary file and changes
unrelated to the work I"m submitting).  Also, if anyone has any knowledge
about how to make
emacs give the same indentation format as the clam style, that would be

-I tested out the algorithm manually, but I was wondering about automatic
tests: would that be
good or necessary, and if so, could someone point me in the right direction
for doing this.

Thanks for the feedback,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20070705/eea30ef5/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: polynomial_rootsolving_for_formant_extraction.patch
Type: application/octet-stream
Size: 18302 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20070705/eea30ef5/attachment-0003.obj>

More information about the clam-devel mailing list