MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ transform_time_stretch() [2/2]

template<OperationReadyData DataType>
DataType MayaFlux::Yantra::transform_time_stretch ( DataType &  input,
double  stretch_factor,
std::vector< std::vector< double > > &  working_buffer 
)

Simple time stretching via resampling using C++20 ranges (OUT-OF-PLACE)

Template Parameters
DataTypeOperationReadyData type
Parameters
inputInput data - will NOT be modified
stretch_factorStretch ratio (>1.0 = slower, <1.0 = faster)
working_bufferBuffer for operations (will be resized if needed)
Returns
Time-stretched data

Definition at line 134 of file TemporalHelper.hpp.

135{
136 if (stretch_factor == 1.0) {
137 return input;
138 }
139
140 auto [target_data, structure_info] = OperationHelper::setup_operation_buffer(input, working_buffer);
141
142 for (size_t i = 0; i < target_data.size(); ++i) {
143 auto new_size = static_cast<size_t>(target_data[i].size() * stretch_factor);
144 working_buffer[i].resize(new_size);
145 interpolate(target_data[i], working_buffer[i], new_size);
146 }
147
148 return OperationHelper::reconstruct_from_double<DataType>(working_buffer, structure_info);
149}

References interpolate(), and MayaFlux::Yantra::OperationHelper::setup_operation_buffer().

+ Here is the call graph for this function: