CiCueTea v0.0.1
Loading...
Searching...
No Matches
jsa::cicuetea::Slicer Class Reference

A class for slicing audio or signal data into overlapping blocks. More...

#include <Slicer.hpp>

Public Member Functions

 Slicer (Eigen::Index newBlockSize, Eigen::Index newHopSize)
 Slicer constructor that sets the block size and hop size for slicing.
void pushSample (double sample)
 Pushes a single sample into the internal buffer.
bool hasBlock ()
 Checks if a complete block is available for retrieval.
Eigen::Map< const Eigen::ArrayXd > getBlock ()
 Retrieves the next available block as a read-only Eigen::ArrayXd.
Eigen::Index getBlockSize () const
 Gets the current block size.
Eigen::Index getOverlapSize () const
 Gets the current overlap size.
Eigen::Index getHopSize () const
 Gets the current hop size.
Eigen::Index getBufferSize () const
 Gets the size of the internal buffer.

Detailed Description

A class for slicing audio or signal data into overlapping blocks.

The Slicer class provides functionality to process a continuous stream of samples and divide it into fixed-size blocks with a specified overlap. This is useful for applications such as audio processing, feature extraction, and time-domain analysis.

Constructor & Destructor Documentation

◆ Slicer()

Slicer::Slicer ( Eigen::Index newBlockSize,
Eigen::Index newHopSize )

Slicer constructor that sets the block size and hop size for slicing.

Degenerate sizes are clamped to safe minimums (blockSize >= 1, 1 <= hopSize <= blockSize) instead of asserted, so owners may construct a Slicer from an invalid configuration (see NsgfCqtCommon::isValid()); such an instance is safe to hold but produces no useful blocks.

Parameters
newBlockSizeThe size of each block in samples.
newHopSizeThe hop size (step size) between consecutive blocks in samples.

Member Function Documentation

◆ getBlock()

Map< const ArrayXd > Slicer::getBlock ( )

Retrieves the next available block as a read-only Eigen::ArrayXd.

Returns
An Eigen::Map<const Eigen::ArrayXd> representing the block.
Note
This function assumes that a block is available. Ensure hasBlock() returns true before calling this function.

◆ getBlockSize()

Eigen::Index jsa::cicuetea::Slicer::getBlockSize ( ) const
inline

Gets the current block size.

Returns
The block size in samples.

◆ getBufferSize()

Eigen::Index jsa::cicuetea::Slicer::getBufferSize ( ) const
inline

Gets the size of the internal buffer.

Returns
The buffer size in samples.

◆ getHopSize()

Eigen::Index jsa::cicuetea::Slicer::getHopSize ( ) const
inline

Gets the current hop size.

Returns
The hop size in samples.

◆ getOverlapSize()

Eigen::Index jsa::cicuetea::Slicer::getOverlapSize ( ) const
inline

Gets the current overlap size.

Returns
The overlap size in samples.

◆ hasBlock()

bool Slicer::hasBlock ( )

Checks if a complete block is available for retrieval.

Returns
True if a complete block is available, false otherwise.

◆ pushSample()

void Slicer::pushSample ( double sample)

Pushes a single sample into the internal buffer.

Parameters
sampleThe sample value to be added to the buffer.

The documentation for this class was generated from the following files:
  • /home/runner/work/CiCueTea/CiCueTea/Include/Slicer.hpp
  • /home/runner/work/CiCueTea/CiCueTea/Source/Slicer.cpp