DaisySP
Loading...
Searching...
No Matches
analogsnaredrum.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_ANALOG_SNARE_H
11#define DSY_ANALOG_SNARE_H
12
13#include "Filters/svf.h"
14
15#include <stdint.h>
16#ifdef __cplusplus
17
20namespace daisysp
21{
31{
32 public:
35
36 static const int kNumModes = 5;
37
41 void Init(float sample_rate);
42
46 float Process(bool trigger = false);
47
49 void Trig();
50
54 void SetSustain(bool sustain);
55
59 void SetAccent(float accent);
60
64 void SetFreq(float f0);
65
69 void SetTone(float tone);
70
74 void SetDecay(float decay);
75
79 void SetSnappy(float snappy);
80
81 private:
82 float sample_rate_;
83
84 float f0_, tone_, accent_, snappy_, decay_;
85 bool sustain_;
86 bool trig_;
87
88 inline float SoftLimit(float x);
89 inline float SoftClip(float x);
90
91 int pulse_remaining_samples_;
92 float pulse_;
93 float pulse_height_;
94 float pulse_lp_;
95 float noise_envelope_;
96 float sustain_gain_;
97
98 Svf resonator_[kNumModes];
99 Svf noise_filter_;
100
101 // Replace the resonators in "free running" (sustain) mode.
102 float phase_[kNumModes];
103};
104} // namespace daisysp
105#endif
106#endif
808 snare drum model, revisited.
Definition analogsnaredrum.h:31
void SetSustain(bool sustain)
Definition analogsnaredrum.cpp:44
void SetDecay(float decay)
Definition analogsnaredrum.cpp:66
void SetTone(float tone)
Definition analogsnaredrum.cpp:60
float Process(bool trigger=false)
Definition analogsnaredrum.cpp:78
void SetAccent(float accent)
Definition analogsnaredrum.cpp:49
void SetSnappy(float snappy)
Definition analogsnaredrum.cpp:73
void Init(float sample_rate)
Definition analogsnaredrum.cpp:10
void SetFreq(float f0)
Definition analogsnaredrum.cpp:54
void Trig()
Definition analogsnaredrum.cpp:39
Definition svf.h:27
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16