56 Wavefile::setDefaultSampleSize(32);
57 Wavefile::setIEEEFloat(
true);
63 cout <<
TEST_HEADER <<
"Testing Generator::drawLine(1.0, 1.0, 0.0) ...";
65 Buffer data = gen.drawLine(1.0, 1.0, 0.0);
72 gold <<
"gold/Generator_line1.wav";
79 if(abs_diff.getMax() >
GAMMA)
82 <<
"Output did not match gold file!"
87 diff.
plot(
"data - gold");
96 cout << TEST_HEADER <<
"Testing Generator::drawLine(1.26, -0.26, 0.26) ...";
98 data = gen.drawLine(1.26, -0.26, 0.26);
105 gold <<
"gold/Generator_line2.wav";
112 if(abs_diff.getMax() >
GAMMA)
115 <<
"Output did not match gold file!"
120 diff.
plot(
"data - gold");
130 cout << TEST_HEADER <<
"Testing Generator::buzz(1.0, 4.0, 3, 0.0) ...";
132 data = cos.buzz(1.0, 4.0, 3, 0.0);
139 gold <<
"gold/Generator_buzz1.wav";
146 if(abs_diff.getMax() >
GAMMA)
149 <<
"Output did not match gold file!"
154 diff.
plot(
"data - gold");
164 cout << TEST_HEADER <<
"Testing Generator::buzz(1.0, 4.0, 3, 0.5) ...";
166 data = cos.buzz(1.0, 4.0, 3, 0.5);
173 gold <<
"gold/Generator_buzz2.wav";
180 if(abs_diff.getMax() >
GAMMA)
183 <<
"Output did not match gold file!"
188 diff.
plot(
"data - gold");
197 cout << TEST_HEADER <<
"Testing Generator::buzz(1.0, 4.0, 4, 0.5) ...";
199 data = cos.buzz(1.0, 4.0, 4, 0.5);
206 gold <<
"gold/Generator_buzz3.wav";
213 if(abs_diff.getMax() >
GAMMA)
216 <<
"Output did not match gold file!"
221 diff.
plot(
"data - gold");
230 cout << TEST_HEADER <<
"Testing Generator::drawSine(1.0, 10.0) ...";
235 data << gen.drawSine(1.0, 10.0);
240 gold =
Buffer(
"gold/Generator_sine1.wav");
247 if(abs_diff.getMax() >
GAMMA)
250 <<
"Output did not match gold file!"
255 diff.
plot(
"data - gold");
264 cout << TEST_HEADER <<
"Testing Generator::drawSine(1.0, freqs) ...";
268 Buffer freqs(gen.drawLine(1.0, 1.0, 10.0));
270 data << gen.drawSine(1.0, freqs);
275 gold =
Buffer(
"gold/Generator_sine2.wav");
282 if(abs_diff.getMax() >
GAMMA)
285 <<
"Output did not match gold file!"
290 diff.
plot(
"data - gold");
299 cout << TEST_HEADER <<
"Testing Generator::drawSine2(1.0, 3.0, 0.5) ...";
303 data << gen.drawSine2(1.0, 3.0, 0.5);
308 gold =
Buffer(
"gold/Generator_sine3.wav");
315 if(abs_diff.getMax() >
GAMMA)
318 <<
"Output did not match gold file!"
323 diff.
plot(
"data - gold");
332 cout << TEST_HEADER <<
"Testing Generator::drawSine2(1.0, 3.0, phase) ...";
337 phase << gen.drawLine(1.0, 0.0, 1.0);
339 data << gen.drawSine2(1.0, 3.0, phase);
344 gold =
Buffer(
"gold/Generator_sine4.wav");
351 if(abs_diff.getMax() >
GAMMA)
354 <<
"Output did not match gold file!"
359 diff.
plot(
"data - gold");
368 cout << TEST_HEADER <<
"Testing Generator::drawSine2(1.0, freqs, 0.5) ...";
373 freqs << gen.drawLine(1.0, 0.0, 10.0);
375 data << gen.drawSine2(1.0, freqs, 0.5);
380 gold =
Buffer(
"gold/Generator_sine5.wav");
387 if(abs_diff.getMax() >
GAMMA)
390 <<
"Output did not match gold file!"
395 diff.
plot(
"data - gold");
404 cout << TEST_HEADER <<
"Testing Generator::drawSine2(1.0, freqs, phase) ...";
408 data << gen.drawSine2(1.0, freqs, phase);
413 gold =
Buffer(
"gold/Generator_sine6.wav");
420 if(abs_diff.getMax() >
GAMMA)
423 <<
"Output did not match gold file!"
428 diff.
plot(
"data - gold");
437 cout << TEST_HEADER <<
"Testing Generator::generate(1.0, freq) with chorus ...";
443 cos.setChorus(2, 0.50);
445 data << cos.generate(1.0, 5);
453 gold =
Buffer(
"gold/Generator_chorus1.wav");
460 if(abs_diff.getMax() >
GAMMA)
463 <<
"Output did not match gold file!"
467 pylab.
plot(data,
"r",
"label='data'");
468 pylab.
plot(gold,
"b",
"label='gold', lw=2");
void grid(boolean flag)
Sets the grid state.
static void show()
Acutally draw the plots to the screen.
void plot(const Buffer &y, const std::string &fmt="", const std::string &kwargs="")
Plots the Buffer on the current figure.
static const char * THIS_FILE
void plot(const std::string &title="Buffer") const
Requires matplotlib. Creates a plot of this Buffer.
void legend(const std::string &kwargs="")
Shows the legend on the current axes.
#define TEST_ERROR_HEADER
static const float64 GAMMA
void abs()
Modifies the Buffer by making any negative value positive.
A Buffer for storing audio samples.
A class the provides draw utilities and a wavetable oscillator.