DaisySP
Loading...
Searching...
No Matches
synthbassdrum.h
Go to the documentation of this file.
1/*
2Copyright (c) 2020 Electrosmith, Corp, Emilie Gillet
3
4Use of this source code is governed by an MIT-style
5license that can be found in the LICENSE file or at
6https://opensource.org/licenses/MIT.
7*/
8
9#pragma once
10#ifndef DSY_SYNTHBD_H
11#define DSY_SYNTHBD_H
12
13#include "Filters/svf.h"
14#include "Utility/dsp.h"
15
16#include <stdint.h>
17#ifdef __cplusplus
18
21namespace daisysp
22{
32{
33 public:
36
40 void Init(float sample_rate);
41
45 float Process(float in);
46
47 private:
48 float lp_;
49 float hp_;
50 Svf filter_;
51};
52
62{
63 public:
66
68 void Init();
69
71 float Process();
72
73 private:
74 float lp_;
75 float hp_;
76};
77
88{
89 public:
92
96 void Init(float sample_rate);
97
99 inline float DistortedSine(float phase, float phase_noise, float dirtiness);
100
105 inline float TransistorVCA(float s, float gain);
106
110 float Process(bool trigger = false);
111
113 void Trig();
114
118 void SetSustain(bool sustain);
119
123 void SetAccent(float accent);
124
128 void SetFreq(float freq);
129
133 void SetTone(float tone);
134
138 void SetDecay(float decay);
139
143 void SetDirtiness(float dirtiness);
144
148 void SetFmEnvelopeAmount(float fm_envelope_amount);
149
153 void SetFmEnvelopeDecay(float fm_envelope_decay);
154
155 private:
156 float sample_rate_;
157
158 bool trig_;
159 bool sustain_;
160 float accent_, new_f0_, tone_, decay_;
161 float dirtiness_, fm_envelope_amount_, fm_envelope_decay_;
162
163 float f0_;
164 float phase_;
165 float phase_noise_;
166
167 float fm_;
168 float fm_lp_;
169 float body_env_;
170 float body_env_lp_;
171 float transient_env_;
172 float transient_env_lp_;
173
174 float sustain_gain_;
175
176 float tone_lp_;
177
180
181 int body_env_pulse_width_;
182 int fm_pulse_width_;
183};
184
185} // namespace daisysp
186#endif
187#endif
Definition svf.h:27
Attack Noise generator for SyntheticBassDrum.
Definition synthbassdrum.h:62
float Process()
Definition synthbassdrum.cpp:33
void Init()
Definition synthbassdrum.cpp:27
Click noise for SyntheticBassDrum.
Definition synthbassdrum.h:32
float Process(float in)
Definition synthbassdrum.cpp:16
void Init(float sample_rate)
Definition synthbassdrum.cpp:7
Naive bass drum model (modulated oscillator with FM + envelope).
Definition synthbassdrum.h:88
float TransistorVCA(float s, float gain)
Definition synthbassdrum.cpp:89
float Process(bool trigger=false)
Definition synthbassdrum.cpp:95
void SetSustain(bool sustain)
Definition synthbassdrum.cpp:190
void SetFmEnvelopeDecay(float fm_envelope_decay)
Definition synthbassdrum.cpp:227
void SetFmEnvelopeAmount(float fm_envelope_amount)
Definition synthbassdrum.cpp:222
void SetAccent(float accent)
Definition synthbassdrum.cpp:195
void Trig()
Definition synthbassdrum.cpp:185
void SetDecay(float decay)
Definition synthbassdrum.cpp:211
float DistortedSine(float phase, float phase_noise, float dirtiness)
Definition synthbassdrum.cpp:72
void SetDirtiness(float dirtiness)
Definition synthbassdrum.cpp:217
void SetFreq(float freq)
Definition synthbassdrum.cpp:200
void Init(float sample_rate)
Definition synthbassdrum.cpp:41
void SetTone(float tone)
Definition synthbassdrum.cpp:206
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16