Nsound  0.9.4
Functions | Variables
test_convolve.cc File Reference
#include <Nsound/NsoundAll.h>
#include "Test.h"
#include <cmath>
#include <iostream>
#include <sstream>
Include dependency graph for test_convolve.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Variables

static const char * THIS_FILE = "test_convolve.cc"
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 46 of file test_convolve.cc.

References Nsound::AudioStream::getConvolve(), Nsound::AudioStream::normalize(), Nsound::AudioStream::resample2(), TEST_HEADER, Nsound::Tic(), and Nsound::Toc().

47 {
48  AudioStream x("../examples/california.wav");
49  AudioStream h("../examples/walle.wav");
50 
51  x.resample2(8000);
52  h.resample2(8000);
53 
54  cout << TEST_HEADER
55  << "AudioStream::getConvolve(x) ... " << flush;
56 
57  Tic();
58 
59  AudioStream y = h.getConvolve(x[0]);
60 
61  float64 delta_t = Toc();
62 
63  y.normalize();
64  y *= 0.6;
65 
66  cout << endl << "writing convolved2.wav ..." << flush;
67 
68  y >> "convolved2.wav";
69 
70  cout << " done " << delta_t << " seconds" << endl;
71 
72  return 0;
73 }
#define TEST_HEADER
Definition: Test.h:45
double float64
Definition: Nsound.h:146
void normalize()
Multiplies the AudioStream by a constant gain so the peak sample has magnitude 1.0.
Definition: AudioStream.cc:285
AudioStream getConvolve(const Buffer &b) const
Convolves every channel in the AudioStream with the Buffer.
Definition: AudioStream.h:133
Nsound::float64 Toc()
Definition: TicToc.cc:42
void Tic()
Definition: TicToc.cc:37

Variable Documentation

const char* THIS_FILE = "test_convolve.cc"
static

Definition at line 44 of file test_convolve.cc.