Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::OfflineStretchT< SampleType > Class Template Reference

Offline stretcher. More...

#include <offline_stretch.hpp>

Classes

struct  Window
 Material-adaptive window/overlap recommendation. More...

Public Member Functions

void prepare (double sample_rate, int channels, const OfflineStretchOptions &sizing={})
 Size internal state for channels at sample_rate.
int channels () const noexcept
double sample_rate () const noexcept
double max_time_ratio () const noexcept
double max_pitch_semitones () const noexcept
int fft_size () const noexcept
 The STFT window actually in use (0 until prepare() with an override).
bool process (const SampleType *const *in, long in_frames, SampleType *const *out, long out_frames, const OfflineStretchOptions &opts, std::string *err=nullptr)
 Render the whole input into the caller-allocated output.

Static Public Member Functions

static Window recommend_window (const SampleType *const *in, long frames, int channels, double sample_rate)

Detailed Description

template<typename SampleType = float>
class pulp::signal::OfflineStretchT< SampleType >

Offline stretcher.

One instance per concurrent render; not thread-safe for concurrent calls on the SAME instance, but distinct instances are independent (the sampler renders slices on multiple background threads).

Member Function Documentation

◆ channels()

template<typename SampleType = float>
int pulp::signal::OfflineStretchT< SampleType >::channels ( ) const
inlinenoexcept

◆ fft_size()

template<typename SampleType = float>
int pulp::signal::OfflineStretchT< SampleType >::fft_size ( ) const
inlinenoexcept

The STFT window actually in use (0 until prepare() with an override).

◆ max_pitch_semitones()

template<typename SampleType = float>
double pulp::signal::OfflineStretchT< SampleType >::max_pitch_semitones ( ) const
inlinenoexcept

◆ max_time_ratio()

template<typename SampleType = float>
double pulp::signal::OfflineStretchT< SampleType >::max_time_ratio ( ) const
inlinenoexcept

◆ prepare()

template<typename SampleType = float>
void pulp::signal::OfflineStretchT< SampleType >::prepare ( double sample_rate,
int channels,
const OfflineStretchOptions & sizing = {} )
inline

Size internal state for channels at sample_rate.

Must be called before process(). Allocation happens here, not in process(). sizing fixes the supported range: process() ratios must stay within [1/max_time_ratio, max_time_ratio] and |pitch| within max_pitch_semitones at prepare(). Defaults give a [0.25×, 4×] / ±24 st envelope; pass wider bounds before rendering extreme tempo matches.

◆ process()

template<typename SampleType = float>
bool pulp::signal::OfflineStretchT< SampleType >::process ( const SampleType *const * in,
long in_frames,
SampleType *const * out,
long out_frames,
const OfflineStretchOptions & opts,
std::string * err = nullptr )
inline

Render the whole input into the caller-allocated output.

out_frames MUST equal offline_stretch_output_frames(in_frames, opts.time_ratio). Deinterleaved samples; in/out are arrays of channels() pointers. Returns false (with *err set, if provided) on a contract violation. process()/prepare() allocate scratch and may still throw std::bad_alloc for very long inputs or extreme ratios.

◆ recommend_window()

template<typename SampleType = float>
Window pulp::signal::OfflineStretchT< SampleType >::recommend_window ( const SampleType *const * in,
long frames,
int channels,
double sample_rate )
inlinestatic

◆ sample_rate()

template<typename SampleType = float>
double pulp::signal::OfflineStretchT< SampleType >::sample_rate ( ) const
inlinenoexcept

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