42 using namespace Nsound;
49 #define THIS_FILE "BufferResample_UnitTest.cc"
59 static const uint32 LM[4] = { 2,3,5,7 };
65 cout <<
TEST_HEADER <<
"Testing Buffer:getResample(L,M) ...";
73 for(
uint32 i = 1; i <= 4; ++i)
76 std::string gold_filename;
79 ss <<
"gold/BufferResample_out_" << i <<
"_" << LM[i-1] <<
".wav";
86 gold =
Buffer(ss.str().c_str());
90 if(gold.getLength() != data.
getLength() ||
94 <<
"Output did not match gold file!"
97 diff.
plot(
"data - gold");
108 ss <<
"gold/BufferResample_out_" << LM[i-1] <<
"_" << i <<
".wav";
115 gold =
Buffer(ss.str().c_str());
119 if(gold.getLength() != data.
getLength() ||
123 <<
"Output did not match gold file!"
126 diff.
plot(
"data - gold");
static void show()
Acutally draw the plots to the screen.
void plot(const std::string &title="Buffer") const
Requires matplotlib. Creates a plot of this Buffer.
Buffer getAbs() const
Modifies a copy of the Buffer by making any negative value positive.
uint32 getLength() const
Returns the number of samples in the Buffer.
#define TEST_ERROR_HEADER
virtual float64 generate(const float64 &frequency)
This is a real-time method for the wavetable oscillator.
static void setIEEEFloat(boolean flag)
A Buffer for storing audio samples.
Buffer getResample(float64 factor, const uint32 N=10, float64 beta=5.0) const
Resamples a copy of this Buffer using discrete-time resampling.
static void setDefaultSampleSize(uint32 size)
float64 getMax() const
Returns the maximum sample value in the Buffer.
void BufferResample_UnitTest()