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

Go to the source code of this file.

Functions

int main (void)
 

Function Documentation

int main ( void  )

Definition at line 13 of file dynamic_filter.cc.

References Nsound::Generator::drawLine(), Nsound::AudioStream::getDuration(), and Nsound::AudioStream::getSampleRate().

14 {
15  // Read in the wavefile.
16  AudioStream input("Temperature_in.wav");
17 
18  // Grab the duration in seconds.
19  float32 duration = input.getDuration();
20 
21  // Create a low pass filter with a kernel of 256 terms.
22  FilterLowPassFIR lpf(input.getSampleRate(), 256, 100);
23 
24  // Create a buffer that will hold cut off frequencies.
25  Buffer frequencies;
26 
27  // Fill it with two lines
28  Sine sin(input.getSampleRate());
29 
30  frequencies << sin.drawLine(0.5 * duration, 8000, 50)
31  << sin.drawLine(0.5 * duration, 50, 8000);
32 
33  // Filter it.
34  AudioStream output = lpf.filter(input, frequencies);
35 
36  // Write to disk.
37  output >> "Temperature_out.wav";
38 
39  AudioPlaybackRt pb(input.getSampleRate(), 2);
40 
41  output * 0.666 >> pb;
42 
43  return 0;
44 }
A Buffer for storing audio samples.
Definition: Buffer.h:60
float float32
Definition: Nsound.h:145
Buffer drawLine(const float64 &duration, const float64 &amplitude_start, const float64 &amplitude_finish) const
This method draws a linear line beteween 2 points.
Definition: Generator.cc:464
DOXME.
Definition: Sine.h:43