Nsound  0.9.4
Functions
test_moving_average.cc File Reference
#include <Nsound/NsoundAll.h>
Include dependency graph for test_moving_average.cc:

Go to the source code of this file.

Functions

int main (void)
 

Function Documentation

int main ( void  )

Definition at line 14 of file test_moving_average.cc.

References Nsound::Generator::drawLine(), Nsound::FilterMovingAverage::filter(), Nsound::Buffer::plot(), Nsound::Plotter::show(), Nsound::Generator::silence(), sr, and Nsound::Generator::whiteNoise().

15 {
16  float64 sr = 48000.0;
17 
18  Sine sine(sr);
19 
20  // Draw a pulse.
21  Buffer input = sine.silence(0.25)
22  << sine.drawLine(0.25, 1.0, 1.0)
23  << sine.silence(0.25);
24 
25  input += sine.whiteNoise(0.75) * 0.25;
26 
27  input.plot("noisy input");
28 
29  FilterMovingAverage fma(101);
30 
31  Buffer output = fma.filter(input);
32 
33  output.plot("filtered output");
34 
35  Plotter::show();
36 
37  return 0;
38 }
void plot(const std::string &title="Buffer") const
Requires matplotlib. Creates a plot of this Buffer.
Definition: Buffer.cc:1551
double float64
Definition: Nsound.h:146
A Buffer for storing audio samples.
Definition: Buffer.h:60
DOXME.
Definition: Sine.h:43
float64 sr
Definition: example3.cc:24