Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::SpectrogramBuffer Class Reference

Scrolling spectrogram buffer that accumulates STFT frames as rows. More...

#include <spectrogram.hpp>

Public Member Functions

void configure (int width, int height)
 Configure the buffer.
template<typename SampleType = float>
void push_column (const SampleType *magnitudes_db, int num_bins, const ColorMapper &mapper, float min_db=-80.0f, float max_db=0.0f)
 Push a new STFT frame as a column of colors.
void push_column (std::nullptr_t magnitudes_db, int num_bins, const ColorMapper &mapper, float min_db=-80.0f, float max_db=0.0f)
const SpectrogramColor * pixels () const
 Access the pixel buffer for rendering.
int write_column () const
 Get the column index where the next frame will be written.
int width () const
int height () const
int frames_written () const

Detailed Description

Scrolling spectrogram buffer that accumulates STFT frames as rows.

Each row is a time slice; columns are frequency bins mapped to colors.

RT contract: configure() allocates storage and is prepare/control-thread work. push_column() and accessors are allocation-free after configure().

Member Function Documentation

◆ configure()

void pulp::signal::SpectrogramBuffer::configure ( int width,
int height )
inline

Configure the buffer.

Parameters
widthNumber of time columns (scroll history depth).
heightNumber of frequency rows (typically num_bins or display height).

◆ frames_written()

int pulp::signal::SpectrogramBuffer::frames_written ( ) const
inline

◆ height()

int pulp::signal::SpectrogramBuffer::height ( ) const
inline

◆ pixels()

const SpectrogramColor * pulp::signal::SpectrogramBuffer::pixels ( ) const
inline

Access the pixel buffer for rendering.

Layout: row-major, height rows x width columns. The newest column is at (write_col_ - 1), scrolling left.

◆ push_column() [1/2]

template<typename SampleType = float>
void pulp::signal::SpectrogramBuffer::push_column ( const SampleType * magnitudes_db,
int num_bins,
const ColorMapper & mapper,
float min_db = -80.0f,
float max_db = 0.0f )
inline

Push a new STFT frame as a column of colors.

magnitudes_db: dB-scaled magnitude array, one per frequency bin. The caller maps bins to rows; this function maps dB values to colors.

◆ push_column() [2/2]

void pulp::signal::SpectrogramBuffer::push_column ( std::nullptr_t magnitudes_db,
int num_bins,
const ColorMapper & mapper,
float min_db = -80.0f,
float max_db = 0.0f )
inline

◆ width()

int pulp::signal::SpectrogramBuffer::width ( ) const
inline

◆ write_column()

int pulp::signal::SpectrogramBuffer::write_column ( ) const
inline

Get the column index where the next frame will be written.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/spectrogram.hpp