40 using namespace Nsound;
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) ...";
75 gold <<
"gold/Sine_1.wav";
85 <<
"Output did not match gold file!"
88 diff.
plot(
"data - gold");
100 cout << TEST_HEADER <<
"Testing Sine::generate(1.0, freqs) ...";
109 gold <<
"gold/Sine_2.wav";
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) ...";
143 gold <<
"gold/Sine_3.wav";
153 <<
"Output did not match gold file!"
156 diff.
plot(
"data - gold");
168 cout << TEST_HEADER <<
"Testing Sine::generate2(1.0, 3.0, phase) ...";
177 gold <<
"gold/Sine_4.wav";
187 <<
"Output did not match gold file!"
190 diff.
plot(
"data - gold");
202 cout << TEST_HEADER <<
"Testing Sine::generate2(1.0, freqs, 0.5) ...";
211 gold <<
"gold/Sine_5.wav";
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";
255 <<
"Output did not match gold file!"
258 diff.
plot(
"data - gold");
270 cout << TEST_HEADER <<
"Testing Sine::setChorus(5,0.10) ...";
276 data = sine.
generate2(1.0, 2*freqs, phase);
283 gold <<
"gold/Sine_7.wav";
293 <<
"Output did not match gold file!"
296 diff.
plot(
"data - gold");
305 cout << SUCCESS << endl;
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.
static const char * THIS_FILE
#define TEST_ERROR_HEADER
virtual float64 generate(const float64 &frequency)
This is a real-time method for the wavetable oscillator.
void setChorus(const uint32 n_voices, const float64 &sigma=0.02)
Chorus or Unison.
static void setIEEEFloat(boolean flag)
static const float64 GAMMA
void abs()
Modifies the Buffer by making any negative value positive.
A Buffer for storing audio samples.
static void setDefaultSampleSize(uint32 size)
Buffer drawLine(const float64 &duration, const float64 &litude_start, const float64 &litude_finish) const
This method draws a linear line beteween 2 points.
float64 getMax() const
Returns the maximum sample value in the Buffer.
void setSeed(const uint32 seed)
Sets the seed for the Generator's random number generator (rng).
virtual float64 generate2(const float64 &frequency, const float64 &phase)
This is a real-time method for the wavetable oscillator.