Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
gpu_spectral_freeze.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5
8
9namespace pulp::gpu_audio {
10
21 public:
27 bool prepare(uint32_t fft_size, uint32_t hop,
29 render::GpuCompute* shared_device = nullptr);
30
31 bool gpu_available() const { return stft_.gpu_available(); }
33 bool device_usable() const {
34 return stft_.device_usable();
35 }
36 uint32_t fft_size() const { return stft_.fft_size(); }
37 uint32_t hop() const { return hop_; }
38 bool is_captured() const { return captured_; }
39
42 bool capture(const float* frame_in);
43
50 bool render(float* frame_out, float phase_jitter = 0.0f);
51
52private:
53 GpuStft stft_;
54 uint32_t hop_ = 0;
55 std::vector<float> mag_; // per-bin magnitude (fft_size)
56 std::vector<float> phase_; // per-bin running phase (fft_size)
57 std::vector<float> scratch_; // 2*fft_size interleaved-complex rebuild buffer
58 std::uint32_t seed_ = 0x9E3779B9u; // jitter seed, advanced each render
59 bool captured_ = false;
60};
61
62} // namespace pulp::gpu_audio
Phase-vocoder spectral freeze: capture one analysis frame and sustain it indefinitely with a SEAMLESS...
Definition gpu_spectral_freeze.hpp:20
uint32_t hop() const
Definition gpu_spectral_freeze.hpp:37
bool gpu_available() const
Definition gpu_spectral_freeze.hpp:31
uint32_t fft_size() const
Definition gpu_spectral_freeze.hpp:36
bool capture(const float *frame_in)
Analyze frame_in (fft_size real samples) and capture its magnitude + phase as the frozen content.
bool prepare(uint32_t fft_size, uint32_t hop, signal::WindowFunction::Type window=signal::WindowFunction::Type::hann, render::GpuCompute *shared_device=nullptr)
shared_device (optional) reuses an existing GpuCompute so this freeze and a sibling spectral primitiv...
bool render(float *frame_out, float phase_jitter=0.0f)
Render the next synthesis frame (fft_size real samples), advancing each bin's phase by its nominal pe...
bool device_usable() const
False once the prepared device is lost or its generation changed.
Definition gpu_spectral_freeze.hpp:33
bool is_captured() const
Definition gpu_spectral_freeze.hpp:38
GPU short-time Fourier transform primitive (spectral toolkit).
Definition gpu_stft.hpp:21
GPU compute pipeline for non-rendering workloads (e.g.
Definition gpu_compute.hpp:48
Type
Definition windowing.hpp:43
@ hann
Definition windowing.hpp:45
Definition flow_pans.hpp:19