jamiebullock/LibXtract — pull request #53 by seanlikeskites (2014-02-25 14:49:29+00:00)
Title: Possible Corrections to Tristimulus Functions

I just took a look at the tristimulus functions.

If you use the output of xtract_harmonic_spectrum (as the documentation suggests) they do not work properly.

Say the input had energy in the first 3 harmonics and also in harmonics 5 and up. But no energy in the 4th. The current function would assume the energy in the 5th harmonic to be that of the 4th (because the output of xtract_harmonic_spectrum only includes harmonics which cause a spectral peak).

I have made some changes which solve this. Once again I changed the interface. You need to pass in the entire output of xtract_harmonic_spectrum and also the frequency of the fundamental. There may well be a solution which is tidier than this.

There may be a problem regarding with how this affects what happens if the output of xtract_peak_spectrum is used as the input. In these changes the input signal is treated as three separate bands.
* Any partial >= 0.5 and < 1.5 of the fundamental will be used for calculation of the 1st order tristimulus.
* Any partial >= 1.5 and < 4.5 of the fundamental will be used for calculation of the 2nd order tristimulus.
* Any partial >= 4.5 of the fundamental will be used for calculation of the 3rd order tristimulus.
I'm not sure how valid that is, I haven't read too much about the tristimulus measures.

Hopefully I have explained this reasonably coherently.

P.S. Sorry about this pull request having all the stuff from the other pull request I sent in it. I tried to put them on separate branches but I failed. My git usage is sloppy at best.