|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
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); smoothed linearly over one block. 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 56 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 176 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 181 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 175 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 177 of file GranularProcessor.h.
|
inlinestaticconstexprnoexcept |
Zero: the cloud is parallel to the dry path.
Definition at line 185 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 182 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 178 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 179 of file GranularProcessor.h.
|
inlinenoexcept |
Definition at line 180 of file GranularProcessor.h.
|
inline |
Serializes the parameter state (setup/UI threads; allocates).
Definition at line 188 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 75 of file GranularProcessor.h.
|
inlinenoexcept |
Processes a block in-place (1 or 2 channels). Pass-through until prepare() succeeds.
Definition at line 224 of file GranularProcessor.h.
|
inlinenoexcept |
Kills all grains and clears the capture ring. RT-safe.
Definition at line 100 of file GranularProcessor.h.
|
inlinenoexcept |
Grains per second [1, 200] (default 25). Non-finite values are ignored.
Definition at line 123 of file GranularProcessor.h.
|
inlinenoexcept |
Freezes capture: grains keep playing the held history.
Definition at line 162 of file GranularProcessor.h.
|
inlinenoexcept |
Grain duration in milliseconds [10, 500] (default 80). Non-finite values are ignored.
Definition at line 115 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 131 of file GranularProcessor.h.
|
inlinenoexcept |
Dry/wet mix [0, 1] (default 1); smoothed linearly over one block. Non-finite values are ignored.
Definition at line 169 of file GranularProcessor.h.
|
inlinenoexcept |
Per-grain pitch shift in semitones [-24, +24] (default 0). Non-finite values are ignored.
Definition at line 139 of file GranularProcessor.h.
|
inlinenoexcept |
Random pitch spread per grain in semitones [0, 12] (default 0). Non-finite values are ignored.
Definition at line 147 of file GranularProcessor.h.
|
inlinenoexcept |
Stereo spread of grain panning [0, 1] (default 0.5). Non-finite values are ignored.
Definition at line 155 of file GranularProcessor.h.
|
inline |
Restores parameters from a blob (tolerant; rejects foreign ids).
Definition at line 205 of file GranularProcessor.h.
|
staticconstexpr |
Definition at line 59 of file GranularProcessor.h.