Nsound
0.9.4
|
#include <Nsound/Triangle.h>
Public Member Functions | |
Triangle (const Nsound::float64 &sample_rate) | |
Triangle (const Nsound::float64 &sample_rate, const Nsound::float64 &attack_time, const Nsound::float64 &release_time) | |
Triangle with 2 points //. More... | |
Triangle (const Nsound::float64 &sample_rate, const Nsound::float64 &percent_lambda_1, const Nsound::float64 &percent_lambda_2, const Nsound::float64 &litude_2, const Nsound::float64 &percent_lambda_3, const Nsound::float64 &percent_lambda_4, const Nsound::float64 &percent_lambda_5, const Nsound::float64 &litude_5, const Nsound::float64 &percent_lambda_6) | |
Triangle with 6 points //. More... | |
void | setRealtime (bool flag) |
Sets realtime mode, disables automatic reset() if set. More... | |
void | addSlaveSync (Generator &slave) |
Adds a generator as a slave to this instance for syncing. More... | |
void | buzzInit (const uint32 &max_harmonics) |
Initaializes Buzz settings for real-time calls. More... | |
float64 | buzz (const float64 &frequency, const float64 &n_harmonics, const float64 &delay) |
Returns sample from a set of harmonics. Based on the Csound buzz opcode. More... | |
Buffer | buzz (const float64 &duration, const float64 &frequency, const float64 &n_harmonics, const float64 &delay) |
Returns a set of harmonics. Based on the Csound buzz opcode. More... | |
Buffer | buzz (const float64 &duration, const Buffer &frequency, const Buffer &n_harmonics, const Buffer &delay) |
Returns a set of harmonics. Based on the Csound buzz opcode. More... | |
void | setChorus (const uint32 n_voices, const float64 &sigma=0.02) |
Chorus or Unison. More... | |
Buffer | drawDecay (const float64 &duration, const float64 &alpha=2.0 *M_PI) const |
This method draws an exponential curve that decays from 1.0 to 0.0 over the duration. More... | |
Buffer | drawGaussian (const float64 &duration, const float64 &mu, const float64 &sigma, const boolean &normalize=true) const |
This method draws a Gaussian curve over duration seconds. More... | |
Buffer | drawFatGaussian (const float64 &duration, const float64 &pass_band_percent=0.01) const |
This method draws a standard Gaussian curve over duration seconds, with a specified pass band. More... | |
Buffer | drawLine (const float64 &duration, const float64 &litude_start, const float64 &litude_finish) const |
This method draws a linear line beteween 2 points. More... | |
Buffer | drawParabola (const float64 &duration, const float64 &y1, const float64 &x2, const float64 &y2, const float64 &y3) const |
This method draws a parabola between three points, intersecting the middle point. More... | |
Buffer | drawSine (const float64 &duration, const float64 &frequency) |
This method draws a static sine wave. More... | |
Buffer | drawSine (const float64 &duration, const Buffer &frequency) |
This method draws a dynamic sine wave. More... | |
float64 | drawSine (const float64 &frequency) |
This method draws one sample of a sine wave in real-time. More... | |
Buffer | drawSine2 (const float64 &duration, const float64 &frequency, const float64 &phase) |
This method draws a static sine wave. More... | |
Buffer | drawSine2 (const float64 &duration, const Buffer &frequency, const Buffer &phase) |
This method draws a dynamic sine wave. More... | |
Buffer | drawSine2 (const float64 &duration, const Buffer &frequency, const float64 &phase=0.0) |
This method draws a dynamic sine wave. More... | |
Buffer | drawSine2 (const float64 &duration, const float64 &frequency, const Buffer &phase) |
This method draws a dynamic sine wave. More... | |
float64 | drawSine2 (const float64 &frequency, const float64 &phase) |
This method draws one sample of a sine wave in real-time. More... | |
Buffer | drawWindow (const float64 &duration, WindowType type) const |
Draws a window of the specified type. More... | |
Buffer | drawWindowBartlett (const float64 &duration) const |
Draws a Bartlett window. More... | |
Buffer | drawWindowBlackman (const float64 &duration) const |
Draws a Blackman window. More... | |
Buffer | drawWindowBlackmanHarris (const float64 &duration) const |
Draws a Blackman-Harris window. More... | |
Buffer | drawWindowHamming (const float64 &duration) const |
Draws a Hamming window. More... | |
Buffer | drawWindowHanning (const float64 &duration) const |
Draws a Hanning window. More... | |
Buffer | drawWindowKaiser (const float64 &duration, const float64 &beta=5.0) const |
Draws a Kaiser window. More... | |
Buffer | drawWindowNuttall (const float64 &duration) const |
Draws a Nuttall window. More... | |
Buffer | drawWindowParzen (const float64 &duration) const |
Draws a Parzen window. More... | |
Buffer | drawWindowRectangular (const float64 &duration) const |
Draws a rectangular window. More... | |
virtual float64 | generate (const float64 &frequency) |
This is a real-time method for the wavetable oscillator. More... | |
virtual Buffer | generate (const float64 &duration, const float64 &frequency) |
This method oscillates the waveform stored in this generator. More... | |
virtual Buffer | generate (const float64 &duration, const Buffer &frequencies) |
This method oscillates the waveform stored in this generator. More... | |
virtual float64 | generate2 (const float64 &frequency, const float64 &phase) |
This is a real-time method for the wavetable oscillator. More... | |
virtual Buffer | generate2 (const float64 &duration, const float64 &frequency, const float64 &phase) |
This method oscillates the waveform stored in this generator. More... | |
virtual Buffer | generate2 (const float64 &duration, const float64 &frequencies, const Buffer &phase) |
This method oscillates the waveform stored in this generator. More... | |
virtual Buffer | generate2 (const float64 &duration, const Buffer &frequencies, const float64 &phase) |
This method oscillates the waveform stored in this generator. More... | |
virtual Buffer | generate2 (const float64 &duration, const Buffer &frequencies, const Buffer &phase) |
This method oscillates the waveform stored in this generator. More... | |
void | removeSlaveSync (Generator &slave) |
Removes the generator from the sync list. More... | |
virtual void | reset () |
Resets the position pointer back to the begging of the waveform. More... | |
RandomNumberGenerator & | getRandomNumberGenerator () |
void | setSeed (const uint32 seed) |
Sets the seed for the Generator's random number generator (rng). More... | |
Buffer | silence (const float64 &duration) const |
This method generates silence. More... | |
float64 | tell () const |
Returns the current position pointer, values are between 0.0 to 1.0. More... | |
Buffer | whiteNoise (const float64 &duration) const |
This method generates noise from a uniform distribution. More... | |
Buffer | gaussianNoise (const float64 &duration, const float64 &mu, const float64 &sigma) const |
This method generates noise from a Gaussian distribution. More... | |
Buffer | tanh (const float64 &duration) const |
This method draws the tanh function accross duration samples. More... | |
Protected Member Functions | |
virtual void | ctor (const float64 &sample_rate) |
DOXME. More... | |
virtual void | ctor (const float64 &sample_rate, const Buffer &wavetable) |
DOXME. More... | |
Protected Attributes | |
bool | is_realtime_ |
float64 | last_frequency_ |
float64 | position_ |
Used for phase offset adjustment. More... | |
float64 | sync_pos_ |
The number of samples into the wavefrom. More... | |
float64 | sample_rate_ |
Used to determine when to create a sync sample. More... | |
float64 | sample_time_ |
The number of samples per second to generate. More... | |
float64 | t_ |
The time step between samples in seconds. More... | |
Buffer * | waveform_ |
The current time (for real time draw functions.) More... | |
RandomNumberGenerator * | rng_ |
The waveform to ossicialate. More... | |
uint32 | buzz_max_harmonics_ |
The random number generator. More... | |
std::vector< float64 > | buzz_position_ |
boolean | chorus_is_on_ |
uint32 | chorus_n_voices_ |
std::vector< float64 > | chorus_position_ |
std::vector< float64 > | chorus_factor_ |
boolean | sync_is_master_ |
boolean | sync_is_slave_ |
Indicates if this generator is the master. More... | |
uint32 | sync_count_ |
Indicates if this generator is a slave. More... | |
std::vector< uint32 > | sync_vector_ |
Indicates the number of samples since reset. More... | |
std::set< Generator * > | sync_slaves_ |
Stores sample counts when synced. More... | |
Triangle generator.
Definition at line 48 of file Triangle.h.
Triangle::Triangle | ( | const Nsound::float64 & | sample_rate | ) |
Definition at line 41 of file Triangle.cc.
References Nsound::Generator::ctor(), Nsound::Generator::drawLine(), Nsound::Buffer::getLength(), and Nsound::Buffer::subbuffer().
Triangle::Triangle | ( | const Nsound::float64 & | sample_rate, |
const Nsound::float64 & | attack_time, | ||
const Nsound::float64 & | release_time | ||
) |
Triangle with 2 points //.
/\ // / \ // / \ // / \ // / \ release // / \ |--—| // |---—| \ / // attack \ / // \ / // \ / // \/ // // //
Definition at line 66 of file Triangle.cc.
References Nsound::Generator::ctor(), Nsound::Generator::drawLine(), and M_ASSERT_VALUE.
Triangle::Triangle | ( | const Nsound::float64 & | sample_rate, |
const Nsound::float64 & | percent_lambda_1, | ||
const Nsound::float64 & | percent_lambda_2, | ||
const Nsound::float64 & | amplitude_2, | ||
const Nsound::float64 & | percent_lambda_3, | ||
const Nsound::float64 & | percent_lambda_4, | ||
const Nsound::float64 & | percent_lambda_5, | ||
const Nsound::float64 & | amplitude_5, | ||
const Nsound::float64 & | percent_lambda_6 | ||
) |
Triangle with 6 points //.
2 // /\ // / \ // / \ // / \ // –1 3–4 6– // \ / // \ / // \ / // \ / // \/ // 5 // // |-------—lambda-------—| //
Definition at line 162 of file Triangle.cc.
References Nsound::Generator::ctor(), and drawTriangle().
|
inlineinherited |
Sets realtime mode, disables automatic reset() if set.
Definition at line 72 of file Generator.h.
References Nsound::Generator::is_realtime_.
|
inherited |
Adds a generator as a slave to this instance for syncing.
Definition at line 237 of file Generator.cc.
References Nsound::Generator::reset(), Nsound::Generator::sync_is_master_, Nsound::Generator::sync_is_slave_, and Nsound::Generator::sync_slaves_.
Referenced by main().
|
inherited |
Initaializes Buzz settings for real-time calls.
Definition at line 252 of file Generator.cc.
References Nsound::Generator::buzz_max_harmonics_, and Nsound::Generator::reset().
Referenced by Nsound::Generator::buzz().
|
inherited |
Returns sample from a set of harmonics. Based on the Csound buzz opcode.
Chorus can not be used with this function.
Definition at line 260 of file Generator.cc.
References Nsound::Generator::last_frequency_, Nsound::Generator::position_, and Nsound::Generator::sample_rate_.
Referenced by Nsound::Generator::buzz(), FFTransform_UnitTest(), and Generator_UnitTest().
|
inherited |
Returns a set of harmonics. Based on the Csound buzz opcode.
Definition at line 313 of file Generator.cc.
References Nsound::Generator::buzz(), Nsound::Generator::buzzInit(), and Nsound::Generator::sample_rate_.
|
inherited |
Returns a set of harmonics. Based on the Csound buzz opcode.
Definition at line 335 of file Generator.cc.
References Nsound::Generator::buzz(), Nsound::Generator::buzzInit(), Nsound::Buffer::cbegin(), Nsound::Buffer::getMax(), and Nsound::Generator::sample_rate_.
Chorus or Unison.
When chorus is not enabled, samples are generated using one frequency indexing into the wave table. However, when chorus is turned on, the output sample will be the average of N frequencies indexing into the wavetable. A set of scalar is randomally selected, each frequncy in the set is calculated by
where is a random scalar selected inside .
Definition at line 361 of file Generator.cc.
References Nsound::Generator::chorus_factor_, Nsound::Generator::chorus_is_on_, Nsound::Generator::chorus_n_voices_, Nsound::Generator::chorus_position_, Nsound::RandomNumberGenerator::get(), Nsound::Generator::reset(), and Nsound::Generator::rng_.
Referenced by Generator_UnitTest(), and Sine_UnitTest().
|
inherited |
This method draws an exponential curve that decays from 1.0 to 0.0 over the duration.
where the default value for is and is the sample time.
Definition at line 388 of file Generator.cc.
References Nsound::Generator::drawLine(), and Nsound::Buffer::exp().
Referenced by Nsound::Granulator::Granulator(), main(), Nsound::DrumBD01::play(), Nsound::DrumKickBass::play(), and Nsound::Hat::play().
|
inherited |
This method draws a Gaussian curve over duration seconds.
This method draws a Gaussian curve over duration seconds.
duration | the number of seconds to draw |
mu | the location of the peak in seconds |
sigma | the width of the Gaussian in seconds |
normalize | a flag to normalize the Gaussian so the peak is 1.0 |
The generatl equation for a discrete Gaussian is given by
where is the sample time.
Definition at line 403 of file Generator.cc.
References Nsound::Generator::drawLine(), Nsound::Buffer::exp(), M_2PI, and Nsound::Buffer::normalize().
Referenced by Nsound::Generator::drawFatGaussian(), Nsound::Generator::drawWindow(), Nsound::Granulator::Granulator(), and main().
|
inherited |
This method draws a standard Gaussian curve over duration seconds, with a specified pass band.
duration | the number of seconds to draw |
pass_band_percent | the width of the pass band in percent of duraiton |
sigma | the standard deviation of the gaussian curve |
The curve is always normaized so the peak is 1.0.
Definition at line 434 of file Generator.cc.
References Nsound::Generator::drawGaussian(), Nsound::Generator::drawLine(), and M_ASSERT_VALUE.
Referenced by Nsound::Generator::drawWindow(), Nsound::Granulator::Granulator(), main(), and softTones().
|
inherited |
This method draws a linear line beteween 2 points.
duration | the number of seconds to draw |
amplitude_start | the starting amplitude value |
amplitude_finish | the finishing amplitude value |
The two points are located at (x1,y1) = (0.0, amplitude_1) and (x2,y2) = (duration, amplitude_2).
Definition at line 464 of file Generator.cc.
References M_ASSERT_VALUE, and Nsound::Generator::sample_rate_.
Referenced by Buffer_UnitTest(), DelayLine_UnitTest(), Nsound::Generator::drawDecay(), Nsound::Generator::drawFatGaussian(), Nsound::Generator::drawGaussian(), Nsound::Generator::drawParabola(), drawSquare(), drawTriangle(), Nsound::Generator::drawWindowBartlett(), Nsound::Generator::drawWindowBlackman(), Nsound::Generator::drawWindowBlackmanHarris(), Nsound::Generator::drawWindowHamming(), Nsound::Generator::drawWindowHanning(), Nsound::Generator::drawWindowKaiser(), Nsound::Generator::drawWindowNuttall(), Nsound::Generator::drawWindowParzen(), Nsound::Generator::drawWindowRectangular(), drum(), FilterCombLowPassFeedback_UnitTest(), FilterParametricEqualizer_UnitTest(), Nsound::Pluck::generate(), Generator_UnitTest(), Nsound::FFTChunk::getFrequencyAxis(), main(), Nsound::FilterLeastSquaresFIR::makeKernel(), my_main(), Nsound::AudioStream::ones(), Nsound::Buffer::ones(), Nsound::Stretcher::overlapAdd(), Nsound::GuitarBass::play(), Nsound::Clarinet::play(), Nsound::DrumBD01::play(), Nsound::FluteSlide::play(), Nsound::DrumKickBass::play(), Nsound::OrganPipe::play(), Nsound::Hat::play(), Nsound::AudioStream::plot(), Nsound::Generator::silence(), Sine_UnitTest(), Nsound::Square::Square(), Nsound::Mesh2D::strike(), testAutioStream(), Triangle(), Triangle_UnitTest(), Nsound::AudioStream::zeros(), and Nsound::Buffer::zeros().
|
inherited |
This method draws a parabola between three points, intersecting the middle point.
duration | the number of seconds to draw |
y1 | the y1 amplitude |
x2 | the x2 time |
y2 | the y2 amplitude |
y3 | the y3 amplitude |
The general equation for a discrete parabola is:
where is the sample time. The three points are located at (x1,y1), (x2,y2), (x3,y3) with x1 = 0.0 and x3 = duration.
Definition at line 490 of file Generator.cc.
References Nsound::Generator::drawLine(), and M_ASSERT_VALUE.
Referenced by drum().
This method draws a static sine wave.
duration | the number of seconds to draw |
frequency | the frequency in Hz |
This is a special case of drawSine2(const float64 & duration, const float64 & frequency, const float64 & phase) with phase set to 0.0.
Definition at line 544 of file Generator.cc.
References Nsound::Generator::drawSine2(), M_ASSERT_VALUE, Nsound::Generator::sample_rate_, and Nsound::Generator::t_.
Referenced by Generator_UnitTest(), Nsound::Sawtooth::Sawtooth(), Nsound::Sine::Sine(), and Nsound::Square::Square().
This method draws a dynamic sine wave.
duration | the number of seconds to draw |
frequency | the frequency in Hz |
This is a special case of drawSine2(const float64 & duration, const Buffer & frequency, const Buffer & phase) with the phase set to 0.0.
Definition at line 566 of file Generator.cc.
References Nsound::Buffer::cbegin(), Nsound::Generator::drawSine2(), M_ASSERT_VALUE, Nsound::Generator::sample_rate_, and Nsound::Generator::t_.
This method draws one sample of a sine wave in real-time.
frequency | the frequency in Hz |
This is a special case of drawSine2(const float64 & frequency, const float64 & phase) with the phase = 0.0.
Definition at line 694 of file Generator.cc.
References Nsound::Generator::drawSine2().
|
inherited |
This method draws a static sine wave.
duration | the number of seconds to draw |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
The general discrete sine wave is given by
where is the sample time. This function will produce a cosine wave if is 0.5.
Definition at line 591 of file Generator.cc.
References M_ASSERT_VALUE, Nsound::Generator::sample_rate_, and Nsound::Generator::t_.
Referenced by Nsound::Cosine::Cosine(), Nsound::Generator::drawSine(), Nsound::Generator::drawSine2(), and Generator_UnitTest().
|
inherited |
This method draws a dynamic sine wave.
duration | the number of seconds to draw |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
The general dynamic discrete sine wave is given by
where is given by
and when and is the sample time.
This function will produce a cosine wave if is 0.5.
Definition at line 614 of file Generator.cc.
References Nsound::Buffer::cbegin(), Nsound::Generator::drawSine2(), M_ASSERT_VALUE, Nsound::Generator::sample_rate_, and Nsound::Generator::t_.
|
inherited |
This method draws a dynamic sine wave.
duration | the number of seconds to draw |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
This is a special case of drawSine2(const float64 & duration, const Buffer & frequency, const Buffer & phase) with the phase set to a constant value.
Definition at line 642 of file Generator.cc.
References Nsound::Generator::drawSine2().
|
inherited |
This method draws a dynamic sine wave.
duration | the number of seconds to draw |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
This is a special case of drawSine2(const float64 & duration, const Buffer & frequency, const Buffer & phase) with the frequency set to a constant value.
Definition at line 655 of file Generator.cc.
References Nsound::Generator::drawSine2().
This method draws one sample of a sine wave in real-time.
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
Definition at line 668 of file Generator.cc.
References Nsound::Generator::chorus_factor_, Nsound::Generator::chorus_is_on_, Nsound::Generator::chorus_n_voices_, Nsound::Generator::chorus_position_, M_2PI, M_PI, Nsound::Generator::sample_time_, and Nsound::Generator::t_.
|
inherited |
Draws a window of the specified type.
Definition at line 702 of file Generator.cc.
References Nsound::BARTLETT, Nsound::BLACKMAN, Nsound::BLACKMAN_HARRIS, Nsound::Generator::drawFatGaussian(), Nsound::Generator::drawGaussian(), Nsound::Generator::drawWindowBartlett(), Nsound::Generator::drawWindowBlackman(), Nsound::Generator::drawWindowBlackmanHarris(), Nsound::Generator::drawWindowHamming(), Nsound::Generator::drawWindowHanning(), Nsound::Generator::drawWindowKaiser(), Nsound::Generator::drawWindowNuttall(), Nsound::Generator::drawWindowParzen(), Nsound::Generator::drawWindowRectangular(), Nsound::GAUSSIAN, Nsound::GAUSSIAN_05, Nsound::GAUSSIAN_10, Nsound::GAUSSIAN_15, Nsound::GAUSSIAN_20, Nsound::GAUSSIAN_25, Nsound::GAUSSIAN_30, Nsound::GAUSSIAN_33, Nsound::GAUSSIAN_35, Nsound::GAUSSIAN_40, Nsound::GAUSSIAN_45, Nsound::GAUSSIAN_50, Nsound::GAUSSIAN_55, Nsound::GAUSSIAN_60, Nsound::GAUSSIAN_65, Nsound::GAUSSIAN_66, Nsound::GAUSSIAN_70, Nsound::GAUSSIAN_75, Nsound::GAUSSIAN_80, Nsound::GAUSSIAN_85, Nsound::GAUSSIAN_90, Nsound::GAUSSIAN_95, Nsound::GAUSSIAN_99, Nsound::HAMMING, Nsound::HANNING, Nsound::KAISER, M_THROW, Nsound::NUTTALL, Nsound::PARZEN, and Nsound::RECTANGULAR.
Referenced by Nsound::FFTransform::fft(), Nsound::FilterLeastSquaresFIR::setWindow(), and Nsound::Spectrogram::Spectrogram().
Draws a Bartlett window.
Definition at line 765 of file Generator.cc.
References Nsound::Generator::drawLine(), and Nsound::Generator::sample_rate_.
Referenced by Nsound::Generator::drawWindow().
Draws a Blackman window.
The general discrete cosine window is given by
where is the sample time. The Blackman window is a special case of the cosesine window with = 0.42, = 0.50, = 0.08, = 0.00.
Definition at line 785 of file Generator.cc.
References cosinewindow(), and Nsound::Generator::drawLine().
Referenced by Nsound::Generator::drawWindow().
Draws a Blackman-Harris window.
The general discrete cosine window is given by
where is the sample time. The Blackman-Harris window is a special case of the cosesine window with = 0.35875, = 0.48829, = 0.14128, = 0.01168.
Definition at line 796 of file Generator.cc.
References cosinewindow(), and Nsound::Generator::drawLine().
Referenced by Nsound::Generator::drawWindow().
Draws a Hamming window.
The general discrete cosine window is given by
where is the sample time. The Hamming window is a special case of the cosesine window with = 0.54, = 0.46, = 0.00, = 0.00.
Definition at line 808 of file Generator.cc.
References cosinewindow(), and Nsound::Generator::drawLine().
Referenced by Nsound::Generator::drawWindow().
Draws a Hanning window.
The general discrete cosine window is given by
where is the sample time. The Hanning window is a special case of the cosesine window with = 0.50, = 0.50, = 0.00, = 0.00.
Definition at line 819 of file Generator.cc.
References cosinewindow(), and Nsound::Generator::drawLine().
Referenced by Nsound::Generator::drawWindow(), my_main(), and Nsound::Stretcher::Stretcher().
|
inherited |
Draws a Kaiser window.
Definition at line 879 of file Generator.cc.
References bessel_i0(), Nsound::Generator::drawLine(), and Nsound::Buffer::getLength().
Referenced by Nsound::Generator::drawWindow(), Nsound::FilterLeastSquaresFIR::FilterLeastSquaresFIR(), and Nsound::FilterLeastSquaresFIR::setKernel().
Draws a Nuttall window.
The general discrete cosine window is given by
where is the sample time. The Nuttall window is a special case of the cosesine window with = 0.3635819, = 0.4891775, = 0.1365995, = 0.0106411.
Definition at line 921 of file Generator.cc.
References cosinewindow(), and Nsound::Generator::drawLine().
Referenced by Nsound::Generator::drawWindow().
Draws a Parzen window.
Definition at line 932 of file Generator.cc.
References Nsound::Generator::drawLine(), and Nsound::Generator::sample_rate_.
Referenced by Nsound::Generator::drawWindow().
Draws a rectangular window.
Definition at line 965 of file Generator.cc.
References Nsound::Generator::drawLine().
Referenced by Nsound::Generator::drawWindow().
This is a real-time method for the wavetable oscillator.
frequency | the frequency in Hz |
This is a special case of generate2(const float64 & frequency, const float64 & phase) with phase = 0.0.
Reimplemented in Nsound::Pulse, Nsound::GeneratorDecay, and Nsound::Pluck.
Definition at line 972 of file Generator.cc.
References Nsound::Generator::generate2().
Referenced by Buffer_UnitTest(), BufferResample_UnitTest(), DelayLine_UnitTest(), drum(), Nsound::FilterFlanger::filter(), FilterDelay_UnitTest(), Nsound::FilterFlanger::FilterFlanger(), Nsound::FilterPhaser::FilterPhaser(), Nsound::Granulator::generate(), Nsound::Generator::generate(), Generator_UnitTest(), main(), Nsound::GuitarBass::play(), Nsound::Clarinet::play(), Nsound::DrumBD01::play(), Nsound::DrumKickBass::play(), Nsound::OrganPipe::play(), Nsound::Hat::play(), Sine_UnitTest(), softTones(), testAutioStream(), Triangle_UnitTest(), and Wavefile_UnitTest().
This method oscillates the waveform stored in this generator.
duration | the number of seconds to oscillate the waveform |
frequency | the frequency in Hz |
Reimplemented in Nsound::Pluck.
Definition at line 1065 of file Generator.cc.
References Nsound::Generator::generate(), Nsound::Generator::is_realtime_, M_ASSERT_VALUE, Nsound::Generator::reset(), and Nsound::Generator::sample_rate_.
|
virtualinherited |
This method oscillates the waveform stored in this generator.
duration | the number of seconds to oscillate the waveform |
frequency | the frequency in Hz |
This is a special case of generate2(const float64 & duration, const Buffer & frequencies, const Buffer & phase) with phase = 0.0.
Reimplemented in Nsound::Pluck.
Definition at line 1110 of file Generator.cc.
References Nsound::Buffer::cbegin(), Nsound::Generator::generate(), Nsound::Generator::is_realtime_, M_ASSERT_VALUE, Nsound::Generator::reset(), and Nsound::Generator::sample_rate_.
This is a real-time method for the wavetable oscillator.
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
The general wavetable oscillator equation is given by
where the index into the table, is given by the recursive function
where is the modulus operator, is the wavetable length, when , . In Nsound, the wavetable size, , is equal to the sample rate.
Reimplemented in Nsound::Pulse, Nsound::GeneratorDecay, and Nsound::Pluck.
Definition at line 979 of file Generator.cc.
References Nsound::Generator::chorus_factor_, Nsound::Generator::chorus_is_on_, Nsound::Generator::chorus_n_voices_, Nsound::Generator::chorus_position_, M_CHECK_PTR, Nsound::Generator::position_, Nsound::Generator::sample_rate_, Nsound::Generator::sync_count_, Nsound::Generator::sync_is_master_, Nsound::Generator::sync_is_slave_, Nsound::Generator::sync_pos_, Nsound::Generator::sync_slaves_, Nsound::Generator::sync_vector_, and Nsound::Generator::waveform_.
Referenced by Nsound::Generator::generate(), Nsound::GeneratorDecay::generate2(), Nsound::Pulse::generate2(), Nsound::Generator::generate2(), and Sine_UnitTest().
|
virtualinherited |
This method oscillates the waveform stored in this generator.
duration | the number of seconds to oscillate the waveform |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
Reimplemented in Nsound::Pulse, Nsound::GeneratorDecay, and Nsound::Pluck.
Definition at line 1087 of file Generator.cc.
References Nsound::Generator::generate2(), Nsound::Generator::is_realtime_, M_ASSERT_VALUE, Nsound::Generator::reset(), and Nsound::Generator::sample_rate_.
|
virtualinherited |
This method oscillates the waveform stored in this generator.
duration | the number of seconds to oscillate the waveform |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
This is a special case of generate2(const float64 & duration, const Buffer & frequencies, const Buffer & phase) with constant frequency.
Reimplemented in Nsound::Pulse, Nsound::GeneratorDecay, and Nsound::Pluck.
Definition at line 1134 of file Generator.cc.
References Nsound::Buffer::cbegin(), Nsound::Generator::generate2(), Nsound::Generator::is_realtime_, M_ASSERT_VALUE, Nsound::Generator::reset(), and Nsound::Generator::sample_rate_.
|
virtualinherited |
This method oscillates the waveform stored in this generator.
duration | the number of seconds to oscillate the waveform |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
This is a special case of generate2(const float64 & duration, const Buffer & frequencies, const Buffer & phase) with constant phase.
Reimplemented in Nsound::Pulse, Nsound::GeneratorDecay, and Nsound::Pluck.
Definition at line 1159 of file Generator.cc.
References Nsound::Buffer::cbegin(), Nsound::Generator::generate2(), Nsound::Generator::is_realtime_, M_ASSERT_VALUE, Nsound::Generator::reset(), and Nsound::Generator::sample_rate_.
|
virtualinherited |
This method oscillates the waveform stored in this generator.
duration | the number of seconds to oscillate the waveform |
frequency | the frequency in Hz |
phase | the natural phase (0.0 to 1.0) |
Reimplemented in Nsound::GeneratorDecay, Nsound::Pulse, and Nsound::Pluck.
Definition at line 1184 of file Generator.cc.
References Nsound::Buffer::cbegin(), Nsound::Generator::generate2(), Nsound::Generator::is_realtime_, M_ASSERT_VALUE, Nsound::Generator::reset(), and Nsound::Generator::sample_rate_.
|
inherited |
Removes the generator from the sync list.
Definition at line 1259 of file Generator.cc.
References Nsound::Generator::reset(), Nsound::Generator::sync_is_slave_, and Nsound::Generator::sync_slaves_.
|
virtualinherited |
Resets the position pointer back to the begging of the waveform.
Reimplemented in Nsound::Pulse.
Definition at line 1272 of file Generator.cc.
References Nsound::Generator::buzz_max_harmonics_, Nsound::Generator::buzz_position_, Nsound::Generator::chorus_n_voices_, Nsound::Generator::chorus_position_, Nsound::Generator::last_frequency_, Nsound::Generator::position_, Nsound::Generator::sync_count_, Nsound::Generator::sync_pos_, Nsound::Generator::sync_slaves_, and Nsound::Generator::t_.
Referenced by Nsound::Generator::addSlaveSync(), Nsound::Generator::buzzInit(), Nsound::Generator::generate(), Nsound::Generator::generate2(), Nsound::Generator::removeSlaveSync(), Nsound::FilterFlanger::reset(), and Nsound::Generator::setChorus().
|
inlineinherited |
Definition at line 562 of file Generator.h.
References Nsound::Generator::rng_.
|
inherited |
Sets the seed for the Generator's random number generator (rng).
Definition at line 1303 of file Generator.cc.
References Nsound::Generator::rng_, and Nsound::RandomNumberGenerator::setSeed().
Referenced by Generator_UnitTest(), and Sine_UnitTest().
This method generates silence.
This is a special coase of drawLine(const float64 & duration, const float64 & amplitude_start, const float64 & amplitude_finish) const where the start and stopping amplitudes are 0.0.
Definition at line 1310 of file Generator.cc.
References Nsound::Generator::drawLine().
Referenced by Nsound::FFTransform::fft(), FilterDelay_UnitTest(), main(), my_main(), Nsound::Hat::play(), and Nsound::Spectrogram::Spectrogram().
|
inherited |
Returns the current position pointer, values are between 0.0 to 1.0.
Definition at line 1317 of file Generator.cc.
References Nsound::Generator::position_, and Nsound::Generator::sample_rate_.
This method generates noise from a uniform distribution.
Definition at line 1325 of file Generator.cc.
References Nsound::RandomNumberGenerator::get(), M_ASSERT_VALUE, Nsound::Generator::rng_, and Nsound::Generator::sample_rate_.
Referenced by Nsound::Pluck::generate(), Nsound::Granulator::Granulator(), main(), Nsound::FluteSlide::play(), Nsound::DrumBD01::play(), Nsound::AudioStream::rand(), and Nsound::Buffer::rand().
|
inherited |
This method generates noise from a Gaussian distribution.
Definition at line 1343 of file Generator.cc.
References Nsound::RandomNumberGenerator::get(), M_ASSERT_VALUE, Nsound::Generator::rng_, and Nsound::Generator::sample_rate_.
This method draws the tanh function accross duration samples.
Definition at line 1397 of file Generator.cc.
References M_ASSERT_VALUE, M_PI, and Nsound::Generator::sample_rate_.
|
protectedvirtualinherited |
DOXME.
Definition at line 201 of file Generator.cc.
References Nsound::Generator::rng_, Nsound::Generator::sample_rate_, Nsound::Generator::sample_time_, and Nsound::Generator::waveform_.
Referenced by Nsound::Cosine::Cosine(), Nsound::Generator::ctor(), Nsound::Generator::Generator(), Nsound::Sawtooth::Sawtooth(), Nsound::Sine::Sine(), Nsound::Square::Square(), and Triangle().
|
protectedvirtualinherited |
DOXME.
Definition at line 212 of file Generator.cc.
References Nsound::Generator::ctor(), Nsound::Buffer::getLength(), M_THROW, Nsound::Generator::rng_, Nsound::Generator::sample_rate_, Nsound::Generator::sample_time_, and Nsound::Generator::waveform_.
|
protectedinherited |
Definition at line 611 of file Generator.h.
Referenced by Nsound::Generator::generate(), Nsound::Generator::generate2(), and Nsound::Generator::setRealtime().
|
protectedinherited |
Definition at line 613 of file Generator.h.
Referenced by Nsound::Generator::buzz(), Nsound::Generator::operator=(), and Nsound::Generator::reset().
|
protectedinherited |
Used for phase offset adjustment.
Definition at line 614 of file Generator.h.
Referenced by Nsound::Generator::buzz(), Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), Nsound::Generator::reset(), and Nsound::Generator::tell().
|
protectedinherited |
The number of samples into the wavefrom.
Definition at line 615 of file Generator.h.
Referenced by Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), and Nsound::Generator::reset().
|
protectedinherited |
Used to determine when to create a sync sample.
Definition at line 616 of file Generator.h.
Referenced by Nsound::Generator::buzz(), Nsound::Generator::ctor(), Nsound::Generator::drawLine(), Nsound::Generator::drawSine(), Nsound::Generator::drawSine2(), Nsound::Generator::drawWindowBartlett(), Nsound::Generator::drawWindowParzen(), Nsound::Generator::gaussianNoise(), Nsound::Pluck::generate(), Nsound::Generator::generate(), Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), Nsound::Sawtooth::Sawtooth(), Nsound::Square::Square(), Nsound::Generator::tanh(), Nsound::Generator::tell(), and Nsound::Generator::whiteNoise().
|
protectedinherited |
The number of samples per second to generate.
Definition at line 617 of file Generator.h.
Referenced by Nsound::Generator::ctor(), Nsound::Generator::drawSine2(), Nsound::Pulse::generate2(), and Nsound::Generator::operator=().
|
protectedinherited |
The time step between samples in seconds.
Definition at line 618 of file Generator.h.
Referenced by Nsound::Generator::drawSine(), Nsound::Generator::drawSine2(), Nsound::Pulse::generate2(), Nsound::Generator::operator=(), Nsound::Pulse::reset(), and Nsound::Generator::reset().
|
protectedinherited |
The current time (for real time draw functions.)
Definition at line 619 of file Generator.h.
Referenced by Nsound::Generator::ctor(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), and Nsound::Generator::~Generator().
|
protectedinherited |
The waveform to ossicialate.
Definition at line 621 of file Generator.h.
Referenced by Nsound::Generator::ctor(), Nsound::Generator::gaussianNoise(), Nsound::Generator::getRandomNumberGenerator(), Nsound::Generator::operator=(), Nsound::Generator::setChorus(), Nsound::Generator::setSeed(), Nsound::Generator::whiteNoise(), and Nsound::Generator::~Generator().
|
protectedinherited |
The random number generator.
Definition at line 624 of file Generator.h.
Referenced by Nsound::Generator::buzzInit(), Nsound::Generator::operator=(), and Nsound::Generator::reset().
|
protectedinherited |
Definition at line 625 of file Generator.h.
Referenced by Nsound::Generator::operator=(), and Nsound::Generator::reset().
|
protectedinherited |
Definition at line 628 of file Generator.h.
Referenced by Nsound::Generator::drawSine2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), and Nsound::Generator::setChorus().
|
protectedinherited |
Definition at line 629 of file Generator.h.
Referenced by Nsound::Generator::drawSine2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), Nsound::Generator::reset(), and Nsound::Generator::setChorus().
|
protectedinherited |
Definition at line 630 of file Generator.h.
Referenced by Nsound::Generator::drawSine2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), Nsound::Generator::reset(), and Nsound::Generator::setChorus().
|
protectedinherited |
Definition at line 631 of file Generator.h.
Referenced by Nsound::Generator::drawSine2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), and Nsound::Generator::setChorus().
|
protectedinherited |
Definition at line 634 of file Generator.h.
Referenced by Nsound::Generator::addSlaveSync(), Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), and Nsound::Generator::operator=().
|
protectedinherited |
Indicates if this generator is the master.
Definition at line 635 of file Generator.h.
Referenced by Nsound::Generator::addSlaveSync(), Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), and Nsound::Generator::removeSlaveSync().
|
protectedinherited |
Indicates if this generator is a slave.
Definition at line 636 of file Generator.h.
Referenced by Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), and Nsound::Generator::reset().
|
protectedinherited |
Indicates the number of samples since reset.
Definition at line 637 of file Generator.h.
Referenced by Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), and Nsound::Generator::operator=().
|
protectedinherited |
Stores sample counts when synced.
Definition at line 638 of file Generator.h.
Referenced by Nsound::Generator::addSlaveSync(), Nsound::GeneratorDecay::generate2(), Nsound::Generator::generate2(), Nsound::Generator::operator=(), Nsound::Generator::removeSlaveSync(), and Nsound::Generator::reset().