|
HART
0.2.0
High level Audio Regression and Testing
|
Produces a sine sweep. More...
#include <hart_sine_sweep.hpp>
Public Types | |
| enum class | Loop { no , yes } |
| Determines what to do after frequency sweep is done. More... | |
| enum class | SweepType { linear , log } |
| Determines how to change the frequency. More... | |
Public Member Functions | |
| SineSweep (double durationSeconds=1.0, double startFrequencyHz=20.0, double endFrequencyHz=20.0e3, SweepType type=SweepType::log, Loop loop=Loop::no, double initialPhaseRadians=0.0) | |
| Creates a sine sweep signal. | |
| SineSweep | withDuration (double durationSeconds) |
| Returns a new SineSweep instance with specified duration. | |
| SineSweep | withStartFrequency (double startFrequencyHz) |
| Returns a new SineSweep instance with specified start frequency. | |
| SineSweep | withEndFrequency (double endFrequencyHz) |
| Returns a new SineSweep instance with specified end frequency. | |
| SineSweep | withType (SweepType type) |
| Returns a new SineSweep instance with specified sweep type. | |
| SineSweep | withLoop (Loop loop) |
| Returns a new SineSweep instance with specified loop preference. | |
| SineSweep | withPhase (double initialPhaseRadians) |
| Returns a new SineSweep instance with specified initial phase. | |
| bool | supportsNumChannels (size_t) const override |
| Tells the host whether this Signal is capable of generating audio for a certain amount of channels. | |
| void | prepare (double sampleRateHz, size_t, size_t) override |
| Prepare the signal for rendering. | |
| void | renderNextBlock (AudioBuffer< SampleType > &output) override |
| Renders next block audio for the signal. | |
| void | reset () override |
| Resets the Signal to initial state. | |
| void | represent (std::ostream &stream) const override |
| Makes a text representation of this Signal for test failure outputs. | |
Public Member Functions inherited from Signal< SampleType, SineSweep< SampleType > > | |
| SineSweep< SampleType > & | followedBy (const DSPBase< SampleType > &dsp) |
| Adds a DSP effect to the end of signal's DSP chain by copying it. | |
| Signal & | followedBy (std::unique_ptr< DSPBase< SampleType > > dsp) |
| Adds a DSP effect to the end of signal's DSP chain by transfering a smart pointer. | |
| Signal & | followedBy (DerivedDSP &&dsp) |
| Adds a DSP effect to the end of signal's DSP chain by moving it. | |
| std::unique_ptr< SignalBase< SampleType > > | copy () const override |
| Returns a smart pointer with a copy of this object. | |
| std::unique_ptr< SignalBase< SampleType > > | move () override |
| Returns a smart pointer with a moved instance of this object. | |
| SineSweep< SampleType > & | skipTo (double startTimestampSeconds) |
| Skips the signal to a specific timestamp. | |
| SineSweep< SampleType > | operator- () const |
| Returns a copy of this signal, but with flipped phase. | |
| SineSweep< SampleType > | operator~ () const |
| Returns a copy of this signal, but with flipped phase. | |
Public Member Functions inherited from SignalBase< SampleType > | |
| SignalBase ()=default | |
| Default constructor. | |
| SignalBase (const SignalBase &other) | |
| Copies other signal. | |
| SignalBase (SignalBase &&other) noexcept | |
| Moves from other signal. | |
| virtual | ~SignalBase ()=default |
| Destructor. | |
| SignalBase & | operator= (const SignalBase &other) |
| Copies from other signal. | |
| SignalBase & | operator= (SignalBase &&other) noexcept |
| Moves from other signal. | |
| virtual bool | supportsSampleRate (double) const |
| Tells whether this Signal supports given sample rate. | |
| void | prepareWithDSPChain (double sampleRateHz, size_t numOutputChannels, size_t maxBlockSizeFrames) |
| Prepares the signal and all attached effects in the DSP chain for rendering. | |
| void | renderNextBlockWithDSPChain (AudioBuffer< SampleType > &output) |
| Renders next block audio for the signal and all the effects in the DSP chain. | |
| virtual void | resetWithDSPChain () |
| Resets to Signal and all the effects attached to its DSP chain to initial state. | |
Additional Inherited Members | |
Protected Member Functions inherited from SignalBase< SampleType > | |
| void | setNumChannels (size_t numChannels) |
| size_t | getNumChannels () |
Protected Attributes inherited from SignalBase< SampleType > | |
| size_t | m_numChannels = 1 |
| double | m_startTimestampSeconds = 0.0 |
| std::vector< std::unique_ptr< DSPBase< SampleType > > > | dspChain |
Related Symbols inherited from Signal< SampleType, SineSweep< SampleType > > | |
| MixedSignal< SampleType > | operator- (const Signal< SampleType, DerivedSignalTypeLHS > &lhs, const Signal< SampleType, DerivedSignalTypeRHS > &rhs) |
| Subtracts one signal from another, resulting in a new mixed signal. | |
| MixedSignal< SampleType > | operator+ (const Signal< SampleType, DerivedSignalTypeLHS > &lhs, const Signal< SampleType, DerivedSignalTypeRHS > &rhs) |
| Adds one signal to another, resulting in a new mixed signal. | |
| std::ostream & | operator<< (std::ostream &stream, const SignalBase< SampleType > &signal) |
| Prints readable text representation of the Signal object into the I/O stream. | |
| Signal< SampleType, DerivedSignal > & | operator>> (Signal< SampleType, DerivedSignal > &signal, DerivedDSP &&dsp) |
| Adds a DSP effect to the end of signal's DSP chain by moving it. | |
| Signal< SampleType, DerivedSignal > & | operator>> (Signal< SampleType, DerivedSignal > &signal, const DSPBase< SampleType > &dsp) |
| Adds a DSP effect to the end of signal's DSP chain by copying it. | |
| Signal< SampleType, DerivedSignal > && | operator>> (Signal< SampleType, DerivedSignal > &&signal, const DSPBase< SampleType > &dsp) |
| Adds a DSP effect to the end of signal's DSP chain by copying it. | |
| Signal< SampleType, DerivedSignal > & | operator>> (Signal< SampleType, DerivedSignal > &signal, std::unique_ptr< DSPBase< SampleType > > &&dsp) |
| Adds a DSP effect to the end of signal's DSP chain by transfering it. | |
| Signal< SampleType, DerivedSignal > && | operator>> (Signal< SampleType, DerivedSignal > &&signal, std::unique_ptr< DSPBase< SampleType > > &&dsp) |
| Adds a DSP effect to the end of signal's DSP chain by transfering it. | |
| Signal< SampleType, DerivedSignal > & | operator>> (Signal< SampleType, DerivedSignal > &signal, std::unique_ptr< DerivedDSP > &&dsp) |
| Adds a DSP effect to the end of signal's DSP chain by transfering it. | |
| Signal< SampleType, DerivedSignal > && | operator>> (Signal< SampleType, DerivedSignal > &&signal, std::unique_ptr< DerivedDSP > &&dsp) |
| Adds a DSP effect to the end of signal's DSP chain by transfering it. | |
Produces a sine sweep.
Outputs a signal at unity gain (-1.0..+1.0), linear or log sweep, up or down. Tip: If you want to get an low-high-low or a high-low-high sweep, set loop to Loop::yes, and duration of host's signal (see AudioTestBuilder::withDuration()) to 2x durationSeconds of this signal.
Definition at line 19 of file hart_sine_sweep.hpp.
|
strong |
Determines what to do after frequency sweep is done.
| Enumerator | |
|---|---|
| no | Stop after finishing one sweep. |
| yes | Keep on sweeping back and forth. |
Definition at line 24 of file hart_sine_sweep.hpp.
|
strong |
Determines how to change the frequency.
| Enumerator | |
|---|---|
| linear | Linear sweep, for a white noise-like spectrum. |
| log | Logarithmic sweep, for a pink noise-like spectrum. |
Definition at line 31 of file hart_sine_sweep.hpp.
|
inline |
Creates a sine sweep signal.
| durationSeconds | Duration of sine sweep |
| startFrequencyHz | Start frequency of the sine sweep |
| endFrequencyHz | End frequency of the sine sweep |
| type | Linear or Log frequency sweep, see SweepType |
| loop | If Loop::no is selected, the Signal will produce silence after duration; if Loop::yes is selected, the signal will keep on going back and forth between start and end frequencies (up and down) indefinitely. |
| initialPhaseRadians | Initial phase of the signal |
Definition at line 46 of file hart_sine_sweep.hpp.
|
inline |
Returns a new SineSweep instance with specified duration.
Handy if you want to skip specifying some arguments in the constructor
| durationSeconds | Duration of sine sweep |
Definition at line 76 of file hart_sine_sweep.hpp.
|
inline |
Returns a new SineSweep instance with specified start frequency.
Handy if you want to skip specifying some arguments in the constructor
| startFrequencyHz | Start frequency of the sine sweep |
Definition at line 85 of file hart_sine_sweep.hpp.
|
inline |
Returns a new SineSweep instance with specified end frequency.
Handy if you want to skip specifying some arguments in the constructor
| endFrequencyHz | End frequency of the sine sweep |
Definition at line 94 of file hart_sine_sweep.hpp.
|
inline |
Returns a new SineSweep instance with specified sweep type.
Handy if you want to skip specifying some arguments in the constructor
| type | Linear or Log frequency sweep, see SweepType |
Definition at line 103 of file hart_sine_sweep.hpp.
|
inline |
Returns a new SineSweep instance with specified loop preference.
Handy if you want to skip specifying some arguments in the constructor
| loop | If Loop::no is selected, the Signal will produce silence after duration; if Loop::yes is selected, the signal will keep on going back and forth between start and end frequencies (up and down) indefinitely. |
Definition at line 114 of file hart_sine_sweep.hpp.
|
inline |
Returns a new SineSweep instance with specified initial phase.
Handy if you want to skip specifying some arguments in the constructor
| initialPhaseRadians | Initial phase of the signal |
Definition at line 123 of file hart_sine_sweep.hpp.
|
inlineoverridevirtual |
Tells the host whether this Signal is capable of generating audio for a certain amount of channels.
It is guaranteed that the signal will not receive unsupported number of channels in renderNextBlock(). This method is guaranteed to be called at least once before prepare()
| numChannels | Number of output channels that will need to be filled |
Reimplemented from SignalBase< SampleType >.
Definition at line 128 of file hart_sine_sweep.hpp.
|
inlineoverridevirtual |
Prepare the signal for rendering.
This method is guaranteed to be called after supportsNumChannels() and supportsSampleRate(), but before renderNextBlock(). It is guaranteed that numChannels obeys supportsNumChannels() preferences, same with sampleRateHz and supportsSampleRate(). It is guaranteed that all subsequent renderNextBlock() calls will be in line with the arguments received in this callback.
| sampleRateHz | sample rate at which the audio should be generated |
| numOutputChannels | Number of output channels to be filled |
| maxBlockSizeFrames | Maximum block size in frames (samples) |
Implements SignalBase< SampleType >.
Definition at line 130 of file hart_sine_sweep.hpp.
|
inlineoverridevirtual |
Renders next block audio for the signal.
Depending on circumstances, this callback will either be called once to generate an entire piece of audio from start to finish, or called repeatedly, one block at a time. This method is guaranteed to be called strictly after prepare(), or not called at all. Number of channels and max block size are guaranteed to be in line with the ones set by prepare() callback. Assume sample rate to always be equal to the one received in the last prepare() callback. All audio blocks except the last one are guaranteed to be equal to maxBlockSizeFrames set in prepare() callback.
| output | Output audio block |
Implements SignalBase< SampleType >.
Definition at line 136 of file hart_sine_sweep.hpp.
|
inlineoverridevirtual |
Resets the Signal to initial state.
Ideally should be implemented in a way that audio produced after resetting is identical to audio produced after instantiation
Implements SignalBase< SampleType >.
Definition at line 177 of file hart_sine_sweep.hpp.
|
inlineoverridevirtual |
Makes a text representation of this Signal for test failure outputs.
It is strongly encouraged to follow python's repr() conventions for returned text - basically, put something like "MyClass(value1, value2)" (with no quotes) into the stream whenever possible, or "<Readable info in angled brackets>" otherwise. Also, use built-in stream manipulators like dbPrecision wherever applicable. Use HART_DEFINE_GENERIC_REPRESENT() to get a basic implementation for this method.
| [out] | stream | Output stream to write to |
Implements SignalBase< SampleType >.
Definition at line 185 of file hart_sine_sweep.hpp.