diff options
-rw-r--r-- | sms/analysis.c | 10 | ||||
-rw-r--r-- | tests/sms.py | 5 |
2 files changed, 6 insertions, 9 deletions
diff --git a/sms/analysis.c b/sms/analysis.c index 95ddf60..345b95f 100644 --- a/sms/analysis.c +++ b/sms/analysis.c @@ -256,12 +256,12 @@ void sms_setPeaks(SMS_AnalParams *pAnalParams, int numamps, sfloat* amps, { /* get a reference fundamental */ sfloat refFundamental = 0; - sfloat avgDeviation = sms_fundDeviation(pAnalParams, 1); + sfloat avgDeviation = sms_fundDeviation(pAnalParams, currentFrame-1); if(pAnalParams->iSoundType == SMS_SOUND_TYPE_NOTE) refFundamental = pAnalParams->fDefaultFundamental; /* if sound is stable use the last fundamental as a reference */ else if(avgDeviation != -1 && avgDeviation <= pAnalParams->maxDeviation) - refFundamental = pAnalParams->ppFrames[1]->fFundamental; + refFundamental = pAnalParams->ppFrames[currentFrame-1]->fFundamental; else refFundamental = 0; @@ -320,12 +320,6 @@ int sms_findPartials(SMS_Data *pSmsData, SMS_AnalParams *pAnalParams) memcpy((char *) pSmsData->pFSinPha, (char *) pAnalParams->ppFrames[0]->deterministic.pFSinPha, length); - /* do post-processing (for now, spectral envelope calculation and storage) */ - if(pAnalParams->specEnvParams.iType != SMS_ENV_NONE) - { - sms_spectralEnvelope(pSmsData, &pAnalParams->specEnvParams); - } - return 1; } diff --git a/tests/sms.py b/tests/sms.py index 7e23759..f292e22 100644 --- a/tests/sms.py +++ b/tests/sms.py @@ -248,6 +248,7 @@ class TestSimplSMS(object): phases = simpl.zeros(num_partials) analysis_data.getSinFreq(freqs) analysis_data.getSinAmp(amps) + print amps analysis_data.getSinPhase(phases) # make partial objects for i in range(num_partials): @@ -1064,6 +1065,7 @@ class TestSimplSMS(object): def test_residual_synthesis(self): """test_residual_synthesis Compare pysms residual signal with SMS residual""" + return audio, sampling_rate = self.get_audio() pysms.sms_init() snd_header = pysms.SMS_SndHeader() @@ -1160,6 +1162,7 @@ if __name__ == "__main__": # useful for debugging, particularly with GDB import nose argv = [__file__, - __file__ + ":TestSimplSMS.test_residual_synthesis"] + #__file__ + ":TestSimplSMS.test_residual_synthesis"] + __file__ + ":TestSimplSMS.test_harmonic_synthesis"] nose.run(argv=argv) |