55 Wavefile::setDefaultSampleSize(64);
56 Wavefile::setIEEEFloat(
true);
63 freqs << sine.drawLine(1.0, 0.0, 10.0);
64 phase << sine.drawLine(1.0, 0.0, 1.0);
66 cout <<
TEST_HEADER <<
"Testing Sine::generate(1.0, 3.0) ...";
68 Buffer data = sine.generate(1.0, 3.0);
75 gold <<
"gold/Sine_1.wav";
82 if(abs_diff.getMax() >
GAMMA)
85 <<
"Output did not match gold file!"
88 diff.
plot(
"data - gold");
100 cout << TEST_HEADER <<
"Testing Sine::generate(1.0, freqs) ...";
102 data = sine.generate(1.0, freqs);
109 gold <<
"gold/Sine_2.wav";
116 if(abs_diff.getMax() >
GAMMA)
119 <<
"Output did not match gold file!"
122 diff.
plot(
"data - gold");
134 cout << TEST_HEADER <<
"Testing Sine::generate2(1.0, 3.0, 0.5) ...";
136 data = sine.generate2(1.0, 3.0, 0.5);
143 gold <<
"gold/Sine_3.wav";
150 if(abs_diff.getMax() >
GAMMA)
153 <<
"Output did not match gold file!"
156 diff.
plot(
"data - gold");
168 cout << TEST_HEADER <<
"Testing Sine::generate2(1.0, 3.0, phase) ...";
170 data = sine.generate2(1.0, 3.0, phase);
177 gold <<
"gold/Sine_4.wav";
184 if(abs_diff.getMax() >
GAMMA)
187 <<
"Output did not match gold file!"
190 diff.
plot(
"data - gold");
202 cout << TEST_HEADER <<
"Testing Sine::generate2(1.0, freqs, 0.5) ...";
204 data = sine.generate2(1.0, freqs, 0.5);
211 gold <<
"gold/Sine_5.wav";
218 if(abs_diff.getMax() >
GAMMA)
221 <<
"Output did not match gold file!"
224 diff.
plot(
"data - gold");
236 cout << TEST_HEADER <<
"Testing Sine::generate2(1.0, freqs, phase) ...";
238 data = sine.generate2(1.0, freqs, phase);
245 gold <<
"gold/Sine_6.wav";
252 if(abs_diff.getMax() >
GAMMA)
255 <<
"Output did not match gold file!"
258 diff.
plot(
"data - gold");
270 cout << TEST_HEADER <<
"Testing Sine::setChorus(5,0.10) ...";
272 sine.setSeed(6846513);
274 sine.setChorus(5, 0.10);
276 data = sine.generate2(1.0, 2*freqs, phase);
283 gold <<
"gold/Sine_7.wav";
290 if(abs_diff.getMax() >
GAMMA)
293 <<
"Output did not match gold file!"
296 diff.
plot(
"data - gold");
305 cout << SUCCESS << endl;
void plot(const std::string &title="Buffer") const
Requires matplotlib. Creates a plot of this Buffer.
static const char * THIS_FILE
#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.