DaisySP
Loading...
Searching...
No Matches
synthsnaredrum.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_SYNTHSD_H
11#define DSY_SYNTHSD_H
12
13#include "Filters/svf.h"
14
15#include <stdint.h>
16#ifdef __cplusplus
17
20namespace daisysp
21{
35{
36 public:
39
43 void Init(float sample_rate);
44
48 float Process(bool trigger = false);
49
51 void Trig();
52
56 void SetSustain(bool sustain);
57
61 void SetAccent(float accent);
62
66 void SetFreq(float f0);
67
71 void SetFmAmount(float fm_amount);
72
76 void SetDecay(float decay);
77
81 void SetSnappy(float snappy);
82
83 private:
84 inline float DistortedSine(float phase);
85
86 float sample_rate_;
87
88 bool trig_;
89 bool sustain_;
90 float accent_, f0_, fm_amount_, decay_, snappy_;
91
92 float phase_[2];
93 float drum_amplitude_;
94 float snare_amplitude_;
95 float fm_;
96 float sustain_gain_;
97 int hold_counter_;
98
99 Svf drum_lp_;
100 Svf snare_hp_;
101 Svf snare_lp_;
102};
103} // namespace daisysp
104#endif
105#endif
Definition svf.h:27
Naive snare drum model (two modulated oscillators + filtered noise).
Definition synthsnaredrum.h:35
void SetFmAmount(float fm_amount)
Definition synthsnaredrum.cpp:187
void SetFreq(float f0)
Definition synthsnaredrum.cpp:181
void SetSnappy(float snappy)
Definition synthsnaredrum.cpp:198
float Process(bool trigger=false)
Definition synthsnaredrum.cpp:42
void SetAccent(float accent)
Definition synthsnaredrum.cpp:176
void SetDecay(float decay)
Definition synthsnaredrum.cpp:193
void SetSustain(bool sustain)
Definition synthsnaredrum.cpp:171
void Trig()
Definition synthsnaredrum.cpp:166
void Init(float sample_rate)
Definition synthsnaredrum.cpp:8
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16