A Hopf, Skip and a Jump
|
Use the central-difference approximation to calculate the output. More...
#include <detectors.h>
Public Member Functions | |
CDDetector (const parameter_t f, const parameter_t mu, const parameter_t d, const parameter_t sr, const parameter_t detBw, const parameter_t gain) | |
virtual | ~CDDetector () |
CDDetector destructor. | |
virtual void | reset () |
Reset internal values to 0. More... | |
virtual void | process (discriminator_t *target, const inputSample_t *start, const std::size_t count) override |
Method to process audio using central-difference approximation. More... | |
Public Member Functions inherited from AbstractDetector | |
AbstractDetector (parameter_t f, parameter_t mu, parameter_t d, parameter_t sr, parameter_t detBw, parameter_t gain) | |
void | processAudio (discriminator_t *target, const inputSample_t *start, std::size_t count) |
Process audio using the numerical method appropriate to the derived class. More... | |
bool | searchNormalize (parameter_t searchStart, parameter_t searchEnd, const parameter_t toneDuration, const parameter_t forcing_amplitude) |
Normalise the detector frequency using an iterative scheme. More... | |
bool | amplitudeNormalize (const parameter_t forcing_amplitude) |
Set the detector's a and iScale attributes by profiling an ideal detector response. More... | |
void | scaleAmplitude () |
Calculate amplitude scale factor. | |
void | generateTone (inputSample_t *tone, const std::size_t duration, const parameter_t frequency) |
Generate a sine tone. More... | |
parameter_t | getW (void) const |
Find the speficied characteristic frequency for this detector (post-modulation and -normalisation) More... | |
Private Attributes | |
std::complex< parameter_t > | zp |
previous z value | |
std::complex< parameter_t > | zpp |
z value two samples ago | |
inputSample_t | xp |
previous audio input sample | |
Additional Inherited Members | |
Protected Member Functions inherited from AbstractDetector | |
template<class Archive > | |
void | save (Archive &archive) const |
Save the DetectorBank as a cereal archive. More... | |
template<class Archive > | |
void | load (Archive &archive) |
Load the DetectorBank from a cereal archive. More... | |
void | makeScaleVectors () |
Make freq and factor vectors for given method and normalisation. | |
void | getScaleValue (const parameter_t fr) |
Get a scale value for a given frequency. | |
Static Protected Member Functions inherited from AbstractDetector | |
static const parameter_t | getLyapunov (const parameter_t bw, const parameter_t amp) |
Find the first Lyapunov coefficient required for a given bandwidth, with a given forcing amplitude. More... | |
Protected Attributes inherited from AbstractDetector | |
parameter_t | w |
Characteristic frequency. | |
parameter_t const | mu |
Distance from the bifurcation point. | |
parameter_t const | d |
Detector damping factor. | |
parameter_t const | sr |
Sample rate. | |
parameter_t const | detBw |
Detector bandwidth. | |
parameter_t const | gain |
Detector gain. | |
discriminator_t | aScale |
Amplitude scaling factor. | |
parameter_t | iScale |
Scaling factor for imaginary part. | |
parameter_t | b |
Detector's first Lyapunov coefficent. | |
discriminator_t | scale |
Detector's scale factor. | |
bool | nrml { false } |
If search normalisation has been applied. | |
std::vector< parameter_t > | detScaleFreqs |
std::vector< discriminator_t > | detScaleFactors |
Static Protected Attributes inherited from AbstractDetector | |
static constexpr int | maxNormIterations { 100 } |
The maximum number of iterations to find best response during search_normalization. | |
static constexpr double | normConverged { 1.0028922878693671 } |
Ratio of discovered frequency to specification frequency to be considered "close enough" during seach_normalization. More... | |
static const std::array< std::vector< parameter_t >, 8 > | scaleFreqs |
static const std::array< std::vector< discriminator_t >, 8 > | scaleFactors |
Use the central-difference approximation to calculate the output.
Uses the discrete central difference approximation,
\[ \dot y[n] = \frac 1{2\delta}\bigg(y[n+1] - y[n-1]\bigg)\]
to evalute the next output sample of the Hopf bifurcation
\[\dot z=(\mu+j\omega_0)z + b|z|^2z + X\]
with control parameter \(\mu\), first Lyapunov coeffcient \(b\) (real) and driving force \(X\). For a supercritical bifurcation, \(b < 0\). \(b = 0\) yeilds a degenerate ("Bautin") bifurcation, and \(b > 0\) yeilds a subcritical bifurcation which is unstable.
Definition at line 222 of file detectors.h.
CDDetector::CDDetector | ( | const parameter_t | f, |
const parameter_t | mu, | ||
const parameter_t | d, | ||
const parameter_t | sr, | ||
const parameter_t | detBw, | ||
const parameter_t | gain | ||
) |
f | Detector centre frequency (Hz) |
mu | Detector control parameter. (Setting mu = 0 positions the system at the bifurcation point) |
d | Detector damping ratio |
sr | Sample rate of input audio |
detBw | Detector bandwidth |
gain | Detector gain |
|
overridevirtual |
Method to process audio using central-difference approximation.
Called by runChannels() in DetectorBank.
target | Output array. This should have the correct dimensions for your desired detector bank: height = number of detectors, length = length of audio input. |
start | Current audio sample |
count | Number of frames to process |
Implements AbstractDetector.
|
virtual |
Reset internal values to 0.
This is invoked when Detect.seek() is called.
Implements AbstractDetector.