Loris::Synthesizer Class Reference
#include <Synthesizer.h>
List of all members.
Detailed Description
A Synthesizer renders bandwidth-enhanced Partials into a buffer of samples.
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.
Constructor & Destructor Documentation
Loris::Synthesizer::Synthesizer |
( |
std::vector< double > & |
buffer |
) |
|
Construct a Synthesizer using the default parameters and sample buffer (a standard library vector). 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.
- See also:
- Synthesizer::Parameters
- Parameters:
-
| buffer | The vector (of doubles) into which rendered samples should be accumulated. |
- Exceptions:
-
Loris::Synthesizer::Synthesizer |
( |
Parameters |
params, |
|
|
std::vector< double > & |
buffer | |
|
) |
| | |
Construct a Synthesizer using the specified parameters and sample buffer (a standard library vector). 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.
- Parameters:
-
| params | A Parameters struct storing the configuration of Synthesizer parameters. |
| buffer | The vector (of doubles) into which rendered samples should be accumulated. |
- Exceptions:
-
Loris::Synthesizer::Synthesizer |
( |
double |
srate, |
|
|
std::vector< double > & |
buffer | |
|
) |
| | |
Construct a Synthesizer using the specified sampling rate, sample buffer (a standard library vector), and the default fade time stored in the DefaultParameters. 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.
- Parameters:
-
| srate | The rate (Hz) at which to synthesize samples (must be positive). |
| buffer | The vector (of doubles) into which rendered samples should be accumulated. |
- Exceptions:
-
Loris::Synthesizer::Synthesizer |
( |
double |
srate, |
|
|
std::vector< double > & |
buffer, |
|
|
double |
fadeTime | |
|
) |
| | |
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.
- Parameters:
-
| 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). |
- Exceptions:
-
Member Function Documentation
static const Parameters& Loris::Synthesizer::DefaultParameters |
( |
void |
|
) |
[static] |
Default configuration of a Loris::Synthesizer. Modify the values in this structure to alter the configuration of all Synthesizers, including those used by the AiffFile class to render Partials.
Filter& Loris::Synthesizer::filter |
( |
void |
|
) |
|
Return access to the Filter used by this Synthesizer's Oscillator to implement bandwidth-enhanced sinusoidal synthesis. (Can use this access to make changes to the filter coefficients.)
static bool Loris::Synthesizer::IsValidParameters |
( |
const Parameters & |
params |
) |
[static] |
Check the validty of a Parameters structure. Returns true if the struct represents a valid Synthesizer configuration, otherwise raise InvalidArgument reporting the specific error.
- Parameters:
-
| params | A Parameters struct describing a configuration for Synthesizers. |
- Exceptions:
-
template<typename Iter >
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.
static void Loris::Synthesizer::SetDefaultParameters |
( |
const Parameters & |
params |
) |
[static] |
Assign a new default configuration of a Loris::Synthesizer to alter the configuration of all Synthesizers, including those used by the AiffFile class to render Partials.
- Parameters:
-
| params | A Parameters struct describing the new default configuration for Synthesizers. |
- Exceptions:
-
void Loris::Synthesizer::setFadeTime |
( |
double |
partialFadeTime |
) |
|
Set this Synthesizer's fade time to the specified value (in seconds, must be non-negative).
- Parameters:
-
| partialFadeTime | The new Partial fade time. |
- Exceptions:
-
void Loris::Synthesizer::setSampleRate |
( |
double |
rate |
) |
|
Set this Synthesizer's sample rate to the specified value (in Hz, must be positive).
- Parameters:
-
| rate | The new synthesis sample rate. |
- Exceptions:
-
template<typename Iter >
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.
- Parameters:
-
| begin_partials | The beginning of the range of Partials to synthesize. |
| end_partials | The end of the range of Partials to synthesize. |
- Returns:
- Nothing.
- Precondition:
- The partials must have non-negative start times.
- Postcondition:
- This Synthesizer's sample buffer (vector) has been resized to accommodate the entire duration of all the Partials including fade out at the ends.
- Exceptions:
-
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.
- Parameters:
-
| begin_partials | The beginning of the range of Partials to synthesize. |
| end_partials | The end of the range of Partials to synthesize. |
- Returns:
- Nothing.
- Precondition:
- The partials must have non-negative start times.
- Postcondition:
- This Synthesizer's sample buffer (vector) has been resized to accommodate the entire duration of all the Partials including fade out at the ends.
- Exceptions:
-
void Loris::Synthesizer::synthesize |
( |
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.
- Parameters:
-
- Returns:
- Nothing.
- Precondition:
- The partial must have non-negative start time.
- Postcondition:
- This Synthesizer's sample buffer (vector) has been resized to accommodate the entire duration of the Partial, p, including fade out at the end.
- Exceptions:
-
The documentation for this class was generated from the following file: