DSPark 1.8.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::Hysteresis< T > Class Template Reference

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.
 
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.
 

Detailed Description

template<FloatType T>
class dspark::Hysteresis< T >

Per-channel Jiles-Atherton hysteresis processor (field in, M out).

Template Parameters
TSample type of the audio interface (internal math is double).

Definition at line 57 of file Hysteresis.h.

Member Function Documentation

◆ getSaturation()

template<FloatType T>
double dspark::Hysteresis< T >::getSaturation ( ) const
inlinenoexcept

Saturation magnetization Ms (A/m).

Definition at line 108 of file Hysteresis.h.

◆ getSmallSignalSusceptibility()

template<FloatType T>
double dspark::Hysteresis< T >::getSmallSignalSusceptibility ( ) const
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 116 of file Hysteresis.h.

◆ prepare()

template<FloatType T>
void dspark::Hysteresis< T >::prepare ( double  sampleRate)
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 63 of file Hysteresis.h.

◆ processSample()

template<FloatType T>
T dspark::Hysteresis< T >::processSample ( T  fieldH)
inlinenoexcept

Processes one sample of applied field H, returns magnetization M.

Parameters
fieldHApplied magnetic field (A/m scale of the JA parameters).

Definition at line 126 of file Hysteresis.h.

◆ reset()

template<FloatType T>
void dspark::Hysteresis< T >::reset ( )
inlinenoexcept

Clears magnetization and integrator state. RT-safe.

Definition at line 72 of file Hysteresis.h.

◆ setParameters()

template<FloatType T>
void dspark::Hysteresis< T >::setParameters ( double  ms,
double  a,
double  alpha,
double  k,
double  c 
)
inlinenoexcept

Sets the Jiles-Atherton parameters.

Defaults follow the audio-tape calibration from the DAFx literature.

Parameters
msSaturation magnetization (A/m). [3.5e5]
aAnhysteretic shape parameter (A/m). [2.2e4]
alphaInter-domain coupling. [1.6e-3]
kCoercivity / loop-loss parameter (A/m). [2.7e4]
cReversible 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 94 of file Hysteresis.h.


The documentation for this class was generated from the following file: