#include <Synthesizer.h>
Public Member Functions | |
| Synthesizer (double srate, std::vector< double > &buffer, double fadeTime=.001) | |
| void | synthesize (const Partial &p) |
| void | operator() (const Partial &p) |
| Function call operator: same as synthesize( p ). | |
| template<typename Iter > | |
| void | synthesize (Iter begin_partials, Iter end_partials) |
| template<typename Iter > | |
| void | operator() (Iter begin_partials, Iter end_partials) |
| double | fadeTime (void) const |
| Return this Synthesizer's Partial fade time, in seconds. | |
| double | sampleRate (void) const |
| Return the sampling rate (in Hz) for this Synthesizer. | |
| const std::vector< double > & | samples (void) const |
| std::vector< double > & | samples (void) |
| void | setFadeTime (double t) |
Class Synthesizer represents an algorithm for rendering bandwidth-enhanced Partials as floating point (double) samples at a specified sampling rate, and accumulating them into a buffer.
The Synthesizer does not own the sample buffer, the client is responsible for its construction and destruction, and many Synthesizers may share a buffer.
| Loris::Synthesizer::Synthesizer | ( | double | srate, | |
| std::vector< double > & | buffer, | |||
| double | fadeTime = .001 | |||
| ) |
Construct a Synthesizer using the specified sampling rate, sample buffer (a standard library vector), and Partial fade time (in seconds). Since Partials generated by the Loris Analyzer generally begin and end at non-zero amplitude, zero-amplitude Breakpoints are inserted at either end of the Partial, at a temporal distance equal to the fade time, to reduce turn-on and turn-off artifacts. If the fade time is unspecified, the default value of one millisecond (0.001 seconds) is used.
| srate | The rate (Hz) at which to synthesize samples (must be positive). | |
| buffer | The vector (of doubles) into which rendered samples should be accumulated. | |
| fadeTime | The Partial fade time in seconds (must be non-negative). |
| InvalidArgument | if the specfied sample rate is non-positive. | |
| InvalidArgument | if the specified fade time is negative. |
| void Loris::Synthesizer::operator() | ( | Iter | begin_partials, | |
| Iter | end_partials | |||
| ) | [inline] |
Function call operator: same as synthesize( begin_partials, end_partials ).
Function call operator: same as synthesize( begin_partials, end_partials, timeShift ).
| std::vector<double>& Loris::Synthesizer::samples | ( | void | ) |
Return a reference to the sample buffer used (not owned) by this Synthesizer.
| const std::vector<double>& Loris::Synthesizer::samples | ( | void | ) | const |
Return a const reference to the sample buffer used (not owned) by this Synthesizer.
| void Loris::Synthesizer::setFadeTime | ( | double | t | ) |
Set this Synthesizer's fade time to the specified value (in seconds, must be non-negative).
| t | The new Partial fade time. |
| InvalidArgument | if the specified fade time is negative. |
| void Loris::Synthesizer::synthesize | ( | Iter | begin_partials, | |
| Iter | end_partials | |||
| ) | [inline] |
Synthesize all Partials on the specified half-open (STL-style) range. Null Breakpoints are inserted at either end of the Partial to reduce turn-on and turn-off artifacts, as described above. The synthesizer will resize the buffer as necessary to accommodate all the samples, including the fade outs. Previous contents of the buffer are not overwritten. Partials with start times earlier than the Partial fade time will have shorter onset fades. Partials are not rendered at frequencies above the half-sample rate.
| begin_partials | The beginning of the range of Partials to synthesize. | |
| end_partials | The end of the range of Partials to synthesize. |
| InvalidPartial | if any Partial has negative start time. |
| begin_partials | The beginning of the range of Partials to synthesize. | |
| end_partials | The end of the range of Partials to synthesize. |
| InvalidPartial | if any Partial has negative start time. |
| void Loris::Synthesizer::synthesize | ( | const Partial & | p | ) |
Synthesize a bandwidth-enhanced sinusoidal Partial. Zero-amplitude Breakpoints are inserted at either end of the Partial to reduce turn-on and turn-off artifacts, as described above. The synthesizer will resize the buffer as necessary to accommodate all the samples, including the fade out. Previous contents of the buffer are not overwritten. Partials with start times earlier than the Partial fade time will have shorter onset fades. Partials are not rendered at frequencies above the half-sample rate.
| p | The Partial to synthesize. |
| InvalidPartial | if the Partial has negative start time. |
1.5.7