DaisySP
Loading...
Searching...
No Matches
particle.h
Go to the documentation of this file.
1#pragma once
2#ifndef DSY_PARTICLE_H
3#define DSY_PARTICLE_H
4
5#include "Filters/svf.h"
6#include <stdint.h>
7#include <cstdlib>
8#ifdef __cplusplus
9
12namespace daisysp
13{
24{
25 public:
26 Particle() {}
27 ~Particle() {}
28
32 void Init(float sample_rate);
33
35 float Process();
36
38 float GetNoise();
39
43 void SetFreq(float frequency);
44
48 void SetResonance(float resonance);
49
53 void SetRandomFreq(float freq);
54
58 void SetDensity(float density);
59
63 void SetGain(float gain);
64
68 void SetSpread(float spread);
69
73 void SetSync(bool sync);
74
75 private:
76 static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
77 static constexpr float kRatioFrac = 1.f / 12.f;
78 float sample_rate_;
79 float aux_, frequency_, density_, gain_, spread_, resonance_;
80 bool sync_;
81
82
83 float rand_phase_;
84 float rand_freq_;
85
86
87 float pre_gain_;
88 Svf filter_;
89};
90} // namespace daisysp
91#endif
92#endif
Random impulse train processed by a resonant filter.
Definition particle.h:24
void SetRandomFreq(float freq)
Definition particle.cpp:71
float Process()
Definition particle.cpp:27
void SetSync(bool sync)
Definition particle.cpp:92
void SetResonance(float resonance)
Definition particle.cpp:66
void SetDensity(float density)
Definition particle.cpp:77
float GetNoise()
Definition particle.cpp:55
void SetSpread(float spread)
Definition particle.cpp:87
void Init(float sample_rate)
Definition particle.cpp:7
void SetGain(float gain)
Definition particle.cpp:82
void SetFreq(float frequency)
Definition particle.cpp:60
Definition svf.h:27
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16