Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
spectral_jitter.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
24namespace pulp::gpu_audio {
25
26constexpr float kSpectralTwoPi = 6.2831853071795864f;
27
30inline float spectral_phase_hash(std::uint32_t bin, std::uint32_t seed) {
31 std::uint32_t h = bin * 2654435761u + seed * 40503u;
32 h = (h ^ (h >> 15u)) * 2246822519u;
33 h = (h ^ (h >> 13u)) * 3266489917u;
34 h = h ^ (h >> 16u);
35 return static_cast<float>(h >> 8u) / 16777216.0f - 0.5f;
36}
37
41inline std::uint32_t advance_spectral_seed(std::uint32_t seed) {
42 return seed * 1664525u + 1013904223u;
43}
44
46constexpr std::uint32_t kSpectralSeedInit = 0x9E3779B9u;
47
48} // namespace pulp::gpu_audio
Definition flow_pans.hpp:19
constexpr std::uint32_t kSpectralSeedInit
Shared initial jitter seed so every engine starts the same wander sequence.
Definition spectral_jitter.hpp:46
float spectral_phase_hash(std::uint32_t bin, std::uint32_t seed)
Integer hash → float in [-0.5, 0.5], deterministic per (bin, seed).
Definition spectral_jitter.hpp:30
constexpr float kSpectralTwoPi
Definition spectral_jitter.hpp:26
std::uint32_t advance_spectral_seed(std::uint32_t seed)
Advance the jitter seed one render hop (the classic Numerical-Recipes LCG).
Definition spectral_jitter.hpp:41