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

Multiresolution power spectrum on the grid of SpectralReadout. More...

#include <DetailAnalysis.h>

Public Member Functions

void prepare (const AudioSpec &spec)
 Allocates for a layout (an invalid spec is ignored).
 
void reset () noexcept
 Clears the signal and the spectra.
 
void setWidth (double octaves) noexcept
 The width of what is told apart, from kWidest to kFinest octaves (1/12 by default). No allocation; the next read() follows it.
 
double getWidth () const noexcept
 
void setExhaustive (bool on) noexcept
 Reads every level every hop in place of the long ones in turns (for a render).
 
bool isExhaustive () const noexcept
 
void setLinked (bool on) noexcept
 One reading for every channel, of their mean power; it holds from the next update().
 
bool isLinked () const noexcept
 
void setTimeFocus (bool on) noexcept
 Reads the shortest window through one shorter as frequency rises and gives that reading a hop later (off by default); it holds from the next update().
 
bool isTimeFocus () const noexcept
 
void feed (int channel, const T *x, int count) noexcept
 Takes the next samples of a channel (any count).
 
void update (int channels) noexcept
 A hop: takes the spectra of the levels due. The two shortest windows are read every hop, the longer ones every two or four, in turns.
 
void read (int channel, T *power) const noexcept
 The power at every point (a sine of full scale reads 1).
 
void read (int channel, T *power, int first, int end) const noexcept
 The power at the points from first to before end only (the others are left as they are): what read() gives there.
 
double getWindowSeconds (int point) const noexcept
 

Static Public Member Functions

static double frequency (int point) noexcept
 

Static Public Attributes

static constexpr int kPoints = SpectralReadout<T>::kPoints
 Points of a reading.
 
static constexpr int kMaxChannels = 16
 Channels read at most.
 
static constexpr double kFinest = 1.0 / 24.0
 Narrowest width, in octaves.
 
static constexpr double kWidest = 1.0
 Widest width, in octaves.
 

Detailed Description

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

Multiresolution power spectrum on the grid of SpectralReadout.

Template Parameters
TSample type (float or double).

Definition at line 71 of file DetailAnalysis.h.

Member Function Documentation

◆ feed()

template<FloatType T>
void dspark::DetailAnalysis< T >::feed ( int  channel,
const T *  x,
int  count 
)
inlinenoexcept

Takes the next samples of a channel (any count).

Parameters
channelThe channel; one out of range is ignored.
xThe samples.
countHow many.

Definition at line 207 of file DetailAnalysis.h.

◆ frequency()

template<FloatType T>
static double dspark::DetailAnalysis< T >::frequency ( int  point)
inlinestaticnoexcept
Returns
The frequency of a point, in hertz.

Definition at line 80 of file DetailAnalysis.h.

◆ getWidth()

template<FloatType T>
double dspark::DetailAnalysis< T >::getWidth ( ) const
inlinenoexcept
Returns
The width in octaves.

Definition at line 180 of file DetailAnalysis.h.

◆ getWindowSeconds()

template<FloatType T>
double dspark::DetailAnalysis< T >::getWindowSeconds ( int  point) const
inlinenoexcept
Returns
The length of the window a point is read through, in seconds.

Definition at line 299 of file DetailAnalysis.h.

◆ isExhaustive()

template<FloatType T>
bool dspark::DetailAnalysis< T >::isExhaustive ( ) const
inlinenoexcept
Returns
Whether every level is read every hop.

Definition at line 185 of file DetailAnalysis.h.

◆ isLinked()

template<FloatType T>
bool dspark::DetailAnalysis< T >::isLinked ( ) const
inlinenoexcept
Returns
Whether the channels are read as one.

Definition at line 190 of file DetailAnalysis.h.

◆ isTimeFocus()

template<FloatType T>
bool dspark::DetailAnalysis< T >::isTimeFocus ( ) const
inlinenoexcept
Returns
Whether the shortest window is read through the focus.

Definition at line 199 of file DetailAnalysis.h.

◆ prepare()

template<FloatType T>
void dspark::DetailAnalysis< T >::prepare ( const AudioSpec &  spec)
inline

Allocates for a layout (an invalid spec is ignored).

Parameters
specRate and channels.

Definition at line 86 of file DetailAnalysis.h.

◆ read() [1/2]

template<FloatType T>
void dspark::DetailAnalysis< T >::read ( int  channel,
T *  power 
) const
inlinenoexcept

The power at every point (a sine of full scale reads 1).

Parameters
channelThe channel; one out of range reads zero.
powerkPoints values.

Definition at line 269 of file DetailAnalysis.h.

◆ read() [2/2]

template<FloatType T>
void dspark::DetailAnalysis< T >::read ( int  channel,
T *  power,
int  first,
int  end 
) const
inlinenoexcept

The power at the points from first to before end only (the others are left as they are): what read() gives there.

Parameters
channelThe channel; one out of range reads zero.
powerkPoints values.
firstThe first point read (clamped to the grid).
endOne past the last (clamped to the grid).

Definition at line 279 of file DetailAnalysis.h.

◆ reset()

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

Clears the signal and the spectra.

Definition at line 147 of file DetailAnalysis.h.

◆ setExhaustive()

template<FloatType T>
void dspark::DetailAnalysis< T >::setExhaustive ( bool  on)
inlinenoexcept

Reads every level every hop in place of the long ones in turns (for a render).

Definition at line 183 of file DetailAnalysis.h.

◆ setLinked()

template<FloatType T>
void dspark::DetailAnalysis< T >::setLinked ( bool  on)
inlinenoexcept

One reading for every channel, of their mean power; it holds from the next update().

Definition at line 188 of file DetailAnalysis.h.

◆ setTimeFocus()

template<FloatType T>
void dspark::DetailAnalysis< T >::setTimeFocus ( bool  on)
inlinenoexcept

Reads the shortest window through one shorter as frequency rises and gives that reading a hop later (off by default); it holds from the next update().

Definition at line 197 of file DetailAnalysis.h.

◆ setWidth()

template<FloatType T>
void dspark::DetailAnalysis< T >::setWidth ( double  octaves)
inlinenoexcept

The width of what is told apart, from kWidest to kFinest octaves (1/12 by default). No allocation; the next read() follows it.

Parameters
octavesThe width; non-finite values are ignored.

Definition at line 171 of file DetailAnalysis.h.

◆ update()

template<FloatType T>
void dspark::DetailAnalysis< T >::update ( int  channels)
inlinenoexcept

A hop: takes the spectra of the levels due. The two shortest windows are read every hop, the longer ones every two or four, in turns.

Parameters
channelsThe channels fed since the last hop.

Definition at line 233 of file DetailAnalysis.h.

Member Data Documentation

◆ kFinest

template<FloatType T>
constexpr double dspark::DetailAnalysis< T >::kFinest = 1.0 / 24.0
staticconstexpr

Narrowest width, in octaves.

Definition at line 76 of file DetailAnalysis.h.

◆ kMaxChannels

template<FloatType T>
constexpr int dspark::DetailAnalysis< T >::kMaxChannels = 16
staticconstexpr

Channels read at most.

Definition at line 75 of file DetailAnalysis.h.

◆ kPoints

template<FloatType T>
constexpr int dspark::DetailAnalysis< T >::kPoints = SpectralReadout<T>::kPoints
staticconstexpr

Points of a reading.

Definition at line 74 of file DetailAnalysis.h.

◆ kWidest

template<FloatType T>
constexpr double dspark::DetailAnalysis< T >::kWidest = 1.0
staticconstexpr

Widest width, in octaves.

Definition at line 77 of file DetailAnalysis.h.


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