Hi All,<br><br>Here's a patch of what I've been working on. I added a method to LPModel <br>to get the roots (poles) of the LPC coefficients. Since it is a general method, <br>not specific to LPC, I made a new class, Polynomial, in CLAM/src/Standard.
<br>I'm not sure if this is the best location to put it. Also, in this class there are <br>methods that might be better in separate classes (eg, finding the eigenvalues<br>of a matrix: there seem to be some stubs for this purpose in
<br>CLAM/src/Standard/MatrixTmplDec.hxx:217), so let me know if anyone has<br>ideas about this.<br><br>Overview:<br>I added a method to LPModel, LPModel::ToRoots(), which just calls the root<br>solving function of the new class, Polynomial::PolyRoots() on the lpc coefficients.
<br>PolyRoots takes the lpc coefficients, creates a companion matrix <br>(Polynomial::BuildCompanion()), balances it,and then gets the eigenvalues of <br>this matrix (Polynomial::EigenHessenberg()). This output is the roots, which
<br>are the formants of speech. However, I haven't converted them from their complex<br>representation to the frequency yet. Also, for actual formant tracking, I still need to add <br>ways to smooth the output. It's still a bit rough, but I wanted to get feedback before
<br>further work.<br><br>Some issues:<br><br> -right now the default lpc order is 11. This seems like the textbook value that<br>people quote, but I think that it applies to speech coding in 8kHz, so for higher<br>sampling rates it might be better to have a higher order. I dug out the notes from
<br> the speech processing class that I took and there is a nice derivation of how to pick<br>the order (based on the sampling rate, the length of the vocal tract, and the speed of <br>sound). I'm not sure how feasible it would be to get the LPModel class to configure
<br>itself based on the sampling rate, but this would make it convenient for the user. Either<br>that or downsampling to 8kHz before calculating the LPC/formants (it seems that that <br>might be what Sandra Gilabert did).
<br><br>-I implemented one of the algorithms that I found online that seemed good. I<br>considered LAPACK++, but didn't use it b/c it seemed like a lot to learn when I <br>was already learning clam. In retrospect, it took me a fair amount of time to
<br>translate, debug, and test the algorithm I used, making LAPACK seem good in retrospect,<br>so I wanted to see if anyone on the list is familiar with it LAPACK. <br><br>-one of the constants in the algorithm is epsilon, a tiny value such that anything
<br>less is negligible. I was trying to see if CLAM has such a constant and I found<br>something in CLAM/test/UnitTests/cppUnitHelper.hxx:174, but I couldn't figure out <br>what it was or how to use it.<br><br>-The patch has some extraneous details, but I didn't want to edit the file b/c I'm not sure if
<br> that would screw up the patch format (eg, taking out what seems to be a binary file and changes <br>unrelated to the work I"m submitting). Also, if anyone has any knowledge about how to make <br>emacs give the same indentation format as the clam style, that would be good.
<br><br>-I tested out the algorithm manually, but I was wondering about automatic tests: would that be<br>good or necessary, and if so, could someone point me in the right direction for doing this.<br><br>Thanks for the feedback,
<br>Abe <br><br>