|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
Per-channel Jiles-Atherton hysteresis processor (field in, M out). More...
#include <Hysteresis.h>
Public Member Functions | |
| void | prepare (double sampleRate) |
Prepares the integrator for the given sample rate. A non-positive or non-finite rate is ignored (NaN used to pass the old <= 0 test and poison the integrator). | |
| void | reset () noexcept |
| Clears magnetization and integrator state. RT-safe. | |
| void | setParameters (double ms, double a, double alpha, double k, double c) noexcept |
| Sets the Jiles-Atherton parameters. | |
| void | setTolerance (double relative) noexcept |
| Where the solver stops: a Newton step under this share of Ms. | |
| void | setPredictorPeriod (int period) noexcept |
The period of the field in samples, for the predictor (0, the default, for none). With a field that repeats itself every period samples beside a slower programme (a bias carrier), the Newton steps start from dM/dt at the same phase of the last two periods, carried on in a line, in place of the last one: fewer steps, the same answer within the tolerance. | |
| int | getPredictorPeriod () const noexcept |
| double | getSaturation () const noexcept |
| Saturation magnetization Ms (A/m). | |
| double | getSmallSignalSusceptibility () const noexcept |
| Small-signal susceptibility dM/dH around the demagnetized state. | |
| T | processSample (T fieldH) noexcept |
| Processes one sample of applied field H, returns magnetization M. | |
Static Public Attributes | |
| static constexpr int | kMaxPeriod = 8 |
| The longest period the predictor follows. | |
Per-channel Jiles-Atherton hysteresis processor (field in, M out).
| T | Sample type of the audio interface (internal math is double). |
Definition at line 72 of file Hysteresis.h.
|
inlinenoexcept |
Definition at line 159 of file Hysteresis.h.
|
inlinenoexcept |
Saturation magnetization Ms (A/m).
Definition at line 162 of file Hysteresis.h.
|
inlinenoexcept |
Small-signal susceptibility dM/dH around the demagnetized state.
The reversible-branch slope c*chi_an/(1 - c*alpha*chi_an), chi_an = Ms/(3a). Used by consumers (TapeMachine) for exact small-signal gain makeup.
Definition at line 170 of file Hysteresis.h.
|
inline |
Prepares the integrator for the given sample rate. A non-positive or non-finite rate is ignored (NaN used to pass the old <= 0 test and poison the integrator).
Definition at line 78 of file Hysteresis.h.
|
inlinenoexcept |
Processes one sample of applied field H, returns magnetization M.
| fieldH | Applied magnetic field (A/m scale of the JA parameters). |
Definition at line 180 of file Hysteresis.h.
|
inlinenoexcept |
Clears magnetization and integrator state. RT-safe.
Definition at line 87 of file Hysteresis.h.
|
inlinenoexcept |
Sets the Jiles-Atherton parameters.
Defaults follow the audio-tape calibration from the DAFx literature.
| ms | Saturation magnetization (A/m). [3.5e5] |
| a | Anhysteretic shape parameter (A/m). [2.2e4] |
| alpha | Inter-domain coupling. [1.6e-3] |
| k | Coercivity / loop-loss parameter (A/m). [2.7e4] |
| c | Reversible magnetization fraction [0, 1). [1.7e-1] |
A call with any non-finite argument is ignored. Range clamping alone does not reject NaN, which would otherwise poison the integrator.
Definition at line 112 of file Hysteresis.h.
|
inlinenoexcept |
The period of the field in samples, for the predictor (0, the default, for none). With a field that repeats itself every period samples beside a slower programme (a bias carrier), the Newton steps start from dM/dt at the same phase of the last two periods, carried on in a line, in place of the last one: fewer steps, the same answer within the tolerance.
| period | 0, or 1 to kMaxPeriod samples (others are ignored). |
Definition at line 152 of file Hysteresis.h.
|
inlinenoexcept |
Where the solver stops: a Newton step under this share of Ms.
At the default (1e-9) the model is evaluated once more at the point reached. A looser stop takes that last evaluation from the slope of the step just made, and from the second step on stops as well when what is left, read from the rate the steps shrink at (a cube over a square, as Newton's), is under it. A non-finite or non-positive value is ignored.
| relative | The share of Ms, 1e-12 to 1e-3. |
Definition at line 136 of file Hysteresis.h.
|
staticconstexpr |
The longest period the predictor follows.
Definition at line 345 of file Hysteresis.h.