Nsound Namespace Reference

Classes

class  AdsrEnvelope
class  AudioBackend
class  AudioBackendLibao
class  AudioBackendLibportaudio
class  AudioPlayback
class  AudioStream
class  AudioStreamSelection
class  Buffer
class  BufferSelection
class  BufferWindowSearch
class  Clarinet
class  Cosine
struct  Context
class  DelayLine
class  DrumBD01
class  DrumKickBass
class  Envelope
class  FFTChunk
 Results of performing an FFT are stored in this class. More...
class  FFTransform
 A Class that performes the Fast Fouier Transfrom on a Buffer. More...
class  Filter
class  FilterAllPass
class  FilterBandPassFIR
class  FilterBandPassIIR
class  FilterBandPassVocoder
class  FilterBandRejectFIR
class  FilterBandRejectIIR
class  FilterCombLowPassFeedback
class  FilterDC
class  FilterDelay
class  FilterFlanger
class  FilterHighPassFIR
class  FilterHighPassIIR
class  FilterIIR
class  FilterLeastSquaresFIR
 Based on Matlab's firls function. More...
class  FilterLowPassFIR
class  FilterLowPassIIR
class  FilterMovingAverage
class  FilterParametricEqualizer
 Implementation of Zoelzer's parametric equalizer filters, with some modifications by the author. More...
class  FilterPhaser
class  FilterSlinky
class  FilterStageIIR
class  FilterTone
class  FluteSlide
class  Generator
 A class the provides draw utilities and a wavetable oscillator. More...
class  Granulator
class  GuitarBass
class  Hat
class  Instrument
class  Kernel
class  Mesh2D
class  MeshJunction
class  Mixer
 This class enables easy scheduling and mixing of multiple AudioStreams. More...
class  MixerNode
class  OrganPipe
class  Plotter
class  Pluck
class  Pulse
class  RandomNumberGenerator
class  ReverberationRoom
class  RngTausworthe
class  Sawtooth
class  Sine
class  Spectrogram
 The result from an STFT. More...
class  Square
 Square generator. More...
class  Stretcher
class  Triangle
class  Vocoder
class  Wavefile
 Very simple Wavefile reading class. More...
class  ID3v1Tag

Typedefs

typedef std::vector
< std::vector< boolean > > 
BooleanVectorVector
typedef std::vector< uint32Uint32Vector
typedef std::vector< float64FloatVector
typedef std::vector< BufferBufferVector
typedef std::vector< Buffer * > BufferPointerVector
typedef std::vector< booleanBooleanVector
typedef std::vector< FFTChunkFFTChunkVector
typedef std::set< KernelKernelCache
typedef std::set< MixerNodeMixerSet
typedef bool boolean
typedef signed char byte
typedef signed char int8
typedef signed short int16
typedef signed int int32
typedef signed long long int64
typedef float float32
typedef double float64
typedef unsigned char ubyte
typedef unsigned char uint8
typedef unsigned short uint16
typedef unsigned int uint32
typedef unsigned long long uint64
typedef signed long long raw_int64
typedef unsigned long long raw_uint64
typedef double raw_float64
typedef std::pair< std::string,
PyObject * > 
StringPyObjectPair
typedef std::map< std::string,
PyObject * > 
PylabTable

Enumerations

enum  AudioBackendType { BACKEND_TYPE_NONE, BACKEND_TYPE_LIBAO, BACKEND_TYPE_LIBPORTAUDIO }
enum  WindowType {
  BARTLETT, BLACKMAN, BLACKMAN_HARRIS, GAUSSIAN,
  GAUSSIAN_05, GAUSSIAN_10, GAUSSIAN_15, GAUSSIAN_20,
  GAUSSIAN_25, GAUSSIAN_30, GAUSSIAN_33, GAUSSIAN_35,
  GAUSSIAN_40, GAUSSIAN_45, GAUSSIAN_50, GAUSSIAN_55,
  GAUSSIAN_60, GAUSSIAN_65, GAUSSIAN_66, GAUSSIAN_70,
  GAUSSIAN_75, GAUSSIAN_80, GAUSSIAN_85, GAUSSIAN_90,
  GAUSSIAN_95, GAUSSIAN_99, HAMMING, HANNING,
  KAISER, NUTTALL, PARZEN, RECTANGULAR
}

Functions

void operator>> (const AudioStream &lhs, AudioPlayback &rhs)
void operator>> (const Buffer &lhs, AudioPlayback &rhs)
void use (const std::string &backend)
void use (const AudioBackendType &type)
std::vector< std::string > getBackends ()
std::vector< AudioBackendTypegetBackendTypes ()
AudioStream operator+ (const AudioStream &lhs, const AudioStream &rhs)
AudioStream operator- (const AudioStream &lhs, const AudioStream &rhs)
AudioStream operator* (const AudioStream &lhs, const AudioStream &rhs)
AudioStream operator/ (const AudioStream &lhs, const AudioStream &rhs)
AudioStream operator^ (const AudioStream &lhs, const AudioStream &rhs)
AudioStream operator+ (const AudioStream &lhs, const Buffer &rhs)
AudioStream operator- (const AudioStream &lhs, const Buffer &rhs)
AudioStream operator* (const AudioStream &lhs, const Buffer &rhs)
AudioStream operator/ (const AudioStream &lhs, const Buffer &rhs)
AudioStream operator^ (const AudioStream &lhs, const Buffer &rhs)
AudioStream operator+ (const AudioStream &lhs, const float64 &d)
AudioStream operator- (const AudioStream &lhs, const float64 &d)
AudioStream operator* (const AudioStream &lhs, const float64 &d)
AudioStream operator/ (const AudioStream &lhs, const float64 &d)
AudioStream operator^ (const AudioStream &lhs, const float64 &d)
AudioStream operator+ (const float64 &d, const AudioStream &lhs)
AudioStream operator- (const float64 &d, const AudioStream &lhs)
AudioStream operator* (const float64 &d, const AudioStream &lhs)
AudioStream operator/ (const float64 &d, const AudioStream &lhs)
Buffer operator+ (const Buffer &lhs, const Buffer &rhs)
 Add the Buffers together on a sample by sample basis.
Buffer operator- (const Buffer &lhs, const Buffer &rhs)
 Subtract the Buffers together on a sample by sample basis.
Buffer operator* (const Buffer &lhs, const Buffer &rhs)
 Multiply the Buffers together on a sample by sample basis.
Buffer operator/ (const Buffer &lhs, const Buffer &rhs)
 Divide the samples in the Buffers sample by sample basis.
Buffer operator^ (const Buffer &lhs, const Buffer &rhs)
 Raise the left hand side (lhs) samples to the power in the of the samples in the right hand side (rhs).
Buffer operator+ (const Buffer &lhs, const float64 &d)
 Add the scalar d to every sample in the Buffer.
Buffer operator- (const Buffer &lhs, const float64 &d)
 Subtract the scalar d to every sample in the Buffer.
Buffer operator* (const Buffer &lhs, const float64 &d)
 Multiply the scalar d to every sample in the Buffer.
Buffer operator/ (const Buffer &lhs, const float64 &d)
 Divide every sample in the Buffer by d.
Buffer operator^ (const Buffer &lhs, const float64 &d)
Buffer operator+ (const float64 &d, const Buffer &rhs)
 Add every sample in the Buffer to the scalar d.
Buffer operator- (const float64 &d, const Buffer &rhs)
 Subtract every sample in the Buffer from the scalar d.
Buffer operator* (const float64 &d, const Buffer &rhs)
 Multiply the scalar d by every sample in the Buffer.
Buffer operator/ (const float64 &d, const Buffer &rhs)
 Divide the scalar d by every sample in the Buffer.
Buffer operator^ (const float64 &d, const Buffer &rhs)
 Raise the scalar d to the power of every sample in the Buffer.
std::ostream & operator<< (std::ostream &out, const Buffer &rhs)
std::ostream & operator<< (std::ostream &out, const FilterIIR &rhs)
std::ostream & operator<< (std::ostream &out, const Kernel &rhs)
void searchForBestMatch_f64 (double *rss, const double *source, const unsigned int source_index, const unsigned int search_index, const unsigned int window_length, const unsigned int max_delta)
void searchForBestMatch_f32 (float *rss, const float *source, const unsigned int source_index, const unsigned int search_index, const unsigned int window_length, const unsigned int max_delta)
void Tic ()
Nsound::float64 Toc ()
Bufferoperator<< (Buffer &lhs, const char *rhs)
void operator>> (const Buffer &lhs, const char *rhs)
AudioStreamoperator<< (AudioStream &lhs, const char *rhs)
void operator>> (const AudioStream &lhs, const char *rhs)
std::ostream & operator<< (std::ostream &out, const ID3v1Tag &rhs)

Variables

static double start_time = 0.0

Typedef Documentation

typedef std::vector< std::vector< boolean > > Nsound::BooleanVectorVector

Definition at line 44 of file AudioStreamSelection.h.

typedef std::vector< uint32 > Nsound::Uint32Vector

Definition at line 47 of file Buffer.h.

typedef std::vector< float64 > Nsound::FloatVector

Definition at line 48 of file Buffer.h.

typedef std::vector<Buffer> Nsound::BufferVector

Definition at line 2181 of file Buffer.h.

typedef std::vector<Buffer *> Nsound::BufferPointerVector

Definition at line 2182 of file Buffer.h.

typedef std::vector< boolean > Nsound::BooleanVector

Definition at line 44 of file BufferSelection.h.

typedef std::vector< FFTChunk > Nsound::FFTChunkVector

Definition at line 136 of file FFTChunk.h.

typedef std::set<Kernel> Nsound::KernelCache

Definition at line 207 of file Kernel.h.

typedef std::set<MixerNode> Nsound::MixerSet

Definition at line 48 of file Mixer.h.

typedef bool Nsound::boolean

Definition at line 48 of file Nsound.h.

typedef signed char Nsound::byte

Definition at line 52 of file Nsound.h.

typedef signed char Nsound::int8

Definition at line 53 of file Nsound.h.

typedef signed short Nsound::int16

Definition at line 54 of file Nsound.h.

typedef signed int Nsound::int32

Definition at line 55 of file Nsound.h.

typedef signed long long Nsound::int64

Definition at line 56 of file Nsound.h.

typedef float Nsound::float32

Definition at line 58 of file Nsound.h.

typedef double Nsound::float64

Definition at line 59 of file Nsound.h.

typedef unsigned char Nsound::ubyte

Definition at line 63 of file Nsound.h.

typedef unsigned char Nsound::uint8

Definition at line 64 of file Nsound.h.

typedef unsigned short Nsound::uint16

Definition at line 65 of file Nsound.h.

typedef unsigned int Nsound::uint32

Definition at line 66 of file Nsound.h.

typedef unsigned long long Nsound::uint64

Definition at line 67 of file Nsound.h.

typedef signed long long Nsound::raw_int64

Definition at line 70 of file Nsound.h.

typedef unsigned long long Nsound::raw_uint64

Definition at line 71 of file Nsound.h.

typedef double Nsound::raw_float64

Definition at line 72 of file Nsound.h.

typedef std::pair< std::string, PyObject * > Nsound::StringPyObjectPair

Definition at line 46 of file Plotter.h.

typedef std::map< std::string, PyObject * > Nsound::PylabTable

Definition at line 52 of file Plotter.h.


Enumeration Type Documentation

Enumerator:
BACKEND_TYPE_NONE 
BACKEND_TYPE_LIBAO 
BACKEND_TYPE_LIBPORTAUDIO 

Definition at line 38 of file AudioBackendType.h.

00039     {
00040         BACKEND_TYPE_NONE,
00041         BACKEND_TYPE_LIBAO,
00042         BACKEND_TYPE_LIBPORTAUDIO,
00043     };

Enumerator:
BARTLETT 
BLACKMAN 
BLACKMAN_HARRIS 
GAUSSIAN 
GAUSSIAN_05 
GAUSSIAN_10 
GAUSSIAN_15 
GAUSSIAN_20 
GAUSSIAN_25 
GAUSSIAN_30 
GAUSSIAN_33 
GAUSSIAN_35 
GAUSSIAN_40 
GAUSSIAN_45 
GAUSSIAN_50 
GAUSSIAN_55 
GAUSSIAN_60 
GAUSSIAN_65 
GAUSSIAN_66 
GAUSSIAN_70 
GAUSSIAN_75 
GAUSSIAN_80 
GAUSSIAN_85 
GAUSSIAN_90 
GAUSSIAN_95 
GAUSSIAN_99 
HAMMING 
HANNING 
KAISER 
NUTTALL 
PARZEN 
RECTANGULAR 

Definition at line 39 of file WindowType.h.

00040     {
00041         BARTLETT,
00042         BLACKMAN,
00043         BLACKMAN_HARRIS,
00044         GAUSSIAN,
00045         GAUSSIAN_05,
00046         GAUSSIAN_10,
00047         GAUSSIAN_15,
00048         GAUSSIAN_20,
00049         GAUSSIAN_25,
00050         GAUSSIAN_30,
00051         GAUSSIAN_33,
00052         GAUSSIAN_35,
00053         GAUSSIAN_40,
00054         GAUSSIAN_45,
00055         GAUSSIAN_50,
00056         GAUSSIAN_55,
00057         GAUSSIAN_60,
00058         GAUSSIAN_65,
00059         GAUSSIAN_66,
00060         GAUSSIAN_70,
00061         GAUSSIAN_75,
00062         GAUSSIAN_80,
00063         GAUSSIAN_85,
00064         GAUSSIAN_90,
00065         GAUSSIAN_95,
00066         GAUSSIAN_99,
00067         HAMMING,
00068         HANNING,
00069         KAISER,
00070         NUTTALL,
00071         PARZEN,
00072         RECTANGULAR,
00073     };


Function Documentation

void Nsound::operator>> ( const AudioStream lhs,
AudioPlayback rhs 
)

Definition at line 593 of file AudioPlayback.cc.

References Nsound::AudioPlayback::play().

Referenced by Nsound::Buffer::writeWavefile(), and Nsound::AudioStream::writeWavefile().

00594 {
00595     ap.play(lhs);
00596 }

void Nsound::operator>> ( const Buffer lhs,
AudioPlayback rhs 
)

Definition at line 601 of file AudioPlayback.cc.

References Nsound::AudioPlayback::play().

00602 {
00603     ap.play(lhs);
00604 }

void Nsound::use ( const std::string &  backend  ) 

Selects the AudioBackend to use by name.

Parameters:
backend the common name for the backend to use
Example:
 // C++
 Nsound::use("portaudio");
 Nsound::use("ao");

 // Python
 Nsound.use("portaudio");
 Nsound.use("ao");

Definition at line 618 of file AudioPlayback.cc.

References BACKEND_TYPE_LIBAO, BACKEND_TYPE_LIBPORTAUDIO, getBackends(), mylower(), and Nsound::AudioPlayback::setBackendType().

Referenced by use().

00619 {
00620     std::string be = mylower(backend);
00621 
00622     if(be == "ao" || be == "libao")
00623     {
00624         AudioPlayback::setBackendType(BACKEND_TYPE_LIBAO);
00625     }
00626     else
00627     if(be == "portaudio" || be == "libportaudio")
00628     {
00629         AudioPlayback::setBackendType(BACKEND_TYPE_LIBPORTAUDIO);
00630     }
00631     else
00632     {
00633         cerr << "Nsound::use(): "
00634              << "Unrecognized AudioBackend '"
00635              << backend
00636              << "'"
00637              << endl;
00638 
00639         std::vector< std::string > vec = getBackends();
00640 
00641         cerr << "Available backends are:" << endl;
00642 
00643         for(uint32 i = 0; i < vec.size(); ++i)
00644         {
00645             cerr << "    "
00646                  << vec[i]
00647                  << endl;
00648         }
00649     }
00650 }

void Nsound::use ( const AudioBackendType type  ) 

Definition at line 655 of file AudioPlayback.cc.

References BACKEND_TYPE_LIBAO, BACKEND_TYPE_LIBPORTAUDIO, and use().

00656 {
00657     switch(type)
00658     {
00659         case BACKEND_TYPE_LIBAO:
00660             use("ao");
00661             break;
00662 
00663         case BACKEND_TYPE_LIBPORTAUDIO:
00664             use("portaudio");
00665             break;
00666 
00667         default:
00668             cerr << "Nsound::use(): "
00669                  << "Unrecognized AudioBackendType "
00670                  << static_cast<uint32>(type)
00671                  << endl;
00672     }
00673 }

std::vector< std::string > Nsound::getBackends (  ) 

Returns a list of the available audio backends by name.

Example:
 // C++
 Nsound::getBackends();

 // Python
 Nsound.getBackends();

Definition at line 678 of file AudioPlayback.cc.

Referenced by Nsound::AudioPlayback::scanDevices(), and use().

00679 {
00680     std::vector< std::string > vec;
00681 
00682     #if defined(NSOUND_LIBPORTAUDIO)
00683         vec.push_back("portaudio");
00684     #endif
00685 
00686     #if defined(NSOUND_LIBAO)
00687         vec.push_back("ao");
00688     #endif
00689 
00690     return vec;
00691 }

std::vector< AudioBackendType > Nsound::getBackendTypes (  ) 

Returns a list of the available audio backends types.

Example:
 // C++
 Nsound::getBackendsTypes();

 // Python
 Nsound.getBackendsTypes();

Definition at line 696 of file AudioPlayback.cc.

References BACKEND_TYPE_LIBAO, and BACKEND_TYPE_LIBPORTAUDIO.

Referenced by Nsound::AudioPlayback::scanDevices().

00697 {
00698     std::vector< AudioBackendType > vec;
00699 
00700     #if defined(NSOUND_LIBPORTAUDIO)
00701         vec.push_back(BACKEND_TYPE_LIBPORTAUDIO);
00702     #endif
00703 
00704     #if defined(NSOUND_LIBAO)
00705         vec.push_back(BACKEND_TYPE_LIBAO);
00706     #endif
00707 
00708     return vec;
00709 }

AudioStream Nsound::operator+ ( const AudioStream &  lhs,
const AudioStream &  rhs 
) [inline]

Definition at line 695 of file AudioStream.h.

00696 {
00697     AudioStream temp(lhs);
00698     return temp += rhs;
00699 }

AudioStream Nsound::operator- ( const AudioStream &  lhs,
const AudioStream &  rhs 
) [inline]

Definition at line 701 of file AudioStream.h.

00702 {
00703     AudioStream temp(lhs);
00704     return temp -= rhs;
00705 }

AudioStream Nsound::operator* ( const AudioStream &  lhs,
const AudioStream &  rhs 
) [inline]

Definition at line 707 of file AudioStream.h.

00708 {
00709     AudioStream temp(lhs);
00710     return temp *= rhs;
00711 }

AudioStream Nsound::operator/ ( const AudioStream &  lhs,
const AudioStream &  rhs 
) [inline]

Definition at line 713 of file AudioStream.h.

00714 {
00715     AudioStream temp(lhs);
00716     return temp /= rhs;
00717 }

AudioStream Nsound::operator^ ( const AudioStream &  lhs,
const AudioStream &  rhs 
) [inline]

Definition at line 719 of file AudioStream.h.

00720 {
00721     AudioStream temp(lhs);
00722     return temp ^= rhs;
00723 }

AudioStream Nsound::operator+ ( const AudioStream &  lhs,
const Buffer &  rhs 
) [inline]

Definition at line 725 of file AudioStream.h.

00726 {
00727     AudioStream temp(lhs);
00728     return temp += rhs;
00729 }

AudioStream Nsound::operator- ( const AudioStream &  lhs,
const Buffer &  rhs 
) [inline]

Definition at line 731 of file AudioStream.h.

00732 {
00733     AudioStream temp(lhs);
00734     return temp -= rhs;
00735 }

AudioStream Nsound::operator* ( const AudioStream &  lhs,
const Buffer &  rhs 
) [inline]

Definition at line 737 of file AudioStream.h.

00738 {
00739     AudioStream temp(lhs);
00740     return temp *= rhs;
00741 }

AudioStream Nsound::operator/ ( const AudioStream &  lhs,
const Buffer &  rhs 
) [inline]

Definition at line 743 of file AudioStream.h.

00744 {
00745     AudioStream temp(lhs);
00746     return temp /= rhs;
00747 }

AudioStream Nsound::operator^ ( const AudioStream &  lhs,
const Buffer &  rhs 
) [inline]

Definition at line 749 of file AudioStream.h.

00750 {
00751     AudioStream temp(lhs);
00752     return temp ^= rhs;
00753 }

AudioStream Nsound::operator+ ( const AudioStream &  lhs,
const float64 &  d 
) [inline]

Definition at line 755 of file AudioStream.h.

00756 {
00757     AudioStream temp(lhs);
00758     return temp += d;
00759 }

AudioStream Nsound::operator- ( const AudioStream &  lhs,
const float64 &  d 
) [inline]

Definition at line 761 of file AudioStream.h.

00762 {
00763     AudioStream temp(lhs);
00764     return temp -= d;
00765 }

AudioStream Nsound::operator* ( const AudioStream &  lhs,
const float64 &  d 
) [inline]

Definition at line 767 of file AudioStream.h.

00768 {
00769     AudioStream temp(lhs);
00770     return temp *= d;
00771 }

AudioStream Nsound::operator/ ( const AudioStream &  lhs,
const float64 &  d 
) [inline]

Definition at line 773 of file AudioStream.h.

00774 {
00775     AudioStream temp(lhs);
00776     return temp /= d;
00777 }

AudioStream Nsound::operator^ ( const AudioStream &  lhs,
const float64 &  d 
) [inline]

Definition at line 779 of file AudioStream.h.

00780 {
00781     AudioStream temp(lhs);
00782     return temp ^= d;
00783 }

AudioStream Nsound::operator+ ( const float64 &  d,
const AudioStream &  lhs 
) [inline]

Definition at line 785 of file AudioStream.h.

00786 {
00787     AudioStream temp(lhs);
00788     return temp += d;
00789 }

AudioStream Nsound::operator- ( const float64 &  d,
const AudioStream &  lhs 
) [inline]

Definition at line 791 of file AudioStream.h.

00792 {
00793     AudioStream temp(lhs * -1.0);
00794     return temp += d;
00795 }

AudioStream Nsound::operator* ( const float64 &  d,
const AudioStream &  lhs 
) [inline]

Definition at line 797 of file AudioStream.h.

00798 {
00799     AudioStream temp(lhs);
00800     return temp *= d;
00801 }

AudioStream Nsound::operator/ ( const float64 d,
const AudioStream lhs 
)

Definition at line 813 of file AudioStream.cc.

References Nsound::AudioStream::getNChannels(), and Nsound::AudioStream::getSampleRate().

00814 {
00815     AudioStream temp(lhs.getSampleRate(), lhs.getNChannels());
00816 
00817     uint32 ch = lhs.getNChannels();
00818 
00819     for(uint32 i = 0; i < ch; ++i)
00820     {
00821         temp[i] = d / lhs[i];
00822     }
00823 
00824     return temp;
00825 }

Buffer Nsound::operator+ ( const Buffer &  lhs,
const Buffer &  rhs 
) [inline]

Add the Buffers together on a sample by sample basis.

Definition at line 2029 of file Buffer.h.

02030 {
02031     Buffer temp(lhs);
02032     return temp += rhs;
02033 }

Buffer Nsound::operator- ( const Buffer &  lhs,
const Buffer &  rhs 
) [inline]

Subtract the Buffers together on a sample by sample basis.

Definition at line 2036 of file Buffer.h.

02037 {
02038     Buffer temp(lhs);
02039     return temp -= rhs;
02040 }

Buffer Nsound::operator* ( const Buffer &  lhs,
const Buffer &  rhs 
) [inline]

Multiply the Buffers together on a sample by sample basis.

Definition at line 2043 of file Buffer.h.

02044 {
02045     Buffer temp(lhs);
02046     return temp *= rhs;
02047 }

Buffer Nsound::operator/ ( const Buffer &  lhs,
const Buffer &  rhs 
) [inline]

Divide the samples in the Buffers sample by sample basis.

Definition at line 2050 of file Buffer.h.

02051 {
02052     Buffer temp(lhs);
02053     return temp /= rhs;
02054 }

Buffer Nsound::operator^ ( const Buffer &  lhs,
const Buffer &  rhs 
) [inline]

Raise the left hand side (lhs) samples to the power in the of the samples in the right hand side (rhs).

Definition at line 2057 of file Buffer.h.

02058 {
02059     Buffer temp(lhs);
02060     return temp ^= rhs;
02061 }

Buffer Nsound::operator+ ( const Buffer &  lhs,
const float64 &  d 
) [inline]

Add the scalar d to every sample in the Buffer.

Definition at line 2066 of file Buffer.h.

02067 {
02068     Buffer temp(lhs);
02069     return temp += d;
02070 }

Buffer Nsound::operator- ( const Buffer &  lhs,
const float64 &  d 
) [inline]

Subtract the scalar d to every sample in the Buffer.

Definition at line 2073 of file Buffer.h.

02074 {
02075     Buffer temp(lhs);
02076     return temp -= d;
02077 }

Buffer Nsound::operator* ( const Buffer &  lhs,
const float64 &  d 
) [inline]

Multiply the scalar d to every sample in the Buffer.

Definition at line 2080 of file Buffer.h.

02081 {
02082     Buffer temp(lhs);
02083     return temp *= d;
02084 }

Buffer Nsound::operator/ ( const Buffer &  lhs,
const float64 &  d 
) [inline]

Divide every sample in the Buffer by d.

Definition at line 2087 of file Buffer.h.

02088 {
02089     Buffer temp(lhs);
02090     return temp /= d;
02091 }

Buffer Nsound::operator^ ( const Buffer &  lhs,
const float64 &  d 
) [inline]

Each sample in the Buffer becomes the power x^n. Each sample in the Buffer becomes the power x^n, where x is the Buffer sample and N is the power.

Example:
 // C++
 Buffer b1("california.wav");
 Buffer b2 = b1 ^ 2.0;

 // Python
 b1 = Buffer("california.wav")
 b2 = b1 ** 2.0
WARNING: sometimes one may want to do this:
 // C++
 mag = real ^ 2 + imag ^ 2;
But C++'s default operator precedence will actually compile this:
 mag = (real ^ (2 + imag)) ^ 2;
because operator+ has high presedence. To avoid this, in C++ you must use parentheses.
 mag = (real ^ 2) + (imag ^ 2);

Definition at line 2124 of file Buffer.h.

02125 {
02126     Buffer temp(lhs);
02127     return temp ^= d;
02128 }

Buffer Nsound::operator+ ( const float64 &  d,
const Buffer &  rhs 
) [inline]

Add every sample in the Buffer to the scalar d.

Definition at line 2133 of file Buffer.h.

02134 {
02135     return rhs + d;
02136 }

Buffer Nsound::operator- ( const float64 &  d,
const Buffer &  rhs 
) [inline]

Subtract every sample in the Buffer from the scalar d.

Definition at line 2139 of file Buffer.h.

02140 {
02141     return (rhs * -1.0) + d;
02142 }

Buffer Nsound::operator* ( const float64 &  d,
const Buffer &  rhs 
) [inline]

Multiply the scalar d by every sample in the Buffer.

Definition at line 2145 of file Buffer.h.

02146 {
02147     return rhs * d;
02148 }

Buffer Nsound::operator/ ( const float64 &  d,
const Buffer &  rhs 
) [inline]

Divide the scalar d by every sample in the Buffer.

Definition at line 2151 of file Buffer.h.

References Nsound::Buffer::getLength().

02152 {
02153     Buffer temp(rhs);
02154 
02155     uint32 size = rhs.getLength();
02156 
02157     for(uint32 i = 0; i < size; ++i)
02158     {
02159         temp[i] = d / rhs[i];
02160     }
02161 
02162     return temp;
02163 }

Buffer Nsound::operator^ ( const float64 &  d,
const Buffer &  rhs 
) [inline]

Raise the scalar d to the power of every sample in the Buffer.

Definition at line 2166 of file Buffer.h.

References Nsound::Buffer::getLength().

02167 {
02168     Buffer temp(rhs);
02169 
02170     uint32 size = rhs.getLength();
02171 
02172     for(uint32 i = 0; i < size; ++i)
02173     {
02174         temp[i] = ::pow(d ,rhs[i]);
02175     }
02176 
02177     return temp;
02178 }

std::ostream & Nsound::operator<< ( std::ostream &  out,
const Buffer rhs 
)

Sends the contents of the Buffer to the output stream.

Definition at line 1468 of file Buffer.cc.

References Nsound::Buffer::data_.

01469 {
01470     std::vector<float64>::const_iterator rhs = rhs_buffer.data_.begin();
01471     std::vector<float64>::const_iterator end = rhs_buffer.data_.end();
01472 
01473     while(rhs != end)
01474     {
01475         out << *rhs << endl;
01476         ++rhs;
01477     }
01478 
01479     return out;
01480 }

std::ostream & Nsound::operator<< ( std::ostream &  out,
const FilterIIR rhs 
)

Prints the coeffents.

Definition at line 736 of file FilterIIR.cc.

References Nsound::Kernel::getALength(), Nsound::Kernel::getBLength(), and Nsound::FilterIIR::kernel_.

00737 {
00738     out << "kernel_.b_length_ = " << rhs.kernel_->getBLength() << endl
00739         << "kernel_.a_length_ = " << rhs.kernel_->getALength() << endl;
00740     return out << *rhs.kernel_;
00741 }

std::ostream & Nsound::operator<< ( std::ostream &  out,
const Kernel rhs 
)

Prints the coeffents.

Definition at line 176 of file Kernel.cc.

References Nsound::Kernel::a_, Nsound::Kernel::a_length_, Nsound::Kernel::b_, Nsound::Kernel::b_length_, and FORMAT.

00177 {
00178     #define FORMAT setw(12) << setprecision(9) << std::setiosflags(std::ios::fixed)
00179 
00180     for(uint32 i = 0; i < rhs.b_length_; ++i)
00181     {
00182         out << "b[" << i << "] = " << FORMAT << rhs.b_[i];
00183 
00184         if(i < rhs.a_length_)
00185         {
00186             out << "        a[" << i << "] = " << FORMAT << rhs.a_[i];
00187         }
00188         out << std::endl;
00189     }
00190 
00191     return out;
00192 }

void Nsound::searchForBestMatch_f64 ( double *  rss,
const double *  source,
const unsigned int  source_index,
const unsigned int  search_index,
const unsigned int  window_length,
const unsigned int  max_delta 
)
void Nsound::searchForBestMatch_f32 ( float *  rss,
const float *  source,
const unsigned int  source_index,
const unsigned int  search_index,
const unsigned int  window_length,
const unsigned int  max_delta 
)
void Nsound::Tic (  ) 

Referenced by main(), and testAutioStream().

Nsound::float64 Nsound::Toc (  ) 

Referenced by main(), and testAutioStream().

Buffer & Nsound::operator<< ( Buffer lhs,
const char *  rhs 
)

Definition at line 1504 of file Wavefile.cc.

References Nsound::Wavefile::read().

01505 {
01506     BufferPointerVector b_vector;
01507 
01508     b_vector.push_back(&lhs);
01509 
01510     Wavefile::read(rhs,&b_vector, NULL, NULL);
01511 
01512     return lhs;
01513 }

void Nsound::operator>> ( const Buffer lhs,
const char *  rhs 
)

Definition at line 1518 of file Wavefile.cc.

References Nsound::Wavefile::getDefaultSampleRate(), Nsound::Wavefile::getDefaultSampleSize(), and Nsound::Wavefile::write().

01519 {
01520     Wavefile::write(
01521         rhs,
01522         lhs,
01523         Wavefile::getDefaultSampleSize(),
01524         Wavefile::getDefaultSampleRate());
01525 }

AudioStream & Nsound::operator<< ( AudioStream lhs,
const char *  rhs 
)

Definition at line 1530 of file Wavefile.cc.

References Nsound::Wavefile::read().

01531 {
01532     Wavefile::read(rhs, NULL, &lhs, NULL);
01533 
01534     return lhs;
01535 }

void Nsound::operator>> ( const AudioStream lhs,
const char *  rhs 
)

Definition at line 1540 of file Wavefile.cc.

References Nsound::Wavefile::getDefaultSampleSize(), and Nsound::Wavefile::write().

01541 {
01542     Wavefile::write(
01543         rhs,
01544         lhs,
01545         Wavefile::getDefaultSampleSize());
01546 }

std::ostream & Nsound::operator<< ( std::ostream &  out,
const ID3v1Tag rhs 
)

Sends the contents of the Buffer to the output stream.

Definition at line 1897 of file Wavefile.cc.

References Nsound::ID3v1Tag::album, Nsound::ID3v1Tag::artist, Nsound::ID3v1Tag::comment, Nsound::ID3v1Tag::genre, Nsound::ID3v1Tag::title, and Nsound::ID3v1Tag::year.

01898 {
01899     out << "header  : TAG" << endl
01900         << "title   : " << rhs.title << endl
01901         << "artist  : " << rhs.artist << endl
01902         << "album   : " << rhs.album << endl
01903         << "year    : " << rhs.year << endl
01904         << "comment : " << rhs.comment << endl
01905         << "genre   : " << rhs.genre;
01906 
01907     return out;
01908 }


Variable Documentation

double Nsound::start_time = 0.0 [static]

Definition at line 35 of file TicToc.cc.

Generated on Sun Apr 15 20:10:49 2012 for nsound by  doxygen 1.6.3