Update of /cvsroot/loris/Loris/test
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16228/test
Modified Files:
test_Distiller.C test_Morpher.C test_Partial.C test_SdifFile.C
Log Message:
Fixed several sources of phase errors in synthesis. Use Breakpoint time
quantizing (in Resampler) to correctly move Breakpoints to sample instants
before synthesizing each Partial, and use fixFrequency to correct the
frequency envelopes after quanitizing the times. Synthesis accuracy is
much improved, residuals are smaller. Also changed the behavior of
Partial::phaseAt to return the synthesized phase, that is, the phase
computed forward from the preceeding Breakpoint, as would be synthesized.
Fixed a bug in SDIF export that was triggered by this phaseAt change,
now export Breakpoint data exactly, instead of using parametersAt data.
Index: test_Morpher.C
===================================================================
RCS file: /cvsroot/loris/Loris/test/test_Morpher.C,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** test_Morpher.C 2 Jan 2010 04:55:12 -0000 1.25
--- test_Morpher.C 10 Jan 2010 07:09:27 -0000 1.26
***************
*** 80,84 ****
#define EPSILON .01 // VERY lax with morphing, should be more rigorous
bool ret = false;
! if ( std::fabs(x) > 0. )
{
ret = std::fabs((x-y)/x) < EPSILON;
--- 80,84 ----
#define EPSILON .01 // VERY lax with morphing, should be more rigorous
bool ret = false;
! if ( std::fabs(x) > EPSILON )
{
ret = std::fabs((x-y)/x) < EPSILON;
Index: test_Distiller.C
===================================================================
RCS file: /cvsroot/loris/Loris/test/test_Distiller.C,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** test_Distiller.C 2 Jan 2010 04:55:12 -0000 1.20
--- test_Distiller.C 10 Jan 2010 07:09:27 -0000 1.21
***************
*** 46,53 ****
using namespace std;
// --- macros ---
// define this to see pages and pages of spew
! // #define VERBOSE
#ifdef VERBOSE
#define TEST(invariant) \
--- 46,60 ----
using namespace std;
+
+ #if defined(HAVE_M_PI) && (HAVE_M_PI)
+ const double Pi = M_PI;
+ #else
+ const double Pi = 3.14159265358979324;
+ #endif
+
// --- macros ---
// define this to see pages and pages of spew
! //#define VERBOSE
#ifdef VERBOSE
#define TEST(invariant) \
***************
*** 90,93 ****
--- 97,114 ----
#define SAME_PARAM_VALUES(x,y) TEST( float_equal((x),(y)) )
+ // ---------------------------------------------------------------------------
+ // wrapPi
+ // ---------------------------------------------------------------------------
+ // O'Donnell's phase wrapping function.
+ //
+ static inline double wrapPi( double x )
+ {
+ using namespace std; // floor should be in std
+ #define ROUND(x) (floor(.5 + (x)))
+ const double TwoPi = 2.0*Pi;
+ return x + ( TwoPi * ROUND(-x/TwoPi) );
+ }
+
+
// ----------- test_distill_manylabels -----------
//
***************
*** 423,427 ****
SAME_PARAM_VALUES( distit->amplitude(), compareit->amplitude() );
SAME_PARAM_VALUES( distit->bandwidth(), compareit->bandwidth() );
! SAME_PARAM_VALUES( distit->phase(), compareit->phase() );
++compareit;
--- 444,448 ----
SAME_PARAM_VALUES( distit->amplitude(), compareit->amplitude() );
SAME_PARAM_VALUES( distit->bandwidth(), compareit->bandwidth() );
! SAME_PARAM_VALUES( wrapPi( distit->phase() ), wrapPi( compareit->phase() ) );
++compareit;
Index: test_Partial.C
===================================================================
RCS file: /cvsroot/loris/Loris/test/test_Partial.C,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** test_Partial.C 2 Jan 2010 04:55:12 -0000 1.15
--- test_Partial.C 10 Jan 2010 07:09:27 -0000 1.16
***************
*** 104,108 ****
const double P1_AMPS[] = {.2, .2, .4};
const double P1_BWS[] = {0, 0, .2};
! const double P1_PHS[] = {-.8, .8, .8}; // std::fmod( .8 + (2 * Pi * (0.2*110)), 2. * Pi )};
for (int i = 0; i < NUM_BPTS; ++i )
--- 104,108 ----
const double P1_AMPS[] = {.2, .2, .4};
const double P1_BWS[] = {0, 0, .2};
! const double P1_PHS[] = {.8, .8, .8}; // std::fmod( .8 + (2 * Pi * (0.2*110)), 2. * Pi )};
for (int i = 0; i < NUM_BPTS; ++i )
***************
*** 197,201 ****
const double P1_AMPS[] = {.2, .2, .4};
const double P1_BWS[] = {0, 0, .2};
! const double P1_PHS[] = {-.8, .8, -1.2};
for (int i = 0; i < NUM_BPTS; ++i )
--- 197,201 ----
const double P1_AMPS[] = {.2, .2, .4};
const double P1_BWS[] = {0, 0, .2};
! const double P1_PHS[] = {.8, .8, -1.2};
for (int i = 0; i < NUM_BPTS; ++i )
Index: test_SdifFile.C
===================================================================
RCS file: /cvsroot/loris/Loris/test/test_SdifFile.C,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_SdifFile.C 2 Jan 2010 04:55:12 -0000 1.12
--- test_SdifFile.C 10 Jan 2010 07:09:27 -0000 1.13
***************
*** 50,54 ****
// define this to see pages and pages of spew
! // #define VERBOSE
#ifdef VERBOSE
#define TEST(invariant) \
--- 50,54 ----
// define this to see pages and pages of spew
! //#define VERBOSE
#ifdef VERBOSE
#define TEST(invariant) \
|