|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
Granular clouds and spectral-freeze textures from live input. More...
#include <GranularProcessor.h>
Public Member Functions | |
| void | prepare (const AudioSpec &spec, double bufferSeconds=4.0) |
| Allocates the capture ring and grain pool. | |
| void | reset () noexcept |
| Kills all grains and clears the capture ring. RT-safe. | |
| void | setGrainSize (T ms) noexcept |
| Grain duration in milliseconds [10, 500] (default 80). Non-finite values are ignored. | |
| void | setDensity (T perSecond) noexcept |
| Grains per second [1, 200] (default 25). Non-finite values are ignored. | |
| void | setJitter (T amount) noexcept |
| Position jitter [0, 1]: how far back grains may start (default 0.3). Non-finite values are ignored. | |
| void | setPitch (T semitones) noexcept |
| Per-grain pitch shift in semitones [-24, +24] (default 0). Non-finite values are ignored. | |
| void | setPitchJitter (T semitones) noexcept |
| Random pitch spread per grain in semitones [0, 12] (default 0). Non-finite values are ignored. | |
| void | setSpread (T amount) noexcept |
| Stereo spread of grain panning [0, 1] (default 0.5). Non-finite values are ignored. | |
| void | setFreeze (bool frozen) noexcept |
| Freezes capture: grains keep playing the held history. | |
| void | setMix (T mix) noexcept |
| Dry/wet mix [0, 1] (default 1); ramped at no more than full scale per 20 ms. Non-finite values are ignored. | |
| T | getGrainSize () const noexcept |
| T | getDensity () const noexcept |
| T | getJitter () const noexcept |
| T | getPitch () const noexcept |
| T | getPitchJitter () const noexcept |
| T | getSpread () const noexcept |
| bool | getFreeze () const noexcept |
| T | getMix () const noexcept |
| std::vector< uint8_t > | getState () const |
| Serializes the parameter state (setup/UI threads; allocates). | |
| bool | setState (const uint8_t *data, size_t size) |
| Restores parameters from a blob (tolerant; rejects foreign ids). | |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes a block in-place (1 or 2 channels). Pass-through until prepare() succeeds. | |
Static Public Member Functions | |
| static constexpr int | getLatency () noexcept |
| Zero: the cloud is parallel to the dry path. | |
Static Public Attributes | |
| static constexpr int | kMaxGrains = 64 |
Granular clouds and spectral-freeze textures from live input.
| T | Sample type (float or double). |
Definition at line 79 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 200 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 205 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 199 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 201 of file GranularProcessor.h.
|
inlinestaticconstexprnoexcept |
Zero: the cloud is parallel to the dry path.
Definition at line 209 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 206 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 202 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 203 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 204 of file GranularProcessor.h.
|
inline |
Serializes the parameter state (setup/UI threads; allocates).
Definition at line 212 of file GranularProcessor.h.
|
inline |
Allocates the capture ring and grain pool.
Invalid specs (non-positive/non-finite rate, block size or channel count) are ignored: the previous state is kept and an unprepared instance stays pass-through. A non-finite bufferSeconds falls back to the 4 s default.
| spec | Audio environment specification. |
| bufferSeconds | Capture history length, clamped to [0.5, 16] s (default 4 s). |
Definition at line 98 of file GranularProcessor.h.
|
inlinenoexcept |
Processes a block in-place (1 or 2 channels). Pass-through until prepare() succeeds.
Definition at line 248 of file GranularProcessor.h.
|
inlinenoexcept |
Kills all grains and clears the capture ring. RT-safe.
Definition at line 124 of file GranularProcessor.h.
|
inlinenoexcept |
Grains per second [1, 200] (default 25). Non-finite values are ignored.
Definition at line 147 of file GranularProcessor.h.
|
inlinenoexcept |
Freezes capture: grains keep playing the held history.
Definition at line 186 of file GranularProcessor.h.
|
inlinenoexcept |
Grain duration in milliseconds [10, 500] (default 80). Non-finite values are ignored.
Definition at line 139 of file GranularProcessor.h.
|
inlinenoexcept |
Position jitter [0, 1]: how far back grains may start (default 0.3). Non-finite values are ignored.
Definition at line 155 of file GranularProcessor.h.
|
inlinenoexcept |
Dry/wet mix [0, 1] (default 1); ramped at no more than full scale per 20 ms. Non-finite values are ignored.
Definition at line 193 of file GranularProcessor.h.
|
inlinenoexcept |
Per-grain pitch shift in semitones [-24, +24] (default 0). Non-finite values are ignored.
Definition at line 163 of file GranularProcessor.h.
|
inlinenoexcept |
Random pitch spread per grain in semitones [0, 12] (default 0). Non-finite values are ignored.
Definition at line 171 of file GranularProcessor.h.
|
inlinenoexcept |
Stereo spread of grain panning [0, 1] (default 0.5). Non-finite values are ignored.
Definition at line 179 of file GranularProcessor.h.
|
inline |
Restores parameters from a blob (tolerant; rejects foreign ids).
Definition at line 229 of file GranularProcessor.h.
|
staticconstexpr |
Definition at line 82 of file GranularProcessor.h.