diff --git a/_karplus_string_8h.html b/_karplus_string_8h.html index 6c42153d..77a99a66 100644 --- a/_karplus_string_8h.html +++ b/_karplus_string_8h.html @@ -86,15 +86,14 @@ #include "Dynamics/crossfade.h"
#include "Utility/dcblock.h"
#include "Utility/delayline.h"
-#include "Filters/svf.h"
-#include "Filters/tone.h"
+#include "Filters/onepole.h"

Go to the source code of this file.

- +

Classes

class  daisysp::String
 Comb filter / KS string. More...
 Comb filter / KS string. More...
 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + +

diff --git a/_karplus_string_8h_source.html b/_karplus_string_8h_source.html index 30f9a6d2..7679d522 100644 --- a/_karplus_string_8h_source.html +++ b/_karplus_string_8h_source.html @@ -83,85 +83,93 @@
KarplusString.h
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_STRING_H
-
3#define DSY_STRING_H
-
4
-
5#include <stdint.h>
-
6
-
7#include "Dynamics/crossfade.h"
-
8#include "Utility/dcblock.h"
-
9#include "Utility/delayline.h"
-
10#include "Filters/svf.h"
-
11#include "Filters/tone.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_STRING_H
+
11#define DSY_STRING_H
12
-
13#ifdef __cplusplus
+
13#include <stdint.h>
14
-
17namespace daisysp
-
18{
-
-
28class String
-
29{
-
30 public:
-
31 String() {}
-
32 ~String() {}
-
33
-
37 void Init(float sample_rate);
-
38
-
40 void Reset();
-
41
-
45 float Process(const float in);
-
46
-
50 void SetFreq(float freq);
-
51
- -
56
-
60 void SetBrightness(float brightness);
-
61
-
65 void SetDamping(float damping);
-
66
-
67
-
68 private:
-
69 static constexpr size_t kDelayLineSize = 1024;
-
70
-
71 enum StringNonLinearity
-
72 {
-
73 NON_LINEARITY_CURVED_BRIDGE,
-
74 NON_LINEARITY_DISPERSION
-
75 };
-
76
-
77 template <String::StringNonLinearity non_linearity>
-
78 float ProcessInternal(const float in);
-
79
- -
81 DelayLine<float, kDelayLineSize / 4> stretch_;
-
82
-
83 float frequency_, non_linearity_amount_, brightness_, damping_;
-
84
-
85 float sample_rate_;
+
15#include "Dynamics/crossfade.h"
+
16#include "Utility/dcblock.h"
+
17#include "Utility/delayline.h"
+
18#include "Filters/onepole.h"
+
19
+
20#ifdef __cplusplus
+
21
+
24namespace daisysp
+
25{
+
+
35class String
+
36{
+
37 public:
+
38 String() {}
+
39 ~String() {}
+
40
+
44 void Init(float sample_rate);
+
45
+
47 void Reset();
+
48
+
52 float Process(const float in);
+
53
+
57 void SetFreq(float freq);
+
58
+ +
63
+
67 void SetBrightness(float brightness);
+
68
+
72 void SetDamping(float damping);
+
73
+
74
+
75 private:
+
76 static constexpr size_t kDelayLineSize = 1024;
+
77
+
78 enum StringNonLinearity
+
79 {
+
80 NON_LINEARITY_CURVED_BRIDGE,
+
81 NON_LINEARITY_DISPERSION
+
82 };
+
83
+
84 template <String::StringNonLinearity non_linearity>
+
85 float ProcessInternal(const float in);
86
-
87 Tone iir_damping_filter_;
-
88
-
89 DcBlock dc_blocker_;
-
90
-
91 CrossFade crossfade_;
-
92
-
93 float dispersion_noise_;
-
94 float curved_bridge_;
+ +
88 DelayLine<float, kDelayLineSize / 4> stretch_;
+
89
+
90 float frequency_, non_linearity_amount_, brightness_, damping_;
+
91
+
92 float sample_rate_;
+
93
+
94 OnePole iir_damping_filter_;
95
-
96 // Very crappy linear interpolation upsampler used for low pitches that
-
97 // do not fit the delay line. Rarely used.
-
98 float src_phase_;
-
99 float out_sample_[2];
-
100};
+
96 DcBlock dc_blocker_;
+
97
+
98 CrossFade crossfade_;
+
99
+
100 float dispersion_noise_;
+
101 float curved_bridge_;
+
102
+
103 // Very crappy linear interpolation upsampler used for low pitches that
+
104 // do not fit the delay line. Rarely used.
+
105 float src_phase_;
+
106 float out_sample_[2];
+
107};
-
101} // namespace daisysp
-
102#endif
-
103#endif
-
Definition crossfade.h:34
-
Definition dcblock.h:12
-
Definition delayline.h:21
-
Comb filter / KS string.
Definition KarplusString.h:29
+
108} // namespace daisysp
+
109#endif
+
110#endif
+
Definition crossfade.h:42
+
Definition dcblock.h:19
+
Definition delayline.h:29
+
One Pole Lowpass / Highpass Filter.
Definition onepole.h:27
+
Comb filter / KS string.
Definition KarplusString.h:36
float Process(const float in)
Definition KarplusString.cpp:43
void SetBrightness(float brightness)
Definition KarplusString.cpp:69
void Init(float sample_rate)
Definition KarplusString.cpp:8
@@ -169,8 +177,7 @@
void SetDamping(float damping)
Definition KarplusString.cpp:74
void SetNonLinearity(float non_linearity_amount)
Definition KarplusString.cpp:64
void Reset()
Definition KarplusString.cpp:29
-
Definition tone.h:13
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef ADENV_H
-
3#define ADENV_H
-
4#include <stdint.h>
-
5#ifdef __cplusplus
-
6
-
-
7namespace daisysp
-
8{
-
- -
13{
- - - - -
22};
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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 ADENV_H
+
11#define ADENV_H
+
12#include <stdint.h>
+
13#ifdef __cplusplus
+
14
+
+
15namespace daisysp
+
16{
+ -
23
-
-
31class AdEnv
-
32{
-
33 public:
-
34 AdEnv() {}
-
35 ~AdEnv() {}
-
47 void Init(float sample_rate);
-
48
-
53 float Process();
-
54
-
56 inline void Trigger() { trigger_ = 1; }
-
58 inline void SetTime(uint8_t seg, float time) { segment_time_[seg] = time; }
-
62 inline void SetCurve(float scalar) { curve_scalar_ = scalar; }
-
66 inline void SetMin(float min) { min_ = min; }
-
70 inline void SetMax(float max) { max_ = max; }
-
72 inline float GetValue() const { return (output_ * (max_ - min_)) + min_; }
-
76 inline uint8_t GetCurrentSegment() { return current_segment_; }
-
79 inline bool IsRunning() const { return current_segment_ != ADENV_SEG_IDLE; }
-
80
-
81 private:
-
82 uint8_t current_segment_, prev_segment_;
-
83 float segment_time_[ADENV_SEG_LAST];
-
84 float sample_rate_, min_, max_, output_, curve_scalar_;
-
85 float c_inc_, curve_x_, retrig_val_;
-
86 uint32_t phase_;
-
87 uint8_t trigger_;
-
88};
+
31
+
+
39class AdEnv
+
40{
+
41 public:
+
42 AdEnv() {}
+
43 ~AdEnv() {}
+
55 void Init(float sample_rate);
+
56
+
61 float Process();
+
62
+
64 inline void Trigger() { trigger_ = 1; }
+
66 inline void SetTime(uint8_t seg, float time) { segment_time_[seg] = time; }
+
70 inline void SetCurve(float scalar) { curve_scalar_ = scalar; }
+
74 inline void SetMin(float min) { min_ = min; }
+
78 inline void SetMax(float max) { max_ = max; }
+
80 inline float GetValue() const { return (output_ * (max_ - min_)) + min_; }
+
84 inline uint8_t GetCurrentSegment() { return current_segment_; }
+
87 inline bool IsRunning() const { return current_segment_ != ADENV_SEG_IDLE; }
+
88
+
89 private:
+
90 uint8_t current_segment_, prev_segment_;
+
91 float segment_time_[ADENV_SEG_LAST];
+
92 float sample_rate_, min_, max_, output_, curve_scalar_;
+
93 float c_inc_, curve_x_, retrig_val_;
+
94 uint32_t phase_;
+
95 uint8_t trigger_;
+
96};
-
89
-
90} // namespace daisysp
+
97
+
98} // namespace daisysp
-
91#endif
-
92#endif
-
Definition adenv.h:32
-
void SetTime(uint8_t seg, float time)
Definition adenv.h:58
-
uint8_t GetCurrentSegment()
Definition adenv.h:76
-
float GetValue() const
Definition adenv.h:72
-
void SetMax(float max)
Definition adenv.h:70
-
void Trigger()
Definition adenv.h:56
+
99#endif
+
100#endif
+
Definition adenv.h:40
+
void SetTime(uint8_t seg, float time)
Definition adenv.h:66
+
uint8_t GetCurrentSegment()
Definition adenv.h:84
+
float GetValue() const
Definition adenv.h:80
+
void SetMax(float max)
Definition adenv.h:78
+
void Trigger()
Definition adenv.h:64
void Init(float sample_rate)
Definition adenv.cpp:51
float Process()
Definition adenv.cpp:66
-
void SetMin(float min)
Definition adenv.h:66
-
bool IsRunning() const
Definition adenv.h:79
-
void SetCurve(float scalar)
Definition adenv.h:62
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
AdEnvSegment
Definition adenv.h:13
-
@ ADENV_SEG_LAST
Definition adenv.h:21
-
@ ADENV_SEG_DECAY
Definition adenv.h:19
-
@ ADENV_SEG_IDLE
Definition adenv.h:15
-
@ ADENV_SEG_ATTACK
Definition adenv.h:17
+
void SetMin(float min)
Definition adenv.h:74
+
bool IsRunning() const
Definition adenv.h:87
+
void SetCurve(float scalar)
Definition adenv.h:70
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
AdEnvSegment
Definition adenv.h:21
+
@ ADENV_SEG_LAST
Definition adenv.h:29
+
@ ADENV_SEG_DECAY
Definition adenv.h:27
+
@ ADENV_SEG_IDLE
Definition adenv.h:23
+
@ ADENV_SEG_ATTACK
Definition adenv.h:25
-
1#pragma once
-
2#ifndef DSY_ADSR_H
-
3#define DSY_ADSR_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
16enum
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
+
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_ADSR_H
+
11#define DSY_ADSR_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
16namespace daisysp
17{
-
18 ADSR_SEG_IDLE = 0,
-
19 ADSR_SEG_ATTACK = 1,
-
20 ADSR_SEG_DECAY = 2,
-
21 ADSR_SEG_RELEASE = 4
-
22};
-
23
-
24
-
-
33class Adsr
-
34{
-
35 public:
-
36 Adsr() {}
-
37 ~Adsr() {}
-
41 void Init(float sample_rate, int blockSize = 1);
-
46 void Retrigger(bool hard);
-
50 float Process(bool gate);
-
54 void SetTime(int seg, float time);
-
55 void SetAttackTime(float timeInS, float shape = 0.0f);
-
56 void SetDecayTime(float timeInS);
-
57 void SetReleaseTime(float timeInS);
-
58
-
59 private:
-
60 void SetTimeConstant(float timeInS, float& time, float& coeff);
-
61
-
62 public:
-
-
66 inline void SetSustainLevel(float sus_level)
-
67 {
-
68 sus_level = (sus_level <= 0.f) ? -0.01f // forces envelope into idle
-
69 : (sus_level > 1.f) ? 1.f : sus_level;
-
70 sus_level_ = sus_level;
-
71 }
+
24enum
+
25{
+
26 ADSR_SEG_IDLE = 0,
+
27 ADSR_SEG_ATTACK = 1,
+
28 ADSR_SEG_DECAY = 2,
+
29 ADSR_SEG_RELEASE = 4
+
30};
+
31
+
32
+
+
41class Adsr
+
42{
+
43 public:
+
44 Adsr() {}
+
45 ~Adsr() {}
+
49 void Init(float sample_rate, int blockSize = 1);
+
54 void Retrigger(bool hard);
+
58 float Process(bool gate);
+
62 void SetTime(int seg, float time);
+
63 void SetAttackTime(float timeInS, float shape = 0.0f);
+
64 void SetDecayTime(float timeInS);
+
65 void SetReleaseTime(float timeInS);
+
66
+
67 private:
+
68 void SetTimeConstant(float timeInS, float& time, float& coeff);
+
69
+
70 public:
+
+
74 inline void SetSustainLevel(float sus_level)
+
75 {
+
76 sus_level = (sus_level <= 0.f) ? -0.01f // forces envelope into idle
+
77 : (sus_level > 1.f) ? 1.f : sus_level;
+
78 sus_level_ = sus_level;
+
79 }
-
75 inline uint8_t GetCurrentSegment() { return mode_; }
-
79 inline bool IsRunning() const { return mode_ != ADSR_SEG_IDLE; }
-
80
-
81 private:
-
82 float sus_level_{0.f};
-
83 float x_{0.f};
-
84 float attackShape_{-1.f};
-
85 float attackTarget_{0.0f};
-
86 float attackTime_{-1.0f};
-
87 float decayTime_{-1.0f};
-
88 float releaseTime_{-1.0f};
-
89 float attackD0_{0.f};
-
90 float decayD0_{0.f};
-
91 float releaseD0_{0.f};
-
92 int sample_rate_;
-
93 uint8_t mode_{ADSR_SEG_IDLE};
-
94 bool gate_{false};
-
95};
+
83 inline uint8_t GetCurrentSegment() { return mode_; }
+
87 inline bool IsRunning() const { return mode_ != ADSR_SEG_IDLE; }
+
88
+
89 private:
+
90 float sus_level_{0.f};
+
91 float x_{0.f};
+
92 float attackShape_{-1.f};
+
93 float attackTarget_{0.0f};
+
94 float attackTime_{-1.0f};
+
95 float decayTime_{-1.0f};
+
96 float releaseTime_{-1.0f};
+
97 float attackD0_{0.f};
+
98 float decayD0_{0.f};
+
99 float releaseD0_{0.f};
+
100 int sample_rate_;
+
101 uint8_t mode_{ADSR_SEG_IDLE};
+
102 bool gate_{false};
+
103};
-
96} // namespace daisysp
-
97#endif
-
98#endif
-
Definition adsr.h:34
-
void SetSustainLevel(float sus_level)
Definition adsr.h:66
+
104} // namespace daisysp
+
105#endif
+
106#endif
+
Definition adsr.h:42
+
void SetSustainLevel(float sus_level)
Definition adsr.h:74
float Process(bool gate)
Definition adsr.cpp:95
-
uint8_t GetCurrentSegment()
Definition adsr.h:75
+
uint8_t GetCurrentSegment()
Definition adsr.h:83
void Init(float sample_rate, int blockSize=1)
Definition adsr.cpp:7
-
bool IsRunning() const
Definition adsr.h:79
+
bool IsRunning() const
Definition adsr.h:87
void Retrigger(bool hard)
Definition adsr.cpp:25
void SetTime(int seg, float time)
Definition adsr.cpp:32
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_ANALOG_BD_H
-
3#define DSY_ANALOG_BD_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8#include "Synthesis/oscillator.h"
-
9#include "Filters/svf.h"
-
10
-
13namespace daisysp
-
14{
-
- -
24{
-
25 public:
- - -
28
-
32 void Init(float sample_rate);
-
33
-
37 float Process(bool trigger = false);
-
38
-
40 void Trig();
+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_BD_H
+
11#define DSY_ANALOG_BD_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
16#include "Synthesis/oscillator.h"
+
17#include "Filters/svf.h"
+
18
+
21namespace daisysp
+
22{
+
+ +
32{
+
33 public:
+ + +
36
+
40 void Init(float sample_rate);
41
-
45 void SetSustain(bool sustain);
+
45 float Process(bool trigger = false);
46
-
50 void SetAccent(float accent);
-
51
-
55 void SetFreq(float f0);
-
56
-
60 void SetTone(float tone);
-
61
-
65 void SetDecay(float decay);
-
66
-
70 void SetAttackFmAmount(float attack_fm_amount);
-
71
-
75 void SetSelfFmAmount(float self_fm_amount);
-
76
-
77 private:
-
78 inline float Diode(float x);
+
48 void Trig();
+
49
+
53 void SetSustain(bool sustain);
+
54
+
58 void SetAccent(float accent);
+
59
+
63 void SetFreq(float f0);
+
64
+
68 void SetTone(float tone);
+
69
+
73 void SetDecay(float decay);
+
74
+
78 void SetAttackFmAmount(float attack_fm_amount);
79
-
80 float sample_rate_;
-
81
-
82 float accent_, f0_, tone_, decay_;
-
83 float attack_fm_amount_, self_fm_amount_;
+
83 void SetSelfFmAmount(float self_fm_amount);
84
-
85 bool trig_, sustain_;
-
86
-
87 int pulse_remaining_samples_;
-
88 int fm_pulse_remaining_samples_;
-
89 float pulse_;
-
90 float pulse_height_;
-
91 float pulse_lp_;
-
92 float fm_pulse_lp_;
-
93 float retrig_pulse_;
-
94 float lp_out_;
-
95 float tone_lp_;
-
96 float sustain_gain_;
-
97
-
98 Svf resonator_;
-
99
-
100 //for use in sin + cos osc. in sustain mode
-
101 float phase_;
-
102};
+
85 private:
+
86 inline float Diode(float x);
+
87
+
88 float sample_rate_;
+
89
+
90 float accent_, f0_, tone_, decay_;
+
91 float attack_fm_amount_, self_fm_amount_;
+
92
+
93 bool trig_, sustain_;
+
94
+
95 int pulse_remaining_samples_;
+
96 int fm_pulse_remaining_samples_;
+
97 float pulse_;
+
98 float pulse_height_;
+
99 float pulse_lp_;
+
100 float fm_pulse_lp_;
+
101 float retrig_pulse_;
+
102 float lp_out_;
+
103 float tone_lp_;
+
104 float sustain_gain_;
+
105
+
106 Svf resonator_;
+
107
+
108 //for use in sin + cos osc. in sustain mode
+
109 float phase_;
+
110};
-
103} // namespace daisysp
-
104#endif
-
105#endif
-
808 bass drum model, revisited.
Definition analogbassdrum.h:24
+
111} // namespace daisysp
+
112#endif
+
113#endif
+
808 bass drum model, revisited.
Definition analogbassdrum.h:32
void Trig()
Definition analogbassdrum.cpp:152
void SetSustain(bool sustain)
Definition analogbassdrum.cpp:157
void SetDecay(float decay)
Definition analogbassdrum.cpp:178
@@ -163,8 +171,8 @@
void SetTone(float tone)
Definition analogbassdrum.cpp:173
void SetAccent(float accent)
Definition analogbassdrum.cpp:162
void SetAttackFmAmount(float attack_fm_amount)
Definition analogbassdrum.cpp:184
-
Definition svf.h:19
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
Definition svf.h:27
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_ANALOG_SNARE_H
-
3#define DSY_ANALOG_SNARE_H
-
4
-
5#include "Filters/svf.h"
-
6
-
7#include <stdint.h>
-
8#ifdef __cplusplus
-
9
-
12namespace daisysp
-
13{
-
- -
23{
-
24 public:
- - -
27
-
28 static const int kNumModes = 5;
-
29
-
33 void Init(float sample_rate);
-
34
-
38 float Process(bool trigger = false);
-
39
-
41 void Trig();
+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 void SetSustain(bool sustain);
+
46 float Process(bool trigger = false);
47
-
51 void SetAccent(float accent);
-
52
-
56 void SetFreq(float f0);
-
57
-
61 void SetTone(float tone);
-
62
-
66 void SetDecay(float decay);
-
67
-
71 void SetSnappy(float snappy);
-
72
-
73 private:
-
74 float sample_rate_;
+
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
-
76 float f0_, tone_, accent_, snappy_, decay_;
-
77 bool sustain_;
-
78 bool trig_;
-
79
-
80 inline float SoftLimit(float x);
-
81 inline float SoftClip(float x);
-
82
-
83 int pulse_remaining_samples_;
-
84 float pulse_;
-
85 float pulse_height_;
-
86 float pulse_lp_;
-
87 float noise_envelope_;
-
88 float sustain_gain_;
-
89
-
90 Svf resonator_[kNumModes];
-
91 Svf noise_filter_;
-
92
-
93 // Replace the resonators in "free running" (sustain) mode.
-
94 float phase_[kNumModes];
-
95};
+
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};
-
96} // namespace daisysp
-
97#endif
-
98#endif
-
808 snare drum model, revisited.
Definition analogsnaredrum.h:23
+
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
@@ -158,8 +166,8 @@
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:19
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
Definition svf.h:27
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16

 NdaisyspFIR Filter implementation, generic and ARM CMSIS DSP based
 CAdEnv
 CAdsr
 CAllpass
 CAnalogBassDrum808 bass drum model, revisited
 CAnalogSnareDrum808 snare drum model, revisited
 CATone
 CAutowah
 CBalance
 CBiquad
 CBitcrush
 CBlOsc
 CChorusChorus Effect
 CChorusEngineSingle Chorus engine. Used in Chorus
 CClockedNoise
 CComb
 CCompressor
 CCrossFade
 CDcBlock
 CDecimator
 CDelayLine
 CDrip
 CDustDust Module
 CFIRFilterImplGeneric
 CFIRMemory
 CFIRMemory< 0, 0 >
 CFlangerFlanging Audio Effect
 CFm2
 CFold
 CFormantOscillatorFormant Oscillator Module
 CFractalRandomGeneratorFractal Noise, stacks octaves of a noise source
 CGrainletOscillatorGranular Oscillator Module
 CGranularPlayer
 CHarmonicOscillatorHarmonic Oscillator Module based on Chebyshev polynomials
 CHiHat808 HH, with a few extra parameters to push things to the CY territory..
 CJitter
 CLimiter
 CLine
 CLinearVCALinear type VCA
 CLooper
 CMaytrig
 CMetro
 CModalVoiceSimple modal synthesis voice with a mallet exciter: click -> LPF -> resonator
 CMode
 CMoogLadder
 CNlFilt
 COscillator
 COscillatorBankOscillator Bank module
 COverdriveDistortion / Overdrive Module
 CParticleRandom impulse train processed by a resonant filter
 CPhaserPhaser Effect
 CPhaserEngineSingle Phaser engine. Used in Phaser
 CPhasor
 CPitchShifter
 CPluck
 CPolyPluck
 CPort
 CResonatorResonant Body Simulation
 CResonatorSvfSVF for use in the Resonator Class
+
 CAnalogBassDrum808 bass drum model, revisited
 CAnalogSnareDrum808 snare drum model, revisited
 CAutowah
 CChorusChorus Effect
 CChorusEngineSingle Chorus engine. Used in Chorus
 CClockedNoise
 CCrossFade
 CDcBlock
 CDecimator
 CDelayLine
 CDrip
 CDustDust Module
 CFIRFilterImplGeneric
 CFIRMemory
 CFIRMemory< 0, 0 >
 CFlangerFlanging Audio Effect
 CFm2
 CFormantOscillatorFormant Oscillator Module
 CFractalRandomGeneratorFractal Noise, stacks octaves of a noise source
 CGrainletOscillatorGranular Oscillator Module
 CGranularPlayer
 CHarmonicOscillatorHarmonic Oscillator Module based on Chebyshev polynomials
 CHiHat808 HH, with a few extra parameters to push things to the CY territory..
 CLimiter
 CLinearVCALinear type VCA
 CLooper
 CMaytrig
 CMetro
 CModalVoiceSimple modal synthesis voice with a mallet exciter: click -> LPF -> resonator
 COnePoleOne Pole Lowpass / Highpass Filter
 COscillator
 COscillatorBankOscillator Bank module
 COverdriveDistortion / Overdrive Module
 CParticleRandom impulse train processed by a resonant filter
 CPhaserPhaser Effect
 CPhaserEngineSingle Phaser engine. Used in Phaser
 CPhasor
 CPitchShifter
 CResonatorResonant Body Simulation
 CResonatorSvfSVF for use in the Resonator Class
 CReverbSc
 CReverbScDl
 CRingModNoiseRing mod style metallic noise generator
 CSampleHold
 CSampleRateReducerSample rate reducer
 CSmoothRandomGeneratorSmooth random generator for internal modulation.
+
 CRingModNoiseRing mod style metallic noise generator
 CSampleHold
 CSampleRateReducerSample rate reducer
 CSmoothRandomGeneratorSmooth random generator for internal modulation.
 CSoap
 CSquareNoise808 style "metallic noise" with 6 square oscillators
 CStringComb filter / KS string
 CStringVoiceExtended Karplus-Strong, with all the niceties from Rings
 CSvf
 CSwingVCASwing type VCA
 CSyntheticBassDrumNaive bass drum model (modulated oscillator with FM + envelope)
 CSyntheticBassDrumAttackNoiseAttack Noise generator for SyntheticBassDrum
 CSyntheticBassDrumClickClick noise for SyntheticBassDrum
 CSyntheticSnareDrumNaive snare drum model (two modulated oscillators + filtered noise)
 CTone
 CTremoloTremolo effect
 CVariableSawOscillatorVariable Saw Oscillator
 CVariableShapeOscillatorVariable Waveshape Oscillator
 CVosimOscillatorVosim Oscillator Module
+
 CSoap
 CSquareNoise808 style "metallic noise" with 6 square oscillators
 CStringComb filter / KS string
 CStringVoiceExtended Karplus-Strong, with all the niceties from Rings
 CSvf
 CSwingVCASwing type VCA
 CSyntheticBassDrumNaive bass drum model (modulated oscillator with FM + envelope)
 CSyntheticBassDrumAttackNoiseAttack Noise generator for SyntheticBassDrum
 CSyntheticBassDrumClickClick noise for SyntheticBassDrum
 CSyntheticSnareDrumNaive snare drum model (two modulated oscillators + filtered noise)
 CTremoloTremolo effect
 CVariableSawOscillatorVariable Saw Oscillator
 CVariableShapeOscillatorVariable Waveshape Oscillator
 CVosimOscillatorVosim Oscillator Module
 CWavefolder
 CWhiteNoise
 CZOscillatorZOscillator Module
+
 CWavefolder
 CWhiteNoise
 CZOscillatorZOscillator Module
diff --git a/atone_8h_source.html b/atone_8h_source.html deleted file mode 100644 index 85678dd4..00000000 --- a/atone_8h_source.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - -DaisySP: Source/Filters/atone.h Source File - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
atone.h
-
-
-
1#pragma once
-
2#ifndef DSY_ATONE_H
-
3#define DSY_ATONE_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
-
19class ATone
-
20{
-
21 public:
-
22 ATone() {}
-
23 ~ATone() {}
-
27 void Init(float sample_rate);
-
28
-
29
-
33 float Process(float &in);
-
34
-
-
38 inline void SetFreq(float &freq)
-
39 {
-
40 freq_ = freq;
-
41 CalculateCoefficients();
-
42 }
-
-
43
-
47 inline float GetFreq() { return freq_; }
-
48
-
49 private:
-
50 void CalculateCoefficients();
-
51 float out_, prevout_, in_, freq_, c2_, sample_rate_;
-
52};
-
-
53} // namespace daisysp
-
54#endif
-
55#endif
-
Definition atone.h:20
-
void Init(float sample_rate)
Definition atone.cpp:7
-
float Process(float &in)
Definition atone.cpp:15
-
void SetFreq(float &freq)
Definition atone.h:38
-
float GetFreq()
Definition atone.h:47
-
Definition delayline.h:21
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
- - - - diff --git a/autowah_8h_source.html b/autowah_8h_source.html index 1b28ff81..4b11a8ec 100644 --- a/autowah_8h_source.html +++ b/autowah_8h_source.html @@ -83,46 +83,54 @@
autowah.h
-
1#pragma once
-
2#ifndef DSY_AUTOWAH_H
-
3#define DSY_AUTOWAH_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
- +
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
+
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_AUTOWAH_H
+
11#define DSY_AUTOWAH_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
16namespace daisysp
17{
-
18 public:
-
19 Autowah() {}
-
20 ~Autowah() {}
-
24 void Init(float sample_rate);
-
25
-
26
-
30 float Process(float in);
-
31
-
32
-
36 inline void SetWah(float wah) { wah_ = wah; }
-
40 inline void SetDryWet(float drywet) { wet_dry_ = drywet; }
-
44 inline void SetLevel(float level) { level_ = level; }
-
45
-
46 private:
-
47 float sampling_freq_, const1_, const2_, const4_, wah_, level_, wet_dry_,
-
48 rec0_[3], rec1_[2], rec2_[2], rec3_[2], rec4_[2], rec5_[2];
-
49};
+
+ +
25{
+
26 public:
+
27 Autowah() {}
+
28 ~Autowah() {}
+
32 void Init(float sample_rate);
+
33
+
34
+
38 float Process(float in);
+
39
+
40
+
44 inline void SetWah(float wah) { wah_ = wah; }
+
48 inline void SetDryWet(float drywet) { wet_dry_ = drywet; }
+
52 inline void SetLevel(float level) { level_ = level; }
+
53
+
54 private:
+
55 float sampling_freq_, const1_, const2_, const4_, wah_, level_, wet_dry_,
+
56 rec0_[3], rec1_[2], rec2_[2], rec3_[2], rec4_[2], rec5_[2];
+
57};
-
50} // namespace daisysp
-
51#endif
-
52#endif
-
Definition autowah.h:17
-
void SetWah(float wah)
Definition autowah.h:36
+
58} // namespace daisysp
+
59#endif
+
60#endif
+
Definition autowah.h:25
+
void SetWah(float wah)
Definition autowah.h:44
void Init(float sample_rate)
Definition autowah.cpp:7
float Process(float in)
Definition autowah.cpp:30
-
void SetLevel(float level)
Definition autowah.h:44
-
void SetDryWet(float drywet)
Definition autowah.h:40
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
void SetLevel(float level)
Definition autowah.h:52
+
void SetDryWet(float drywet)
Definition autowah.h:48
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_CHORUS_H
-
3#define DSY_CHORUS_H
-
4#ifdef __cplusplus
-
5
-
6#include <stdint.h>
-
7#include "Utility/delayline.h"
+Go to the documentation of this file.
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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
-
11namespace daisysp
-
12{
-
- -
18{
-
19 public:
-
20 ChorusEngine() {}
-
21 ~ChorusEngine() {}
-
22
-
26 void Init(float sample_rate);
-
27
-
31 float Process(float in);
-
32
-
36 void SetLfoDepth(float depth);
-
37
-
41 void SetLfoFreq(float freq);
-
42
-
46 void SetDelay(float delay);
-
47
-
51 void SetDelayMs(float ms);
-
52
-
56 void SetFeedback(float feedback);
-
57
-
58 private:
-
59 float sample_rate_;
-
60 static constexpr int32_t kDelayLength
-
61 = 2400; // 50 ms at 48kHz = .05 * 48000
-
62
-
63 //triangle lfos
-
64 float lfo_phase_;
-
65 float lfo_freq_;
-
66 float lfo_amp_;
-
67
-
68 float feedback_;
-
69
-
70 float delay_;
-
71
- -
73
-
74 float ProcessLfo();
-
75};
+
9#pragma once
+
10#ifndef DSY_CHORUS_H
+
11#define DSY_CHORUS_H
+
12#ifdef __cplusplus
+
13
+
14#include <stdint.h>
+
15#include "Utility/delayline.h"
+
16
+
19namespace daisysp
+
20{
+
+ +
26{
+
27 public:
+
28 ChorusEngine() {}
+
29 ~ChorusEngine() {}
+
30
+
34 void Init(float sample_rate);
+
35
+
39 float Process(float in);
+
40
+
44 void SetLfoDepth(float depth);
+
45
+
49 void SetLfoFreq(float freq);
+
50
+
54 void SetDelay(float delay);
+
55
+
59 void SetDelayMs(float ms);
+
60
+
64 void SetFeedback(float feedback);
+
65
+
66 private:
+
67 float sample_rate_;
+
68 static constexpr int32_t kDelayLength
+
69 = 2400; // 50 ms at 48kHz = .05 * 48000
+
70
+
71 //triangle lfos
+
72 float lfo_phase_;
+
73 float lfo_freq_;
+
74 float lfo_amp_;
+
75
+
76 float feedback_;
+
77
+
78 float delay_;
+
79
+ +
81
+
82 float ProcessLfo();
+
83};
-
76
-
77//wraps up all of the chorus engines
-
-
85class Chorus
-
86{
-
87 public:
-
88 Chorus() {}
-
89 ~Chorus() {}
-
90
-
94 void Init(float sample_rate);
-
95
-
99 float Process(float in);
-
100
-
102 float GetLeft();
+
84
+
85//wraps up all of the chorus engines
+
+
93class Chorus
+
94{
+
95 public:
+
96 Chorus() {}
+
97 ~Chorus() {}
+
98
+
102 void Init(float sample_rate);
103
-
105 float GetRight();
-
106
-
111 void SetPan(float panl, float panr);
-
112
-
116 void SetPan(float pan);
-
117
-
122 void SetLfoDepth(float depthl, float depthr);
-
123
-
127 void SetLfoDepth(float depth);
-
128
-
133 void SetLfoFreq(float freql, float freqr);
-
134
-
138 void SetLfoFreq(float freq);
-
139
-
144 void SetDelay(float delayl, float delayr);
-
145
-
149 void SetDelay(float delay);
-
150
-
155 void SetDelayMs(float msl, float msr);
-
156
-
160 void SetDelayMs(float ms);
-
161
-
166 void SetFeedback(float feedbackl, float feedbackr);
-
167
-
171 void SetFeedback(float feedback);
-
172
-
173 private:
-
174 ChorusEngine engines_[2];
-
175 float gain_frac_;
-
176 float pan_[2];
-
177
-
178 float sigl_, sigr_;
-
179};
+
107 float Process(float in);
+
108
+
110 float GetLeft();
+
111
+
113 float GetRight();
+
114
+
119 void SetPan(float panl, float panr);
+
120
+
124 void SetPan(float pan);
+
125
+
130 void SetLfoDepth(float depthl, float depthr);
+
131
+
135 void SetLfoDepth(float depth);
+
136
+
141 void SetLfoFreq(float freql, float freqr);
+
142
+
146 void SetLfoFreq(float freq);
+
147
+
152 void SetDelay(float delayl, float delayr);
+
153
+
157 void SetDelay(float delay);
+
158
+
163 void SetDelayMs(float msl, float msr);
+
164
+
168 void SetDelayMs(float ms);
+
169
+
174 void SetFeedback(float feedbackl, float feedbackr);
+
175
+
179 void SetFeedback(float feedback);
+
180
+
181 private:
+
182 ChorusEngine engines_[2];
+
183 float gain_frac_;
+
184 float pan_[2];
+
185
+
186 float sigl_, sigr_;
+
187};
-
180} //namespace daisysp
-
181#endif
-
182#endif
-
Single Chorus engine. Used in Chorus.
Definition chorus.h:18
+
188} //namespace daisysp
+
189#endif
+
190#endif
+
Single Chorus engine. Used in Chorus.
Definition chorus.h:26
void SetLfoDepth(float depth)
Definition chorus.cpp:33
void SetLfoFreq(float freq)
Definition chorus.cpp:39
void Init(float sample_rate)
Definition chorus.cpp:8
@@ -193,7 +201,7 @@
void SetDelayMs(float ms)
Definition chorus.cpp:52
float Process(float in)
Definition chorus.cpp:22
void SetFeedback(float feedback)
Definition chorus.cpp:60
-
Chorus Effect.
Definition chorus.h:86
+
Chorus Effect.
Definition chorus.h:94
void SetDelayMs(float msl, float msr)
Definition chorus.cpp:167
void SetLfoFreq(float freql, float freqr)
Definition chorus.cpp:145
void SetFeedback(float feedbackl, float feedbackr)
Definition chorus.cpp:178
@@ -204,8 +212,8 @@
void SetPan(float panl, float panr)
Definition chorus.cpp:123
float Process(float in)
Definition chorus.cpp:95
void Init(float sample_rate)
Definition chorus.cpp:85
-
Definition delayline.h:21
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
Definition delayline.h:29
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
@@ -250,7 +250,7 @@

-

Increments the Mode by one step useful for buttons, etc. that need to step through the Looper modes.

+

Increments the Mode by one step useful for buttons, etc. that need to step through the Looper modes.

@@ -329,7 +329,7 @@

-

Sets the recording mode to the specified Mode.

+

Sets the recording mode to the specified Mode.

@@ -355,7 +355,7 @@

-

Engages/Disengages the recording, depending on Mode. In all modes, the first time this is triggered a new loop will be started. The second trigger will set the loop size, and begin playback of the loop.

+

Engages/Disengages the recording, depending on Mode. In all modes, the first time this is triggered a new loop will be started. The second trigger will set the loop size, and begin playback of the loop.

diff --git a/classdaisysp_1_1_mode-members.html b/classdaisysp_1_1_mode-members.html deleted file mode 100644 index d88d0943..00000000 --- a/classdaisysp_1_1_mode-members.html +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -DaisySP: Member List - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
daisysp::Mode Member List
-
-
- -

This is the complete list of members for daisysp::Mode, including all inherited members.

- - - - - - - - -
Clear()daisysp::Mode
Init(float sample_rate)daisysp::Mode
Mode() (defined in daisysp::Mode)daisysp::Modeinline
Process(float in)daisysp::Mode
SetFreq(float freq)daisysp::Modeinline
SetQ(float q)daisysp::Modeinline
~Mode() (defined in daisysp::Mode)daisysp::Modeinline
- - - - diff --git a/classdaisysp_1_1_mode.html b/classdaisysp_1_1_mode.html deleted file mode 100644 index cd673c20..00000000 --- a/classdaisysp_1_1_mode.html +++ /dev/null @@ -1,224 +0,0 @@ - - - - - - - -DaisySP: daisysp::Mode Class Reference - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
- -
daisysp::Mode Class Reference
-
-
- -

#include <mode.h>

- - - - - - - - - - - - -

-Public Member Functions

void Init (float sample_rate)
 
float Process (float in)
 
void Clear ()
 
void SetFreq (float freq)
 
void SetQ (float q)
 
-

Detailed Description

-

Resonant Modal Filter

-

Extracted from soundpipe to work as a Daisy Module,

-

originally extracted from csound by Paul Batchelor.

-

Original Author(s): Francois Blanc, Steven Yi

-

Year: 2001

-

Location: Opcodes/biquad.c (csound)

-

Member Function Documentation

- -

◆ Clear()

- -
-
- - - - - - - -
void Mode::Clear ()
-
-

Clears the filter, returning the output to 0.0

- -
-
- -

◆ Init()

- -
-
- - - - - - - -
void Mode::Init (float sample_rate)
-
-

Initializes the instance of the module. sample_rate: frequency of the audio engine in Hz

- -
-
- -

◆ Process()

- -
-
- - - - - - - -
float Mode::Process (float in)
-
-

Processes one input sample through the filter, and returns the output.

- -
-
- -

◆ SetFreq()

- -
-
- - - - - -
- - - - - - - -
void daisysp::Mode::SetFreq (float freq)
-
-inline
-
-

Sets the resonant frequency of the modal filter. Range: Any frequency such that sample_rate / freq < PI (about 15.2kHz at 48kHz)

- -
-
- -

◆ SetQ()

- -
-
- - - - - -
- - - - - - - -
void daisysp::Mode::SetQ (float q)
-
-inline
-
-

Sets the quality factor of the filter. Range: Positive Numbers (Good values range from 70 to 1400)

- -
-
-
The documentation for this class was generated from the following files:
    -
  • Source/Filters/mode.h
  • -
  • Source/Filters/mode.cpp
  • -
-
- - - - diff --git a/classdaisysp_1_1_moog_ladder-members.html b/classdaisysp_1_1_moog_ladder-members.html deleted file mode 100644 index 33bc231b..00000000 --- a/classdaisysp_1_1_moog_ladder-members.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - -DaisySP: Member List - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
daisysp::MoogLadder Member List
-
-
- -

This is the complete list of members for daisysp::MoogLadder, including all inherited members.

- - - - - - - -
Init(float sample_rate)daisysp::MoogLadder
MoogLadder() (defined in daisysp::MoogLadder)daisysp::MoogLadderinline
Process(float in)daisysp::MoogLadder
SetFreq(float freq)daisysp::MoogLadderinline
SetRes(float res)daisysp::MoogLadderinline
~MoogLadder() (defined in daisysp::MoogLadder)daisysp::MoogLadderinline
- - - - diff --git a/classdaisysp_1_1_moog_ladder.html b/classdaisysp_1_1_moog_ladder.html deleted file mode 100644 index 6768d192..00000000 --- a/classdaisysp_1_1_moog_ladder.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - -DaisySP: daisysp::MoogLadder Class Reference - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
- -
daisysp::MoogLadder Class Reference
-
-
- -

#include <moogladder.h>

- - - - - - - - - - -

-Public Member Functions

void Init (float sample_rate)
 
float Process (float in)
 
void SetFreq (float freq)
 
void SetRes (float res)
 
-

Detailed Description

-

Moog ladder filter module

-

Ported from soundpipe

-

Original author(s) : Victor Lazzarini, John ffitch (fast tanh), Bob Moog

-

Member Function Documentation

- -

◆ Init()

- -
-
- - - - - - - -
void MoogLadder::Init (float sample_rate)
-
-

Initializes the MoogLadder module. sample_rate - The sample rate of the audio engine being run.

- -
-
- -

◆ Process()

- -
-
- - - - - - - -
float MoogLadder::Process (float in)
-
-

Processes the lowpass filter

- -
-
- -

◆ SetFreq()

- -
-
- - - - - -
- - - - - - - -
void daisysp::MoogLadder::SetFreq (float freq)
-
-inline
-
-

Sets the cutoff frequency or half-way point of the filter. Arguments

    -
  • freq - frequency value in Hz. Range: Any positive value.
  • -
- -
-
- -

◆ SetRes()

- -
-
- - - - - -
- - - - - - - -
void daisysp::MoogLadder::SetRes (float res)
-
-inline
-
-

Sets the resonance of the filter.

- -
-
-
The documentation for this class was generated from the following files:
    -
  • Source/Filters/moogladder.h
  • -
  • Source/Filters/moogladder.cpp
  • -
-
- - - - diff --git a/classdaisysp_1_1_nl_filt.html b/classdaisysp_1_1_nl_filt.html deleted file mode 100644 index 2d881e60..00000000 --- a/classdaisysp_1_1_nl_filt.html +++ /dev/null @@ -1,347 +0,0 @@ - - - - - - - -DaisySP: daisysp::NlFilt Class Reference - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
- -
daisysp::NlFilt Class Reference
-
-
- -

#include <nlfilt.h>

- - - - - - - - - - - - - - - - - - -

-Public Member Functions

void Init ()
 
void ProcessBlock (float *in, float *out, size_t size)
 
void SetCoefficients (float a, float b, float d, float C, float L)
 
void SetA (float a)
 
void SetB (float b)
 
void SetD (float d)
 
void SetC (float C)
 
void SetL (float L)
 
-

Detailed Description

-

Non-linear filter

-

port by: Stephen Hensley, December 2019

-

The four 5-coefficients: a, b, d, C, and L are used to configure different filter types.

-

Structure for Dobson/Fitch nonlinear filter

-

Revised Formula from Risto Holopainen 12 Mar 2004

-

Y{n} =tanh(a Y{n-1} + b Y{n-2} + d Y^2{n-L} + X{n} - C)

-

Though traditional filter types can be made, the effect will always respond differently to different input.

-

This Source is a heavily modified version of the original source from Csound.

-
Todo
make this work on a single sample instead of just on blocks at a time.
-

Member Function Documentation

- -

◆ Init()

- -
-
- - - - - - - -
void NlFilt::Init ()
-
-

Initializes the NlFilt object.

- -
-
- -

◆ ProcessBlock()

- -
-
- - - - - - - - - - - - - - - - -
void NlFilt::ProcessBlock (float * in,
float * out,
size_t size )
-
-

Process the array pointed to by *in and updates the output to *out; This works on a block of audio at once, the size of which is set with the size.

- -
-
- -

◆ SetA()

- -
-
- - - - - -
- - - - - - - -
void daisysp::NlFilt::SetA (float a)
-
-inline
-
-

Set Coefficient a

- -
-
- -

◆ SetB()

- -
-
- - - - - -
- - - - - - - -
void daisysp::NlFilt::SetB (float b)
-
-inline
-
-

Set Coefficient b

- -
-
- -

◆ SetC()

- -
-
- - - - - -
- - - - - - - -
void daisysp::NlFilt::SetC (float C)
-
-inline
-
-

Set Coefficient C

- -
-
- -

◆ SetCoefficients()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
void daisysp::NlFilt::SetCoefficients (float a,
float b,
float d,
float C,
float L )
-
-inline
-
-

inputs these are the five coefficients for the filter.

- -
-
- -

◆ SetD()

- -
-
- - - - - -
- - - - - - - -
void daisysp::NlFilt::SetD (float d)
-
-inline
-
-

Set Coefficient d

- -
-
- -

◆ SetL()

- -
-
- - - - - -
- - - - - - - -
void daisysp::NlFilt::SetL (float L)
-
-inline
-
-

Set Coefficient L

- -
-
-
The documentation for this class was generated from the following files:
    -
  • Source/Filters/nlfilt.h
  • -
  • Source/Filters/nlfilt.cpp
  • -
-
- - - - diff --git a/classdaisysp_1_1_nl_filt-members.html b/classdaisysp_1_1_one_pole-members.html similarity index 54% rename from classdaisysp_1_1_nl_filt-members.html rename to classdaisysp_1_1_one_pole-members.html index cd1a1aa6..e6fedcf9 100644 --- a/classdaisysp_1_1_nl_filt-members.html +++ b/classdaisysp_1_1_one_pole-members.html @@ -71,24 +71,27 @@
-
daisysp::NlFilt Member List
+
daisysp::OnePole Member List
-

This is the complete list of members for daisysp::NlFilt, including all inherited members.

+

This is the complete list of members for daisysp::OnePole, including all inherited members.

- - - - - - - - + + + + + + + + + + +
Init()daisysp::NlFilt
ProcessBlock(float *in, float *out, size_t size)daisysp::NlFilt
SetA(float a)daisysp::NlFiltinline
SetB(float b)daisysp::NlFiltinline
SetC(float C)daisysp::NlFiltinline
SetCoefficients(float a, float b, float d, float C, float L)daisysp::NlFiltinline
SetD(float d)daisysp::NlFiltinline
SetL(float L)daisysp::NlFiltinline
FILTER_MODE_HIGH_PASS enum value (defined in daisysp::OnePole)daisysp::OnePole
FILTER_MODE_LOW_PASS enum value (defined in daisysp::OnePole)daisysp::OnePole
FilterMode enum namedaisysp::OnePole
Init()daisysp::OnePoleinline
OnePole() (defined in daisysp::OnePole)daisysp::OnePoleinline
Process(float in)daisysp::OnePoleinline
ProcessBlock(float *in_out, size_t size)daisysp::OnePoleinline
Reset()daisysp::OnePoleinline
SetFilterMode(FilterMode mode)daisysp::OnePoleinline
SetFrequency(float freq)daisysp::OnePoleinline
~OnePole() (defined in daisysp::OnePole)daisysp::OnePoleinline

 autowah.h   - bitcrush.h chorus.h    decimator.h    flanger.h   - fold.h overdrive.h    phaser.h    pitchshifter.h   - reverbsc.h sampleratereducer.h    tremolo.h diff --git a/dir_2070d4a7e380cbbd969d18447f8e1de1.html b/dir_2070d4a7e380cbbd969d18447f8e1de1.html index f2ed2058..2c75357e 100644 --- a/dir_2070d4a7e380cbbd969d18447f8e1de1.html +++ b/dir_2070d4a7e380cbbd969d18447f8e1de1.html @@ -85,8 +85,6 @@    adsr.h   - line.h phasor.h   diff --git a/dir_3f5024f99c20f129a90867a1fd4d2fb0.html b/dir_3f5024f99c20f129a90867a1fd4d2fb0.html index ea5c6546..c3576a69 100644 --- a/dir_3f5024f99c20f129a90867a1fd4d2fb0.html +++ b/dir_3f5024f99c20f129a90867a1fd4d2fb0.html @@ -87,10 +87,6 @@    modalvoice.h   - pluck.h -  - PolyPluck.h resonator.h    stringvoice.h diff --git a/dir_4fd7df612bd049cbc0a2f56e0dccc641.html b/dir_4fd7df612bd049cbc0a2f56e0dccc641.html index 4fdd9a01..5b49e9ad 100644 --- a/dir_4fd7df612bd049cbc0a2f56e0dccc641.html +++ b/dir_4fd7df612bd049cbc0a2f56e0dccc641.html @@ -81,8 +81,6 @@ - - diff --git a/dir_67f332ab049eb8a9c981c585178089f0.html b/dir_67f332ab049eb8a9c981c585178089f0.html index 959347d3..056e325a 100644 --- a/dir_67f332ab049eb8a9c981c585178089f0.html +++ b/dir_67f332ab049eb8a9c981c585178089f0.html @@ -81,10 +81,6 @@

Files

 blosc.h
 
 fm2.h
 
 formantosc.h
- - - - diff --git a/dir_a84262e66930ad9071f68edb7a79274b.html b/dir_a84262e66930ad9071f68edb7a79274b.html index fce9e74c..e07fd3e9 100644 --- a/dir_a84262e66930ad9071f68edb7a79274b.html +++ b/dir_a84262e66930ad9071f68edb7a79274b.html @@ -87,16 +87,12 @@ - - - - diff --git a/dir_f237c6eb56006885c84d7a6372fe5e9f.html b/dir_f237c6eb56006885c84d7a6372fe5e9f.html index 80426c24..42933dc6 100644 --- a/dir_f237c6eb56006885c84d7a6372fe5e9f.html +++ b/dir_f237c6eb56006885c84d7a6372fe5e9f.html @@ -81,28 +81,14 @@

Files

 balance.h
 
 compressor.h
 
 crossfade.h
 
 limiter.h
 
 dsp.h
 
 jitter.h
 
 looper.h
 
 maytrig.h
 
 metro.h
 
 port.h
 
 samplehold.h
 
 smooth_random.h
- - - - - - - - - - - - - + - -

Files

 allpass.h
 
 atone.h
 
 biquad.h
 
 comb.h
 
 fir.h
 
 mode.h
 
 moogladder.h
 
 nlfilt.h
 onepole.h
 
 soap.h
 
 svf.h
 
 tone.h
 
diff --git a/doxygen_crawl.html b/doxygen_crawl.html index d5364a2a..7f7cd3ff 100644 --- a/doxygen_crawl.html +++ b/doxygen_crawl.html @@ -10,7 +10,6 @@ - @@ -18,34 +17,22 @@ - - - - - - - - - - - - + - @@ -55,12 +42,9 @@ - - - @@ -73,11 +57,9 @@ - - @@ -91,7 +73,6 @@ - @@ -116,34 +97,18 @@ - - - - - - - - - - - - - - - - @@ -166,8 +131,6 @@ - - @@ -180,12 +143,8 @@ - - - - @@ -196,12 +155,8 @@ - - - - - - + + @@ -218,20 +173,10 @@ - - - - - - - - - - @@ -260,8 +205,6 @@ - - @@ -313,7 +256,6 @@ - @@ -329,7 +271,6 @@ - @@ -342,12 +283,6 @@ - - - - - - diff --git a/drip_8h_source.html b/drip_8h_source.html index 2bbf90fe..daec146c 100644 --- a/drip_8h_source.html +++ b/drip_8h_source.html @@ -83,48 +83,56 @@
drip.h
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_DRIP_H
-
3#define DSY_DRIP_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
-
18class Drip
+Go to the documentation of this file.
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
+
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_DRIP_H
+
11#define DSY_DRIP_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
19{
-
20 public:
-
21 Drip() {}
-
22 ~Drip() {}
-
23
-
29 void Init(float sample_rate, float dettack);
-
30
-
36 float Process(bool trig);
-
37
-
38 private:
-
39 float gains0_, gains1_, gains2_, kloop_, dettack_, num_tubes_, damp_,
-
40 shake_max_, freq_, freq1_, freq2_, amp_, snd_level_, outputs00_,
-
41 outputs01_, outputs10_, outputs11_, outputs20_, outputs21_,
-
42 total_energy_, center_freqs0_, center_freqs1_, center_freqs2_,
-
43 num_objects_save_, sound_decay_, system_decay_, finalZ0_, finalZ1_,
-
44 finalZ2_, coeffs01_, coeffs00_, coeffs11_, coeffs10_, coeffs21_,
-
45 coeffs20_, shake_energy_, shake_damp_, shake_max_save_, num_objects_,
-
46 sample_rate_, res_freq0_, res_freq1_, res_freq2_, inputs1_, inputs2_;
-
47
-
48 int my_random(int max);
-
49 float noise_tick();
-
50};
+
+
26class Drip
+
27{
+
28 public:
+
29 Drip() {}
+
30 ~Drip() {}
+
31
+
37 void Init(float sample_rate, float dettack);
+
38
+
44 float Process(bool trig);
+
45
+
46 private:
+
47 float gains0_, gains1_, gains2_, kloop_, dettack_, num_tubes_, damp_,
+
48 shake_max_, freq_, freq1_, freq2_, amp_, snd_level_, outputs00_,
+
49 outputs01_, outputs10_, outputs11_, outputs20_, outputs21_,
+
50 total_energy_, center_freqs0_, center_freqs1_, center_freqs2_,
+
51 num_objects_save_, sound_decay_, system_decay_, finalZ0_, finalZ1_,
+
52 finalZ2_, coeffs01_, coeffs00_, coeffs11_, coeffs10_, coeffs21_,
+
53 coeffs20_, shake_energy_, shake_damp_, shake_max_save_, num_objects_,
+
54 sample_rate_, res_freq0_, res_freq1_, res_freq2_, inputs1_, inputs2_;
+
55
+
56 int my_random(int max);
+
57 float noise_tick();
+
58};
-
51} // namespace daisysp
-
52#endif
-
53#endif
-
Definition delayline.h:21
-
Definition drip.h:19
+
59} // namespace daisysp
+
60#endif
+
61#endif
+
Definition delayline.h:29
+
Definition drip.h:27
float Process(bool trig)
Definition drip.cpp:81
void Init(float sample_rate, float dettack)
Definition drip.cpp:31
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1
-
3#pragma once
-
4#ifndef DSY_CORE_DSP
-
5#define DSY_CORE_DSP
-
6#include <cassert>
-
7#include <cstdint>
-
8#include <random>
-
9#include <cmath>
-
10
-
13#define PI_F 3.1415927410125732421875f
-
14#define TWOPI_F (2.0f * PI_F)
-
15#define HALFPI_F (PI_F * 0.5f)
-
16#define DSY_MIN(in, mn) (in < mn ? in : mn)
-
17#define DSY_MAX(in, mx) (in > mx ? in : mx)
-
18#define DSY_CLAMP(in, mn, mx) (DSY_MIN(DSY_MAX(in, mn), mx))
-
19#define DSY_COUNTOF(_arr) (sizeof(_arr) / sizeof(_arr[0]))
-
20
-
21namespace daisysp
-
22{
-
23//Avoids division for random floats. e.g. rand() * kRandFrac
-
24static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
-
25
-
26//Convert from semitones to other units. e.g. 2 ^ (kOneTwelfth * x)
-
27static constexpr float kOneTwelfth = 1.f / 12.f;
+
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
+
11#pragma once
+
12#ifndef DSY_CORE_DSP
+
13#define DSY_CORE_DSP
+
14#include <cassert>
+
15#include <cstdint>
+
16#include <random>
+
17#include <cmath>
+
18
+
21#define PI_F 3.1415927410125732421875f
+
22#define TWOPI_F (2.0f * PI_F)
+
23#define HALFPI_F (PI_F * 0.5f)
+
24#define DSY_MIN(in, mn) (in < mn ? in : mn)
+
25#define DSY_MAX(in, mx) (in > mx ? in : mx)
+
26#define DSY_CLAMP(in, mn, mx) (DSY_MIN(DSY_MAX(in, mn), mx))
+
27#define DSY_COUNTOF(_arr) (sizeof(_arr) / sizeof(_arr[0]))
28
-
-
32inline float fmax(float a, float b)
-
33{
-
34 float r;
-
35#ifdef __arm__
-
36 asm("vmaxnm.f32 %[d], %[n], %[m]" : [d] "=t"(r) : [n] "t"(a), [m] "t"(b) :);
-
37#else
-
38 r = (a > b) ? a : b;
-
39#endif // __arm__
-
40 return r;
-
41}
+
29namespace daisysp
+
30{
+
31//Avoids division for random floats. e.g. rand() * kRandFrac
+
32static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
+
33
+
34//Convert from semitones to other units. e.g. 2 ^ (kOneTwelfth * x)
+
35static constexpr float kOneTwelfth = 1.f / 12.f;
+
36
+
+
40inline float fmax(float a, float b)
+
41{
+
42 float r;
+
43#ifdef __arm__
+
44 asm("vmaxnm.f32 %[d], %[n], %[m]" : [d] "=t"(r) : [n] "t"(a), [m] "t"(b) :);
+
45#else
+
46 r = (a > b) ? a : b;
+
47#endif // __arm__
+
48 return r;
+
49}
-
42
-
43inline float fmin(float a, float b)
-
44{
-
45 float r;
-
46#ifdef __arm__
-
47 asm("vminnm.f32 %[d], %[n], %[m]" : [d] "=t"(r) : [n] "t"(a), [m] "t"(b) :);
-
48#else
-
49 r = (a < b) ? a : b;
-
50#endif // __arm__
-
51 return r;
-
52}
-
53
-
-
56inline float fclamp(float in, float min, float max)
-
57{
-
58 return fmin(fmax(in, min), max);
-
59}
+
50
+
51inline float fmin(float a, float b)
+
52{
+
53 float r;
+
54#ifdef __arm__
+
55 asm("vminnm.f32 %[d], %[n], %[m]" : [d] "=t"(r) : [n] "t"(a), [m] "t"(b) :);
+
56#else
+
57 r = (a < b) ? a : b;
+
58#endif // __arm__
+
59 return r;
+
60}
+
61
+
+
64inline float fclamp(float in, float min, float max)
+
65{
+
66 return fmin(fmax(in, min), max);
+
67}
-
60
-
-
65inline float fastpower(float f, int n)
-
66{
-
67 long *lp, l;
-
68 lp = (long *)(&f);
-
69 l = *lp;
-
70 l -= 0x3F800000;
-
71 l <<= (n - 1);
-
72 l += 0x3F800000;
-
73 *lp = l;
-
74 return f;
-
75}
+
68
+
+
73inline float fastpower(float f, int n)
+
74{
+
75 long *lp, l;
+
76 lp = (long *)(&f);
+
77 l = *lp;
+
78 l -= 0x3F800000;
+
79 l <<= (n - 1);
+
80 l += 0x3F800000;
+
81 *lp = l;
+
82 return f;
+
83}
-
76
-
77inline float fastroot(float f, int n)
-
78{
-
79 long *lp, l;
-
80 lp = (long *)(&f);
-
81 l = *lp;
-
82 l -= 0x3F800000;
-
83 l >>= (n - 1);
-
84 l += 0x3F800000;
-
85 *lp = l;
-
86 return f;
-
87}
-
88
-
-
92inline float fastmod1f(float x)
-
93{
-
94 return x - static_cast<int>(x);
+
84
+
85inline float fastroot(float f, int n)
+
86{
+
87 long *lp, l;
+
88 lp = (long *)(&f);
+
89 l = *lp;
+
90 l -= 0x3F800000;
+
91 l >>= (n - 1);
+
92 l += 0x3F800000;
+
93 *lp = l;
+
94 return f;
95}
-
96
-
100inline float pow10f(float f)
+
100inline float fastmod1f(float x)
101{
-
102 return expf(2.302585092994046f * f);
+
102 return x - static_cast<int>(x);
103}
104
-
105/* Original code for fastlog2f by Dr. Paul Beckmann from the ARM community forum, adapted from the CMSIS-DSP library
-
106About 25% performance increase over std::log10f
-
107*/
-
108inline float fastlog2f(float f)
+
+
108inline float pow10f(float f)
109{
-
110 float frac;
-
111 int exp;
-
112 frac = frexpf(fabsf(f), &exp);
-
113 f = 1.23149591368684f;
-
114 f *= frac;
-
115 f += -4.11852516267426f;
-
116 f *= frac;
-
117 f += 6.02197014179219f;
-
118 f *= frac;
-
119 f += -3.13396450166353f;
-
120 f += exp;
-
121 return (f);
-
122}
-
123
-
124inline float fastlog10f(float f)
-
125{
-
126 return fastlog2f(f) * 0.3010299956639812f;
-
127}
-
128
-
-
131inline float mtof(float m)
-
132{
-
133 return powf(2, (m - 69.0f) / 12.0f) * 440.0f;
-
134}
+
110 return expf(2.302585092994046f * f);
+
111}
-
135
+
112
+
113/* Original code for fastlog2f by Dr. Paul Beckmann from the ARM community forum, adapted from the CMSIS-DSP library
+
114About 25% performance increase over std::log10f
+
115*/
+
116inline float fastlog2f(float f)
+
117{
+
118 float frac;
+
119 int exp;
+
120 frac = frexpf(fabsf(f), &exp);
+
121 f = 1.23149591368684f;
+
122 f *= frac;
+
123 f += -4.11852516267426f;
+
124 f *= frac;
+
125 f += 6.02197014179219f;
+
126 f *= frac;
+
127 f += -3.13396450166353f;
+
128 f += exp;
+
129 return (f);
+
130}
+
131
+
132inline float fastlog10f(float f)
+
133{
+
134 return fastlog2f(f) * 0.3010299956639812f;
+
135}
136
-
-
143inline void fonepole(float &out, float in, float coeff)
-
144{
-
145 out += coeff * (in - out);
-
146}
+
+
139inline float mtof(float m)
+
140{
+
141 return powf(2, (m - 69.0f) / 12.0f) * 440.0f;
+
142}
-
147
-
-
149enum class Mapping
-
150{
-
151 LINEAR,
-
152 EXP,
-
153 LOG,
-
154};
+
143
+
144
+
+
151inline void fonepole(float &out, float in, float coeff)
+
152{
+
153 out += coeff * (in - out);
+
154}
155
-
168inline float
-
-
169fmap(float in, float min, float max, Mapping curve = Mapping::LINEAR)
-
170{
-
171 switch(curve)
-
172 {
-
173 case Mapping::EXP:
-
174 return fclamp(min + (in * in) * (max - min), min, max);
-
175 case Mapping::LOG:
-
176 {
-
177 const float a = 1.f / log10f(max / min);
-
178 return fclamp(min * powf(10, in / a), min, max);
-
179 }
-
180 case Mapping::LINEAR:
-
181 default: return fclamp(min + in * (max - min), min, max);
-
182 }
-
183}
+
+
157enum class Mapping
+
158{
+
159 LINEAR,
+
160 EXP,
+
161 LOG,
+
162};
-
184
-
188template <typename T>
-
-
189T median(T a, T b, T c)
-
190{
-
191 return (b < a) ? (b < c) ? (c < a) ? c : a : b
-
192 : (a < c) ? (c < b) ? c : b : a;
-
193}
+
163
+
176inline float
+
+
177fmap(float in, float min, float max, Mapping curve = Mapping::LINEAR)
+
178{
+
179 switch(curve)
+
180 {
+
181 case Mapping::EXP:
+
182 return fclamp(min + (in * in) * (max - min), min, max);
+
183 case Mapping::LOG:
+
184 {
+
185 const float a = 1.f / log10f(max / min);
+
186 return fclamp(min * powf(10, in / a), min, max);
+
187 }
+
188 case Mapping::LINEAR:
+
189 default: return fclamp(min + in * (max - min), min, max);
+
190 }
+
191}
-
194
+
192
+
196template <typename T>
-
197inline float ThisBlepSample(float t)
+
197T median(T a, T b, T c)
198{
-
199 return 0.5f * t * t;
-
200}
+
199 return (b < a) ? (b < c) ? (c < a) ? c : a : b
+
200 : (a < c) ? (c < b) ? c : b : a;
+
201}
-
201
-
-
204inline float NextBlepSample(float t)
-
205{
-
206 t = 1.0f - t;
-
207 return -0.5f * t * t;
+
202
+
+
205inline float ThisBlepSample(float t)
+
206{
+
207 return 0.5f * t * t;
208}
209
-
212inline float NextIntegratedBlepSample(float t)
+
212inline float NextBlepSample(float t)
213{
-
214 const float t1 = 0.5f * t;
-
215 const float t2 = t1 * t1;
-
216 const float t4 = t2 * t2;
-
217 return 0.1875f - t1 + 1.5f * t2 - t4;
-
218}
+
214 t = 1.0f - t;
+
215 return -0.5f * t * t;
+
216}
+
+
217
+
+
220inline float NextIntegratedBlepSample(float t)
+
221{
+
222 const float t1 = 0.5f * t;
+
223 const float t2 = t1 * t1;
+
224 const float t4 = t2 * t2;
+
225 return 0.1875f - t1 + 1.5f * t2 - t4;
+
226}
-
219
-
-
222inline float ThisIntegratedBlepSample(float t)
-
223{
-
224 return NextIntegratedBlepSample(1.0f - t);
-
225}
+
227
+
+
230inline float ThisIntegratedBlepSample(float t)
+
231{
+
232 return NextIntegratedBlepSample(1.0f - t);
+
233}
-
226
-
-
228inline float SoftLimit(float x)
-
229{
-
230 return x * (27.f + x * x) / (27.f + 9.f * x * x);
-
231}
+
234
+
+
236inline float SoftLimit(float x)
+
237{
+
238 return x * (27.f + x * x) / (27.f + 9.f * x * x);
+
239}
-
232
-
-
234inline float SoftClip(float x)
-
235{
-
236 if(x < -3.0f)
-
237 return -1.0f;
-
238 else if(x > 3.0f)
-
239 return 1.0f;
-
240 else
-
241 return SoftLimit(x);
-
242}
+
240
+
+
242inline float SoftClip(float x)
+
243{
+
244 if(x < -3.0f)
+
245 return -1.0f;
+
246 else if(x > 3.0f)
+
247 return 1.0f;
+
248 else
+
249 return SoftLimit(x);
+
250}
-
243
-
-
250inline void TestFloat(float &x, float y = 0.f)
-
251{
-
252 if(!std::isnormal(x) && x != 0)
-
253 {
-
254#if defined(__arm__) && defined(DEBUG)
-
255 asm("bkpt 255");
-
256#else
-
257 x = y;
-
258#endif
-
259 }
-
260}
+
251
+
+
258inline void TestFloat(float &x, float y = 0.f)
+
259{
+
260 if(!std::isnormal(x) && x != 0)
+
261 {
+
262#if defined(__arm__) && defined(DEBUG)
+
263 asm("bkpt 255");
+
264#else
+
265 x = y;
+
266#endif
+
267 }
+
268}
-
261
-
-
274inline float soft_saturate(float in, float thresh)
-
275{
-
276 bool flip;
-
277 float val, out;
-
278 //val = fabsf(in);
-
279 out = 0.f;
-
280 flip = in < 0.0f;
-
281 val = flip ? -in : in;
-
282 if(val < thresh)
-
283 {
-
284 out = in;
-
285 }
-
286 else if(val > 1.0f)
-
287 {
-
288 out = (thresh + 1.0f) / 2.0f;
-
289 if(flip)
-
290 out *= -1.0f;
-
291 }
-
292 else if(val > thresh)
-
293 {
-
294 float temp;
-
295 temp = (val - thresh) / (1 - thresh);
-
296 out = thresh + (val - thresh) / (1.0f + (temp * temp));
+
269
+
+
282inline float soft_saturate(float in, float thresh)
+
283{
+
284 bool flip;
+
285 float val, out;
+
286 //val = fabsf(in);
+
287 out = 0.f;
+
288 flip = in < 0.0f;
+
289 val = flip ? -in : in;
+
290 if(val < thresh)
+
291 {
+
292 out = in;
+
293 }
+
294 else if(val > 1.0f)
+
295 {
+
296 out = (thresh + 1.0f) / 2.0f;
297 if(flip)
298 out *= -1.0f;
299 }
-
300 return out;
-
301 // return val < thresh
-
302 // ? val
-
303 // : val > 1.0f
-
304 // ? (thresh + 1.0f) / 2.0f
-
305 // : thresh
-
306 // + (val - thresh)
-
307 // / (1.0f
-
308 // + (((val - thresh) / (1.0f - thresh))
-
309 // * ((val - thresh) / (1.0f - thresh))));
-
310}
+
300 else if(val > thresh)
+
301 {
+
302 float temp;
+
303 temp = (val - thresh) / (1 - thresh);
+
304 out = thresh + (val - thresh) / (1.0f + (temp * temp));
+
305 if(flip)
+
306 out *= -1.0f;
+
307 }
+
308 return out;
+
309 // return val < thresh
+
310 // ? val
+
311 // : val > 1.0f
+
312 // ? (thresh + 1.0f) / 2.0f
+
313 // : thresh
+
314 // + (val - thresh)
+
315 // / (1.0f
+
316 // + (((val - thresh) / (1.0f - thresh))
+
317 // * ((val - thresh) / (1.0f - thresh))));
+
318}
-
311constexpr bool is_power2(uint32_t x)
-
312{
-
313 return ((x - 1) & x) == 0;
-
314}
-
315
-
321#if __cplusplus <= 201103L
-
- -
323#else
- -
325#endif
-
326{
-
327 x--;
-
328 x |= x >> 1;
-
329 x |= x >> 2;
-
330 x |= x >> 4;
-
331 x |= x >> 8;
-
332 x |= x >> 16;
-
333 x++;
-
334
-
335 assert(is_power2(x));
-
336 return x;
-
337}
+
319constexpr bool is_power2(uint32_t x)
+
320{
+
321 return ((x - 1) & x) == 0;
+
322}
+
323
+
329#if __cplusplus <= 201103L
+
+ +
331#else
+ +
333#endif
+
334{
+
335 x--;
+
336 x |= x >> 1;
+
337 x |= x >> 2;
+
338 x |= x >> 4;
+
339 x |= x >> 8;
+
340 x |= x >> 16;
+
341 x++;
+
342
+
343 assert(is_power2(x));
+
344 return x;
+
345}
-
338
-
339} // namespace daisysp
-
340#endif
-
341
-
342#ifdef DSY_CUSTOM_DSP
-
343#include "custom_dsp.h"
-
344#endif
-
Definition delayline.h:21
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
uint32_t get_next_power2(uint32_t x)
Definition dsp.h:322
-
float fastpower(float f, int n)
Definition dsp.h:65
-
Mapping
Definition dsp.h:150
-
float mtof(float m)
Definition dsp.h:131
-
float ThisBlepSample(float t)
Definition dsp.h:197
-
float fastmod1f(float x)
Definition dsp.h:92
-
float pow10f(float f)
Definition dsp.h:100
-
T median(T a, T b, T c)
Definition dsp.h:189
-
float fclamp(float in, float min, float max)
Definition dsp.h:56
-
float NextIntegratedBlepSample(float t)
Definition dsp.h:212
-
float soft_saturate(float in, float thresh)
Definition dsp.h:274
-
float fmax(float a, float b)
Definition dsp.h:32
-
float SoftLimit(float x)
Definition dsp.h:228
-
float NextBlepSample(float t)
Definition dsp.h:204
-
float fmap(float in, float min, float max, Mapping curve=Mapping::LINEAR)
Definition dsp.h:169
-
void TestFloat(float &x, float y=0.f)
Definition dsp.h:250
-
float ThisIntegratedBlepSample(float t)
Definition dsp.h:222
-
float SoftClip(float x)
Definition dsp.h:234
-
void fonepole(float &out, float in, float coeff)
Definition dsp.h:143
+
346
+
347} // namespace daisysp
+
348#endif
+
349
+
350#ifdef DSY_CUSTOM_DSP
+
351#include "custom_dsp.h"
+
352#endif
+
Definition delayline.h:29
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
uint32_t get_next_power2(uint32_t x)
Definition dsp.h:330
+
float fastpower(float f, int n)
Definition dsp.h:73
+
Mapping
Definition dsp.h:158
+
float mtof(float m)
Definition dsp.h:139
+
float ThisBlepSample(float t)
Definition dsp.h:205
+
float fastmod1f(float x)
Definition dsp.h:100
+
float pow10f(float f)
Definition dsp.h:108
+
T median(T a, T b, T c)
Definition dsp.h:197
+
float fclamp(float in, float min, float max)
Definition dsp.h:64
+
float NextIntegratedBlepSample(float t)
Definition dsp.h:220
+
float soft_saturate(float in, float thresh)
Definition dsp.h:282
+
float fmax(float a, float b)
Definition dsp.h:40
+
float SoftLimit(float x)
Definition dsp.h:236
+
float NextBlepSample(float t)
Definition dsp.h:212
+
float fmap(float in, float min, float max, Mapping curve=Mapping::LINEAR)
Definition dsp.h:177
+
void TestFloat(float &x, float y=0.f)
Definition dsp.h:258
+
float ThisIntegratedBlepSample(float t)
Definition dsp.h:230
+
float SoftClip(float x)
Definition dsp.h:242
+
void fonepole(float &out, float in, float coeff)
Definition dsp.h:151
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_DUST_H
-
3#define DSY_DUST_H
-
4#include <cstdlib>
-
5#include <random>
-
6#include "Utility/dsp.h"
-
7#ifdef __cplusplus
+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
-
11namespace daisysp
-
12{
-
-
23class Dust
-
24{
-
25 public:
-
26 Dust() {}
-
27 ~Dust() {}
-
28
-
29 void Init() { SetDensity(.5f); }
-
30
-
31 float Process()
-
32 {
-
33 float inv_density = 1.0f / density_;
-
34 float u = rand() * kRandFrac;
-
35 if(u < density_)
-
36 {
-
37 return u * inv_density;
-
38 }
-
39 return 0.0f;
-
40 }
-
41
-
42 void SetDensity(float density)
-
43 {
-
44 density_ = fclamp(density, 0.f, 1.f);
-
45 density_ = density_ * .3f;
-
46 }
-
47
-
48 private:
-
49 float density_;
-
50 static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
-
51};
+
9#pragma once
+
10#ifndef DSY_DUST_H
+
11#define DSY_DUST_H
+
12#include <cstdlib>
+
13#include <random>
+
14#include "Utility/dsp.h"
+
15#ifdef __cplusplus
+
16
+
19namespace daisysp
+
20{
+
+
31class Dust
+
32{
+
33 public:
+
34 Dust() {}
+
35 ~Dust() {}
+
36
+
37 void Init() { SetDensity(.5f); }
+
38
+
39 float Process()
+
40 {
+
41 float inv_density = 1.0f / density_;
+
42 float u = rand() * kRandFrac;
+
43 if(u < density_)
+
44 {
+
45 return u * inv_density;
+
46 }
+
47 return 0.0f;
+
48 }
+
49
+
50 void SetDensity(float density)
+
51 {
+
52 density_ = fclamp(density, 0.f, 1.f);
+
53 density_ = density_ * .3f;
+
54 }
+
55
+
56 private:
+
57 float density_;
+
58 static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
+
59};
-
52} // namespace daisysp
-
53#endif
-
54#endif
-
Definition delayline.h:21
-
Dust Module.
Definition dust.h:24
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
float fclamp(float in, float min, float max)
Definition dsp.h:56
+
60} // namespace daisysp
+
61#endif
+
62#endif
+
Definition delayline.h:29
+
Dust Module.
Definition dust.h:32
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
float fclamp(float in, float min, float max)
Definition dsp.h:64
diff --git a/fir_8h_source.html b/fir_8h_source.html index 216ddf06..5c5e23e1 100644 --- a/fir_8h_source.html +++ b/fir_8h_source.html @@ -83,316 +83,324 @@
fir.h
-
1#pragma once
-
2#ifndef DSY_FIRFILTER_H
-
3#define DSY_FIRFILTER_H
-
4
-
5#include <cstdint>
-
6#include <cstring> // for memset
-
7#include <cassert>
-
8#include <utility>
-
9
-
10#ifdef USE_ARM_DSP
-
11#include <arm_math.h> // required for platform-optimized version
-
12#endif
-
13
-
19namespace daisysp
-
20{
-
21/* use this as a template parameter to indicate user-provided memory storage */
-
22#define FIRFILTER_USER_MEMORY 0, 0
-
23
-
32template <size_t max_size, size_t max_block>
-
- -
34{
-
35 /* Public part of the API to be passed through to the FIR users */
-
36 public:
-
37 /* Reset the internal filter state (but not the coefficients) */
-
38 void Reset() { memset(state_, 0, state_size_ * sizeof(state_[0])); }
-
39
-
40
-
41 protected:
-
42 FIRMemory() : state_{0}, coefs_{0}, size_(0) {}
-
43
-
44 /* Expression for the maximum block size */
-
45 static constexpr size_t MaxBlock() { return max_block; }
-
46
-
-
53 bool SetCoefs(const float coefs[], size_t size, bool reverse)
-
54 {
-
55 /* truncate silently */
-
56 size_ = DSY_MIN(size, max_size);
-
57
-
58 if(reverse)
-
59 {
-
60 /* reverse the IR */
-
61 for(size_t i = 0; i < size_; i++)
-
62 {
-
63 /* start from size, not size_! */
-
64 coefs_[i] = coefs[size - 1u - i];
-
65 }
-
66 }
-
67 else
-
68 {
-
69 /* just copy as is */
-
70 memcpy(coefs_, coefs, size_ * sizeof(coefs[0]));
-
71 }
-
72
-
73 return true;
-
74 }
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Alexander Petrov-Savchenko
+
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_FIRFILTER_H
+
11#define DSY_FIRFILTER_H
+
12
+
13#include <cstdint>
+
14#include <cstring> // for memset
+
15#include <cassert>
+
16#include <utility>
+
17
+
18#ifdef USE_ARM_DSP
+
19#include <arm_math.h> // required for platform-optimized version
+
20#endif
+
21
+
27namespace daisysp
+
28{
+
29/* use this as a template parameter to indicate user-provided memory storage */
+
30#define FIRFILTER_USER_MEMORY 0, 0
+
31
+
40template <size_t max_size, size_t max_block>
+
+ +
42{
+
43 /* Public part of the API to be passed through to the FIR users */
+
44 public:
+
45 /* Reset the internal filter state (but not the coefficients) */
+
46 void Reset() { memset(state_, 0, state_size_ * sizeof(state_[0])); }
+
47
+
48
+
49 protected:
+
50 FIRMemory() : state_{0}, coefs_{0}, size_(0) {}
+
51
+
52 /* Expression for the maximum block size */
+
53 static constexpr size_t MaxBlock() { return max_block; }
+
54
+
+
61 bool SetCoefs(const float coefs[], size_t size, bool reverse)
+
62 {
+
63 /* truncate silently */
+
64 size_ = DSY_MIN(size, max_size);
+
65
+
66 if(reverse)
+
67 {
+
68 /* reverse the IR */
+
69 for(size_t i = 0; i < size_; i++)
+
70 {
+
71 /* start from size, not size_! */
+
72 coefs_[i] = coefs[size - 1u - i];
+
73 }
+
74 }
+
75 else
+
76 {
+
77 /* just copy as is */
+
78 memcpy(coefs_, coefs, size_ * sizeof(coefs[0]));
+
79 }
+
80
+
81 return true;
+
82 }
-
75
-
76 static constexpr size_t state_size_ = max_size + max_block - 1u;
-
77 float state_[state_size_]; /*< Internal state buffer */
-
78 float coefs_[max_size]; /*< Filter coefficients */
-
79 size_t size_; /*< Active filter length (<= max_size) */
-
80};
+
83
+
84 static constexpr size_t state_size_ = max_size + max_block - 1u;
+
85 float state_[state_size_]; /*< Internal state buffer */
+
86 float coefs_[max_size]; /*< Filter coefficients */
+
87 size_t size_; /*< Active filter length (<= max_size) */
+
88};
-
81
-
82/* Specialization for user-provided memory */
-
83template <>
-
-
84struct FIRMemory<FIRFILTER_USER_MEMORY>
-
85{
-
86 /* Public part of the API to be passed through to the FIRFilter user */
-
87 public:
-
-
94 void SetStateBuffer(float state[], size_t length)
-
95 {
-
96 state_ = state;
-
97 state_size_ = length;
-
98 }
+
89
+
90/* Specialization for user-provided memory */
+
91template <>
+
+
92struct FIRMemory<FIRFILTER_USER_MEMORY>
+
93{
+
94 /* Public part of the API to be passed through to the FIRFilter user */
+
95 public:
+
+
102 void SetStateBuffer(float state[], size_t length)
+
103 {
+
104 state_ = state;
+
105 state_size_ = length;
+
106 }
-
99 /* Reset the internal filter state (but not the coefficients) */
-
100 void Reset()
-
101 {
-
102 assert(nullptr != state_);
-
103 assert(0 != state_size_);
-
104 if(nullptr != state_)
-
105 {
-
106 memset(state_, 0, state_size_ * sizeof(state_[0]));
-
107 }
-
108 }
-
109
-
110 protected:
-
111 FIRMemory() : state_(nullptr), coefs_(nullptr), size_(0), state_size_(0) {}
-
112
-
113 /* Expression for the maximum processing block size currently supported */
-
114 size_t MaxBlock() const
-
115 {
-
116 return state_size_ + 1u > size_ ? state_size_ + 1u - size_ : 0;
-
117 }
-
118
-
-
125 bool SetCoefs(const float coefs[], size_t size, bool reverse)
-
126 {
-
127 /* reversing of external IR is not supported*/
-
128 assert(false == reverse);
-
129 assert(nullptr != coefs || 0 == size);
-
130
-
131 if(false == reverse && (nullptr != coefs || 0 == size))
-
132 {
-
133 coefs_ = coefs;
-
134 size_ = size;
-
135 return true;
-
136 }
-
137
-
138 return false;
-
139 }
-
-
140
-
141 /* Internal member variables */
-
142
-
143 float* state_; /*< Internal state buffer */
-
144 const float* coefs_; /*< Filter coefficients */
-
145 size_t size_; /*< number of filter coefficients */
-
146 size_t state_size_; /*< length of the state buffer */
-
147};
+
107 /* Reset the internal filter state (but not the coefficients) */
+
108 void Reset()
+
109 {
+
110 assert(nullptr != state_);
+
111 assert(0 != state_size_);
+
112 if(nullptr != state_)
+
113 {
+
114 memset(state_, 0, state_size_ * sizeof(state_[0]));
+
115 }
+
116 }
+
117
+
118 protected:
+
119 FIRMemory() : state_(nullptr), coefs_(nullptr), size_(0), state_size_(0) {}
+
120
+
121 /* Expression for the maximum processing block size currently supported */
+
122 size_t MaxBlock() const
+
123 {
+
124 return state_size_ + 1u > size_ ? state_size_ + 1u - size_ : 0;
+
125 }
+
126
+
+
133 bool SetCoefs(const float coefs[], size_t size, bool reverse)
+
134 {
+
135 /* reversing of external IR is not supported*/
+
136 assert(false == reverse);
+
137 assert(nullptr != coefs || 0 == size);
+
138
+
139 if(false == reverse && (nullptr != coefs || 0 == size))
+
140 {
+
141 coefs_ = coefs;
+
142 size_ = size;
+
143 return true;
+
144 }
+
145
+
146 return false;
+
147 }
148
-
149
-
158template <size_t max_size, size_t max_block>
-
-
159class FIRFilterImplGeneric : public FIRMemory<max_size, max_block>
-
160{
-
161 private:
-
162 using FIRMem = FIRMemory<max_size, max_block>; // just a shorthand
-
163
-
164 public:
-
165 /* Default constructor */
- -
167
-
168 /* Reset filter state (but not the coefficients) */
-
169 using FIRMem::Reset;
-
170
-
171 /* FIR Latency is always 0, but API is unified with FFT and fast convolution */
-
172 static constexpr size_t GetLatency() { return 0; }
-
173
-
174 /* Process one sample at a time */
-
-
175 float Process(float in)
-
176 {
-
177 assert(size_ > 0u);
-
178 /* Feed data into the buffer */
-
179 state_[size_ - 1u] = in;
-
180
-
181 /* Convolution loop */
-
182 float acc(0);
-
183 for(size_t i = 0; i < size_ - 1; i++)
-
184 {
-
185 acc += state_[i] * coefs_[i];
-
189 state_[i] = state_[1 + i];
-
190 }
-
191 acc += in * coefs_[size_ - 1u];
-
192
-
193 return acc;
-
194 }
+
149 /* Internal member variables */
+
150
+
151 float* state_; /*< Internal state buffer */
+
152 const float* coefs_; /*< Filter coefficients */
+
153 size_t size_; /*< number of filter coefficients */
+
154 size_t state_size_; /*< length of the state buffer */
+
155};
-
195
-
196 /* Process a block of data */
-
197 void ProcessBlock(const float* pSrc, float* pDst, size_t block)
-
198 {
-
199 /* be sure to run debug version from time to time */
-
200 assert(block <= FIRMem::MaxBlock());
-
201 assert(size_ > 0u);
-
202 assert(nullptr != pSrc);
-
203 assert(nullptr != pDst);
-
204
-
205 /* Process the block of data */
-
206 for(size_t j = 0; j < block; j++)
-
207 {
-
208 /* Feed data into the buffer */
-
209 state_[size_ - 1u + j] = pSrc[j];
-
210
-
211 /* Convolution loop */
-
212 float acc = 0.0f;
-
213 for(size_t i = 0; i < size_; i++)
-
214 {
-
215 acc += state_[j + i] * coefs_[i];
-
216 }
-
217
-
218 /* Write output */
-
219 pDst[j] = acc;
-
220 }
-
221
-
222 /* Copy data tail for the next block */
-
223 for(size_t i = 0; i < size_ - 1u; i++)
-
224 {
-
225 state_[i] = state_[block + i];
-
226 }
-
227 }
-
228
-
-
234 bool SetIR(const float* ir, size_t len, bool reverse)
-
235 {
-
236 /* Function order is important */
-
237 const bool result = FIRMem::SetCoefs(ir, len, reverse);
-
238 Reset();
-
239 return result;
-
240 }
+
156
+
157
+
166template <size_t max_size, size_t max_block>
+
+
167class FIRFilterImplGeneric : public FIRMemory<max_size, max_block>
+
168{
+
169 private:
+
170 using FIRMem = FIRMemory<max_size, max_block>; // just a shorthand
+
171
+
172 public:
+
173 /* Default constructor */
+ +
175
+
176 /* Reset filter state (but not the coefficients) */
+
177 using FIRMem::Reset;
+
178
+
179 /* FIR Latency is always 0, but API is unified with FFT and fast convolution */
+
180 static constexpr size_t GetLatency() { return 0; }
+
181
+
182 /* Process one sample at a time */
+
+
183 float Process(float in)
+
184 {
+
185 assert(size_ > 0u);
+
186 /* Feed data into the buffer */
+
187 state_[size_ - 1u] = in;
+
188
+
189 /* Convolution loop */
+
190 float acc(0);
+
191 for(size_t i = 0; i < size_ - 1; i++)
+
192 {
+
193 acc += state_[i] * coefs_[i];
+
197 state_[i] = state_[1 + i];
+
198 }
+
199 acc += in * coefs_[size_ - 1u];
+
200
+
201 return acc;
+
202 }
-
241
-
242 /* Create an alias to comply with DaisySP API conventions */
-
243 template <typename... Args>
-
244 inline auto Init(Args&&... args)
-
245 -> decltype(SetIR(std::forward<Args>(args)...))
-
246 {
-
247 return SetIR(std::forward<Args>(args)...);
+
203
+
204 /* Process a block of data */
+
205 void ProcessBlock(const float* pSrc, float* pDst, size_t block)
+
206 {
+
207 /* be sure to run debug version from time to time */
+
208 assert(block <= FIRMem::MaxBlock());
+
209 assert(size_ > 0u);
+
210 assert(nullptr != pSrc);
+
211 assert(nullptr != pDst);
+
212
+
213 /* Process the block of data */
+
214 for(size_t j = 0; j < block; j++)
+
215 {
+
216 /* Feed data into the buffer */
+
217 state_[size_ - 1u + j] = pSrc[j];
+
218
+
219 /* Convolution loop */
+
220 float acc = 0.0f;
+
221 for(size_t i = 0; i < size_; i++)
+
222 {
+
223 acc += state_[j + i] * coefs_[i];
+
224 }
+
225
+
226 /* Write output */
+
227 pDst[j] = acc;
+
228 }
+
229
+
230 /* Copy data tail for the next block */
+
231 for(size_t i = 0; i < size_ - 1u; i++)
+
232 {
+
233 state_[i] = state_[block + i];
+
234 }
+
235 }
+
236
+
+
242 bool SetIR(const float* ir, size_t len, bool reverse)
+
243 {
+
244 /* Function order is important */
+
245 const bool result = FIRMem::SetCoefs(ir, len, reverse);
+
246 Reset();
+
247 return result;
248 }
-
249
-
250
-
251 protected:
-
252 using FIRMem::coefs_; /*< FIR coefficients buffer or pointer */
-
253 using FIRMem::size_; /*< FIR length */
-
254 using FIRMem::state_; /*< FIR state buffer or pointer */
-
255};
-
256
+
249
+
250 /* Create an alias to comply with DaisySP API conventions */
+
251 template <typename... Args>
+
252 inline auto Init(Args&&... args)
+
253 -> decltype(SetIR(std::forward<Args>(args)...))
+
254 {
+
255 return SetIR(std::forward<Args>(args)...);
+
256 }
257
-
258#if(defined(USE_ARM_DSP) && defined(__arm__))
-
259
-
267template <size_t max_size, size_t max_block>
-
268class FIRFilterImplARM : public FIRMemory<max_size, max_block>
-
269{
-
270 private:
-
271 using FIRMem = FIRMemory<max_size, max_block>; // just a shorthand
-
272
-
273 public:
-
274 /* Default constructor */
-
275 FIRFilterImplARM() : fir_{0} {}
-
276
-
277 /* Reset filter state (but not the coefficients) */
-
278 using FIRMem::Reset;
-
279
-
280 /* FIR Latency is always 0, but API is unified with FFT and FastConv */
-
281 static constexpr size_t GetLatency() { return 0; }
-
282
-
283 /* Process one sample at a time */
-
284 float Process(float in)
-
285 {
-
286 float out(0);
-
287 arm_fir_f32(&fir_, &in, &out, 1);
-
288 return out;
-
289 }
+
258
+
259 protected:
+
260 using FIRMem::coefs_; /*< FIR coefficients buffer or pointer */
+
261 using FIRMem::size_; /*< FIR length */
+
262 using FIRMem::state_; /*< FIR state buffer or pointer */
+
263};
+
+
264
+
265
+
266#if(defined(USE_ARM_DSP) && defined(__arm__))
+
267
+
275template <size_t max_size, size_t max_block>
+
276class FIRFilterImplARM : public FIRMemory<max_size, max_block>
+
277{
+
278 private:
+
279 using FIRMem = FIRMemory<max_size, max_block>; // just a shorthand
+
280
+
281 public:
+
282 /* Default constructor */
+
283 FIRFilterImplARM() : fir_{0} {}
+
284
+
285 /* Reset filter state (but not the coefficients) */
+
286 using FIRMem::Reset;
+
287
+
288 /* FIR Latency is always 0, but API is unified with FFT and FastConv */
+
289 static constexpr size_t GetLatency() { return 0; }
290
-
291 /* Process a block of data */
-
292 void ProcessBlock(float* pSrc, float* pDst, size_t block)
+
291 /* Process one sample at a time */
+
292 float Process(float in)
293 {
-
294 assert(block <= FIRMem::MaxBlock());
-
295 arm_fir_f32(&fir_, pSrc, pDst, block);
-
296 }
-
297
-
303 bool SetIR(const float* ir, size_t len, bool reverse)
-
304 {
-
305 /* Function order is important */
-
306 const bool result = FIRMem::SetCoefs(ir, len, reverse);
-
307 arm_fir_init_f32(&fir_, len, (float*)coefs_, state_, max_block);
-
308 return result;
-
309 }
-
310
-
311 /* Create an alias to comply with DaisySP API conventions */
-
312 template <typename... Args>
-
313 inline auto Init(Args&&... args)
-
314 -> decltype(SetIR(std::forward<Args>(args)...))
-
315 {
-
316 return SetIR(std::forward<Args>(args)...);
+
294 float out(0);
+
295 arm_fir_f32(&fir_, &in, &out, 1);
+
296 return out;
+
297 }
+
298
+
299 /* Process a block of data */
+
300 void ProcessBlock(float* pSrc, float* pDst, size_t block)
+
301 {
+
302 assert(block <= FIRMem::MaxBlock());
+
303 arm_fir_f32(&fir_, pSrc, pDst, block);
+
304 }
+
305
+
311 bool SetIR(const float* ir, size_t len, bool reverse)
+
312 {
+
313 /* Function order is important */
+
314 const bool result = FIRMem::SetCoefs(ir, len, reverse);
+
315 arm_fir_init_f32(&fir_, len, (float*)coefs_, state_, max_block);
+
316 return result;
317 }
318
-
319 protected:
-
320 arm_fir_instance_f32 fir_; /*< ARM CMSIS DSP library FIR filter instance */
-
321 using FIRMem::coefs_; /*< FIR coefficients buffer or pointer */
-
322 using FIRMem::size_; /*< FIR length*/
-
323 using FIRMem::state_; /*< FIR state buffer or pointer */
-
324};
-
325
+
319 /* Create an alias to comply with DaisySP API conventions */
+
320 template <typename... Args>
+
321 inline auto Init(Args&&... args)
+
322 -> decltype(SetIR(std::forward<Args>(args)...))
+
323 {
+
324 return SetIR(std::forward<Args>(args)...);
+
325 }
326
-
327/* default to ARM implementation */
-
328template <size_t max_size, size_t max_block>
-
329using FIR = FIRFilterImplARM<max_size, max_block>;
-
330
-
331
-
332#else // USE_ARM_DSP
+
327 protected:
+
328 arm_fir_instance_f32 fir_; /*< ARM CMSIS DSP library FIR filter instance */
+
329 using FIRMem::coefs_; /*< FIR coefficients buffer or pointer */
+
330 using FIRMem::size_; /*< FIR length*/
+
331 using FIRMem::state_; /*< FIR state buffer or pointer */
+
332};
333
-
334/* default to generic implementation */
-
335template <size_t max_size, size_t max_block>
-
336using FIR = FIRFilterImplGeneric<max_size, max_block>;
-
337
-
338#endif // USE_ARM_DSP
+
334
+
335/* default to ARM implementation */
+
336template <size_t max_size, size_t max_block>
+
337using FIR = FIRFilterImplARM<max_size, max_block>;
+
338
339
-
340
-
341} // namespace daisysp
-
342
-
343#endif // DSY_FIRFILTER_H
-
Definition delayline.h:21
-
void Init()
Definition delayline.h:27
-
Definition fir.h:160
-
bool SetIR(const float *ir, size_t len, bool reverse)
Definition fir.h:234
-
float Process(float in)
Definition fir.h:175
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
bool SetCoefs(const float coefs[], size_t size, bool reverse)
Definition fir.h:125
-
void SetStateBuffer(float state[], size_t length)
Definition fir.h:94
-
Definition fir.h:34
-
bool SetCoefs(const float coefs[], size_t size, bool reverse)
Definition fir.h:53
+
340#else // USE_ARM_DSP
+
341
+
342/* default to generic implementation */
+
343template <size_t max_size, size_t max_block>
+
344using FIR = FIRFilterImplGeneric<max_size, max_block>;
+
345
+
346#endif // USE_ARM_DSP
+
347
+
348
+
349} // namespace daisysp
+
350
+
351#endif // DSY_FIRFILTER_H
+
Definition delayline.h:29
+
void Init()
Definition delayline.h:35
+
Definition fir.h:168
+
bool SetIR(const float *ir, size_t len, bool reverse)
Definition fir.h:242
+
float Process(float in)
Definition fir.h:183
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
bool SetCoefs(const float coefs[], size_t size, bool reverse)
Definition fir.h:133
+
void SetStateBuffer(float state[], size_t length)
Definition fir.h:102
+
Definition fir.h:42
+
bool SetCoefs(const float coefs[], size_t size, bool reverse)
Definition fir.h:61
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_FLANGER_H
-
3#define DSY_FLANGER_H
-
4#ifdef __cplusplus
-
5
-
6#include <stdint.h>
-
7#include "Utility/delayline.h"
+Go to the documentation of this file.
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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
-
11namespace daisysp
-
12{
-
- -
19{
-
20 public:
-
24 void Init(float sample_rate);
-
25
-
29 float Process(float in);
-
30
-
34 void SetFeedback(float feedback);
-
35
-
39 void SetLfoDepth(float depth);
-
40
-
44 void SetLfoFreq(float freq);
-
45
-
49 void SetDelay(float delay);
-
50
-
54 void SetDelayMs(float ms);
-
55
-
56 private:
-
57 float sample_rate_;
-
58 static constexpr int32_t kDelayLength = 960; // 20 ms at 48kHz = .02 * 48000
-
59
-
60 float feedback_;
-
61
-
62 //triangle lfos
-
63 float lfo_phase_;
-
64 float lfo_freq_;
-
65 float lfo_amp_;
-
66
-
67 float delay_;
-
68
- -
70
-
71 float ProcessLfo();
-
72};
+
9#pragma once
+
10#ifndef DSY_FLANGER_H
+
11#define DSY_FLANGER_H
+
12#ifdef __cplusplus
+
13
+
14#include <stdint.h>
+
15#include "Utility/delayline.h"
+
16
+
19namespace daisysp
+
20{
+
+ +
27{
+
28 public:
+
32 void Init(float sample_rate);
+
33
+
37 float Process(float in);
+
38
+
42 void SetFeedback(float feedback);
+
43
+
47 void SetLfoDepth(float depth);
+
48
+
52 void SetLfoFreq(float freq);
+
53
+
57 void SetDelay(float delay);
+
58
+
62 void SetDelayMs(float ms);
+
63
+
64 private:
+
65 float sample_rate_;
+
66 static constexpr int32_t kDelayLength = 960; // 20 ms at 48kHz = .02 * 48000
+
67
+
68 float feedback_;
+
69
+
70 //triangle lfos
+
71 float lfo_phase_;
+
72 float lfo_freq_;
+
73 float lfo_amp_;
+
74
+
75 float delay_;
+
76
+ +
78
+
79 float ProcessLfo();
+
80};
-
73} //namespace daisysp
-
74#endif
-
75#endif
-
Definition delayline.h:21
-
Flanging Audio Effect.
Definition flanger.h:19
+
81} //namespace daisysp
+
82#endif
+
83#endif
+
Definition delayline.h:29
+
Flanging Audio Effect.
Definition flanger.h:27
float Process(float in)
Definition flanger.cpp:22
void Init(float sample_rate)
Definition flanger.cpp:7
void SetDelayMs(float ms)
Definition flanger.cpp:58
@@ -141,7 +149,7 @@
void SetDelay(float delay)
Definition flanger.cpp:52
void SetLfoFreq(float freq)
Definition flanger.cpp:45
void SetFeedback(float feedback)
Definition flanger.cpp:33
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_FM2_H
-
3#define DSY_FM2_H
-
4
-
5#include <stdint.h>
-
6#include "Synthesis/oscillator.h"
-
7#ifdef __cplusplus
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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
-
9namespace daisysp
-
10{
-
-
18class Fm2
-
19{
-
20 public:
-
21 Fm2() {}
-
22 ~Fm2() {}
-
23
-
27 void Init(float samplerate);
-
28
-
29
-
32 float Process();
-
33
-
37 void SetFrequency(float freq);
-
38
-
42 void SetRatio(float ratio);
-
43
-
47 void SetIndex(float index);
-
48
-
50 float GetIndex();
+
9#pragma once
+
10#ifndef DSY_FM2_H
+
11#define DSY_FM2_H
+
12
+
13#include <stdint.h>
+
14#include "Synthesis/oscillator.h"
+
15#ifdef __cplusplus
+
16
+
17namespace daisysp
+
18{
+
+
26class Fm2
+
27{
+
28 public:
+
29 Fm2() {}
+
30 ~Fm2() {}
+
31
+
35 void Init(float samplerate);
+
36
+
37
+
40 float Process();
+
41
+
45 void SetFrequency(float freq);
+
46
+
50 void SetRatio(float ratio);
51
-
53 void Reset();
-
54
-
55 private:
-
56 static constexpr float kIdxScalar = 0.2f;
-
57 static constexpr float kIdxScalarRecip = 1.f / kIdxScalar;
-
58
-
59 Oscillator mod_, car_;
-
60 float idx_;
-
61 float freq_, lfreq_, ratio_, lratio_;
-
62};
+
55 void SetIndex(float index);
+
56
+
58 float GetIndex();
+
59
+
61 void Reset();
+
62
+
63 private:
+
64 static constexpr float kIdxScalar = 0.2f;
+
65 static constexpr float kIdxScalarRecip = 1.f / kIdxScalar;
+
66
+
67 Oscillator mod_, car_;
+
68 float idx_;
+
69 float freq_, lfreq_, ratio_, lratio_;
+
70};
-
63} // namespace daisysp
-
64#endif
-
65#endif
-
Definition delayline.h:21
-
Definition fm2.h:19
+
71} // namespace daisysp
+
72#endif
+
73#endif
+
Definition delayline.h:29
+
Definition fm2.h:27
float Process()
Definition fm2.cpp:26
float GetIndex()
Definition fm2.cpp:56
void Init(float samplerate)
Definition fm2.cpp:5
@@ -136,8 +144,8 @@
void SetIndex(float index)
Definition fm2.cpp:51
void SetRatio(float ratio)
Definition fm2.cpp:46
void SetFrequency(float freq)
Definition fm2.cpp:41
-
Definition oscillator.h:13
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
Definition oscillator.h:21
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_FORMANTOSCILLATOR_H
-
3#define DSY_FORMANTOSCILLATOR_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
- -
22{
-
23 public:
- - -
26
-
30 void Init(float sample_rate);
-
31
-
34 float Process();
-
35
-
39 void SetFormantFreq(float freq);
-
40
-
44 void SetCarrierFreq(float freq);
-
45
-
49 void SetPhaseShift(float ps);
-
50
-
51 private:
-
52 inline float Sine(float phase);
-
53 inline float ThisBlepSample(float t);
-
54 inline float NextBlepSample(float t);
-
55
-
56 // Oscillator state.
-
57 float carrier_phase_;
-
58 float formant_phase_;
-
59 float next_sample_;
-
60
-
61 // For interpolation of parameters.
-
62 float carrier_frequency_;
-
63 float formant_frequency_;
-
64 float phase_shift_;
-
65 float ps_inc_;
-
66
-
67 float sample_rate_;
+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_FORMANTOSCILLATOR_H
+
11#define DSY_FORMANTOSCILLATOR_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
+ +
30{
+
31 public:
+ + +
34
+
38 void Init(float sample_rate);
+
39
+
42 float Process();
+
43
+
47 void SetFormantFreq(float freq);
+
48
+
52 void SetCarrierFreq(float freq);
+
53
+
57 void SetPhaseShift(float ps);
+
58
+
59 private:
+
60 inline float Sine(float phase);
+
61 inline float ThisBlepSample(float t);
+
62 inline float NextBlepSample(float t);
+
63
+
64 // Oscillator state.
+
65 float carrier_phase_;
+
66 float formant_phase_;
+
67 float next_sample_;
68
-
69 //DISALLOW_COPY_AND_ASSIGN(FormantOscillator);
-
70};
+
69 // For interpolation of parameters.
+
70 float carrier_frequency_;
+
71 float formant_frequency_;
+
72 float phase_shift_;
+
73 float ps_inc_;
+
74
+
75 float sample_rate_;
+
76
+
77 //DISALLOW_COPY_AND_ASSIGN(FormantOscillator);
+
78};
-
71} //namespace daisysp
-
72#endif
-
73#endif
-
Definition delayline.h:21
-
Formant Oscillator Module.
Definition formantosc.h:22
+
79} //namespace daisysp
+
80#endif
+
81#endif
+
Definition delayline.h:29
+
Formant Oscillator Module.
Definition formantosc.h:30
void SetCarrierFreq(float freq)
Definition formantosc.cpp:68
void SetFormantFreq(float freq)
Definition formantosc.cpp:59
float Process()
Definition formantosc.cpp:20
void SetPhaseShift(float ps)
Definition formantosc.cpp:77
void Init(float sample_rate)
Definition formantosc.cpp:7
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_FRACTAL_H
-
3#define DSY_FRACTAL_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
23template <typename T, int order>
-
- -
25{
-
26 public:
- - -
29
-
-
33 void Init(float sample_rate)
-
34 {
-
35 sample_rate_ = sample_rate;
-
36
-
37 SetColor(.5f);
-
38 SetFreq(440.f);
-
39 for(int i = 0; i < order; ++i)
-
40 {
-
41 generator_[i].Init(sample_rate_);
-
42 }
-
43 }
-
+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_FRACTAL_H
+
11#define DSY_FRACTAL_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
31template <typename T, int order>
+
+ +
33{
+
34 public:
+ + +
37
+
+
41 void Init(float sample_rate)
+
42 {
+
43 sample_rate_ = sample_rate;
44
-
-
46 float Process()
-
47 {
-
48 float gain = 0.5f;
-
49 float sum = 0.0f;
-
50 float frequency = frequency_;
-
51
-
52 for(int i = 0; i < order; ++i)
-
53 {
-
54 generator_[i].SetFreq(frequency);
-
55 sum += generator_[i].Process() * gain;
-
56 gain *= decay_;
-
57 frequency *= 2.0f;
-
58 }
-
59
-
60 return sum;
-
61 }
+
45 SetColor(.5f);
+
46 SetFreq(440.f);
+
47 for(int i = 0; i < order; ++i)
+
48 {
+
49 generator_[i].Init(sample_rate_);
+
50 }
+
51 }
-
62
-
66 void SetFreq(float freq) { frequency_ = fclamp(freq, 0.f, sample_rate_); }
+
52
+
+
54 float Process()
+
55 {
+
56 float gain = 0.5f;
+
57 float sum = 0.0f;
+
58 float frequency = frequency_;
+
59
+
60 for(int i = 0; i < order; ++i)
+
61 {
+
62 generator_[i].SetFreq(frequency);
+
63 sum += generator_[i].Process() * gain;
+
64 gain *= decay_;
+
65 frequency *= 2.0f;
+
66 }
67
-
71 void SetColor(float color) { decay_ = fclamp(color, 0.f, 1.f); }
-
72
-
73 private:
-
74 float sample_rate_;
-
75 float frequency_;
-
76 float decay_;
-
77
-
78 T generator_[order];
-
79};
+
68 return sum;
+
69 }
+
+
70
+
74 void SetFreq(float freq) { frequency_ = fclamp(freq, 0.f, sample_rate_); }
+
75
+
79 void SetColor(float color) { decay_ = fclamp(color, 0.f, 1.f); }
+
80
+
81 private:
+
82 float sample_rate_;
+
83 float frequency_;
+
84 float decay_;
+
85
+
86 T generator_[order];
+
87};
-
80} // namespace daisysp
-
81#endif
-
82#endif
-
Definition delayline.h:21
-
Fractal Noise, stacks octaves of a noise source.
Definition fractal_noise.h:25
-
float Process()
Definition fractal_noise.h:46
-
void SetFreq(float freq)
Definition fractal_noise.h:66
-
void SetColor(float color)
Definition fractal_noise.h:71
-
void Init(float sample_rate)
Definition fractal_noise.h:33
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
float fclamp(float in, float min, float max)
Definition dsp.h:56
+
88} // namespace daisysp
+
89#endif
+
90#endif
+
Definition delayline.h:29
+
Fractal Noise, stacks octaves of a noise source.
Definition fractal_noise.h:33
+
float Process()
Definition fractal_noise.h:54
+
void SetFreq(float freq)
Definition fractal_noise.h:74
+
void SetColor(float color)
Definition fractal_noise.h:79
+
void Init(float sample_rate)
Definition fractal_noise.h:41
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
float fclamp(float in, float min, float max)
Definition dsp.h:64
diff --git a/functions_d.html b/functions_d.html index 921152e8..98cea472 100644 --- a/functions_d.html +++ b/functions_d.html @@ -75,7 +75,6 @@

- d -

diff --git a/functions_enum.html b/functions_enum.html index 8f6691be..5d602526 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -72,8 +72,8 @@
Here is a list of all documented enums with links to the class documentation for each member:
diff --git a/functions_f.html b/functions_f.html index 058f7342..84a0c562 100644 --- a/functions_f.html +++ b/functions_f.html @@ -74,7 +74,7 @@
Here is a list of all documented class members with links to the class documentation for each member:

- f -

diff --git a/functions_func.html b/functions_func.html index 0dfdb8b0..66c6f1d6 100644 --- a/functions_func.html +++ b/functions_func.html @@ -73,9 +73,10 @@
Here is a list of all documented functions with links to the class documentation for each member:
-

- a -

diff --git a/functions_func_b.html b/functions_func_b.html deleted file mode 100644 index 66c6f1d6..00000000 --- a/functions_func_b.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - -DaisySP: Class Members - Functions - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented functions with links to the class documentation for each member:
- -

- b -

-
- - - - diff --git a/functions_func_c.html b/functions_func_c.html index b1d3001a..1bd73067 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -74,7 +74,7 @@
Here is a list of all documented functions with links to the class documentation for each member:

- c -

diff --git a/functions_func_g.html b/functions_func_g.html index f1312117..237cdeb6 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -74,30 +74,20 @@
Here is a list of all documented functions with links to the class documentation for each member:

- g -

diff --git a/functions_func_i.html b/functions_func_i.html index 9c0e6fb0..8ad1c906 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -75,7 +75,7 @@

- i -

diff --git a/functions_func_r.html b/functions_func_r.html index 7c003b08..602279b5 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -76,7 +76,7 @@

- r -

diff --git a/functions_func_s.html b/functions_func_s.html index 0d3cfeda..a0a508ec 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -74,33 +74,21 @@
Here is a list of all documented functions with links to the class documentation for each member:

- s -

diff --git a/functions_g.html b/functions_g.html index e3d49ad3..89991217 100644 --- a/functions_g.html +++ b/functions_g.html @@ -74,30 +74,20 @@
Here is a list of all documented class members with links to the class documentation for each member:

- g -

diff --git a/functions_i.html b/functions_i.html index 7cb082fc..11c31289 100644 --- a/functions_i.html +++ b/functions_i.html @@ -75,7 +75,7 @@

- i -

diff --git a/functions_r.html b/functions_r.html index 2432fcf7..c960aa90 100644 --- a/functions_r.html +++ b/functions_r.html @@ -74,13 +74,9 @@
Here is a list of all documented class members with links to the class documentation for each member:

- r -

diff --git a/functions_s.html b/functions_s.html index 225bd979..41d8f163 100644 --- a/functions_s.html +++ b/functions_s.html @@ -74,34 +74,21 @@
Here is a list of all documented class members with links to the class documentation for each member:

- s -

diff --git a/functions_vars.html b/functions_vars.html deleted file mode 100644 index e2fa797a..00000000 --- a/functions_vars.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - -DaisySP: Class Members - Variables - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - -
- -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- -
-
Here is a list of all documented variables with links to the class documentation for each member:
-
- - - - diff --git a/functions_w.html b/functions_w.html index e7feaefa..6b75a5ce 100644 --- a/functions_w.html +++ b/functions_w.html @@ -74,9 +74,7 @@
Here is a list of all documented class members with links to the class documentation for each member:

- w -

diff --git a/grainlet_8h_source.html b/grainlet_8h_source.html index 03fc7bc3..64364e46 100644 --- a/grainlet_8h_source.html +++ b/grainlet_8h_source.html @@ -83,73 +83,81 @@
grainlet.h
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_GRAINLET_H
-
3#define DSY_GRAINLET_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
9namespace daisysp
-
10{
-
- -
23{
-
24 public:
- - -
27
-
31 void Init(float sample_rate);
-
32
-
34 float Process();
+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_GRAINLET_H
+
11#define DSY_GRAINLET_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
17namespace daisysp
+
18{
+
+ +
31{
+
32 public:
+ +
35
-
39 void SetFreq(float freq);
+
39 void Init(float sample_rate);
40
-
44 void SetFormantFreq(float freq);
-
45
-
49 void SetShape(float shape);
-
50
-
54 void SetBleed(float bleed);
-
55
-
56 private:
-
57 float Sine(float phase);
+
42 float Process();
+
43
+
47 void SetFreq(float freq);
+
48
+
52 void SetFormantFreq(float freq);
+
53
+
57 void SetShape(float shape);
58
-
59 float Carrier(float phase, float shape);
-
60
-
61 float Grainlet(float carrier_phase,
-
62 float formant_phase,
-
63 float shape,
-
64 float bleed);
-
65
-
66 // Oscillator state.
-
67 float carrier_phase_;
-
68 float formant_phase_;
-
69 float next_sample_;
-
70
-
71 // For interpolation of parameters.
-
72 float carrier_frequency_;
-
73 float formant_frequency_;
-
74 float carrier_shape_;
-
75 float carrier_bleed_;
-
76
-
77 float new_carrier_shape_;
-
78 float new_carrier_bleed_;
-
79
-
80 float sample_rate_;
-
81};
+
62 void SetBleed(float bleed);
+
63
+
64 private:
+
65 float Sine(float phase);
+
66
+
67 float Carrier(float phase, float shape);
+
68
+
69 float Grainlet(float carrier_phase,
+
70 float formant_phase,
+
71 float shape,
+
72 float bleed);
+
73
+
74 // Oscillator state.
+
75 float carrier_phase_;
+
76 float formant_phase_;
+
77 float next_sample_;
+
78
+
79 // For interpolation of parameters.
+
80 float carrier_frequency_;
+
81 float formant_frequency_;
+
82 float carrier_shape_;
+
83 float carrier_bleed_;
+
84
+
85 float new_carrier_shape_;
+
86 float new_carrier_bleed_;
+
87
+
88 float sample_rate_;
+
89};
-
82} // namespace daisysp
-
83#endif
-
84#endif
-
Definition delayline.h:21
-
Granular Oscillator Module.
Definition grainlet.h:23
+
90} // namespace daisysp
+
91#endif
+
92#endif
+
Definition delayline.h:29
+
Granular Oscillator Module.
Definition grainlet.h:31
void Init(float sample_rate)
Definition grainlet.cpp:7
void SetShape(float shape)
Definition grainlet.cpp:82
void SetBleed(float bleed)
Definition grainlet.cpp:87
void SetFreq(float freq)
Definition grainlet.cpp:70
void SetFormantFreq(float freq)
Definition grainlet.cpp:76
float Process()
Definition grainlet.cpp:24
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_GRANULARPLAYER_H
-
3#define DSY_GRANULARPLAYER_H
-
4
-
5#include <stdint.h>
-
6#include <cmath>
-
7#include "Control/phasor.h"
-
8#ifdef __cplusplus
-
9#ifndef M_PI
-
10#define M_PI 3.14159265358979323846 /* pi */
-
11#endif
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Vinícius Fernandes
+
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_GRANULARPLAYER_H
+
11#define DSY_GRANULARPLAYER_H
12
-
13namespace daisysp
-
14{
-
- -
27{
-
28 public:
- - -
31
-
37 void Init(float* sample, int size, float sample_rate);
-
38
-
44 float Process(float speed, float transposition, float grain_size);
-
45
-
46 private:
-
47 //Wraps an index to the size of the sample array
- -
49
-
50 //Converts cents(1/100th of a semitone) to a ratio
-
51 float CentsToRatio(float cents);
-
52
-
53 //Converts milliseconds to number of samples
-
54 float MsToSamps(float ms, float samplerate);
-
55
-
56 //Inverts the phase of the phasor if the frequency is negative, mimicking pure data's phasor~ object
-
57 float NegativeInvert(Phasor* phs, float frequency);
-
58
-
59
-
60 float* sample_; //pointer to the sample to be played
-
61 float sample_rate_; //audio engine sample rate
-
62 int size_; //number of elements in the sample array
-
63 float grain_size_; //grain size in milliseconds
-
64 float speed_; //processed playback speed.
-
65 float transposition_; //processed transpotion.
-
66 float sample_frequency_;
-
67 float cosEnv_[256] = {0}; //cosine envelope for crossfading between grains
-
68 float
-
69 idxTransp_; // Adjusted Transposition value contribution to idx of first grain
-
70 float
-
71 idxTransp2_; // Adjusted Transposition value contribution to idx of second grain
-
72 float idxSpeed_; // Adjusted Speed value contribution to idx of first grain
-
73 float
-
74 idxSpeed2_; // Adjusted Speed value contribution to idx of second grain
-
75 float sig_; // Output of first grain
-
76 float sig2_; // Output of second grain
-
77
-
78 uint32_t idx_; // Index of first grain
-
79 uint32_t idx2_; // Index of second grain
-
80
-
81 Phasor phs_; // Phasor for speed
-
82 Phasor phsImp_; // Phasor for transposition
-
83 Phasor phs2_; // Phasor for speed
-
84 Phasor phsImp2_; // Phasor for transposition
-
85};
+
13#include <stdint.h>
+
14#include <cmath>
+
15#include "Control/phasor.h"
+
16#ifdef __cplusplus
+
17#ifndef M_PI
+
18#define M_PI 3.14159265358979323846 /* pi */
+
19#endif
+
20
+
21namespace daisysp
+
22{
+
+ +
35{
+
36 public:
+ + +
39
+
45 void Init(float* sample, int size, float sample_rate);
+
46
+
52 float Process(float speed, float transposition, float grain_size);
+
53
+
54 private:
+
55 //Wraps an index to the size of the sample array
+ +
57
+
58 //Converts cents(1/100th of a semitone) to a ratio
+
59 float CentsToRatio(float cents);
+
60
+
61 //Converts milliseconds to number of samples
+
62 float MsToSamps(float ms, float samplerate);
+
63
+
64 //Inverts the phase of the phasor if the frequency is negative, mimicking pure data's phasor~ object
+
65 float NegativeInvert(Phasor* phs, float frequency);
+
66
+
67
+
68 float* sample_; //pointer to the sample to be played
+
69 float sample_rate_; //audio engine sample rate
+
70 int size_; //number of elements in the sample array
+
71 float grain_size_; //grain size in milliseconds
+
72 float speed_; //processed playback speed.
+
73 float transposition_; //processed transpotion.
+
74 float sample_frequency_;
+
75 float cosEnv_[256] = {0}; //cosine envelope for crossfading between grains
+
76 float
+
77 idxTransp_; // Adjusted Transposition value contribution to idx of first grain
+
78 float
+
79 idxTransp2_; // Adjusted Transposition value contribution to idx of second grain
+
80 float idxSpeed_; // Adjusted Speed value contribution to idx of first grain
+
81 float
+
82 idxSpeed2_; // Adjusted Speed value contribution to idx of second grain
+
83 float sig_; // Output of first grain
+
84 float sig2_; // Output of second grain
+
85
+
86 uint32_t idx_; // Index of first grain
+
87 uint32_t idx2_; // Index of second grain
+
88
+
89 Phasor phs_; // Phasor for speed
+
90 Phasor phsImp_; // Phasor for transposition
+
91 Phasor phs2_; // Phasor for speed
+
92 Phasor phsImp2_; // Phasor for transposition
+
93};
-
86} // namespace daisysp
-
87#endif
-
88#endif
-
Definition delayline.h:21
-
Definition granularplayer.h:27
+
94} // namespace daisysp
+
95#endif
+
96#endif
+
Definition delayline.h:29
+
Definition granularplayer.h:35
void Init(float *sample, int size, float sample_rate)
Definition granularplayer.cpp:5
float Process(float speed, float transposition, float grain_size)
Definition granularplayer.cpp:56
-
Definition phasor.h:15
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
Definition phasor.h:23
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_HARMONIC_H
-
3#define DSY_HARMONIC_H
-
4
-
5#include <stdint.h>
-
6#include "Utility/dsp.h"
-
7#ifdef __cplusplus
+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
-
11namespace daisysp
-
12{
-
24template <int num_harmonics = 16>
-
- -
26{
-
27 public:
- - -
30
-
-
34 void Init(float sample_rate)
-
35 {
-
36 sample_rate_ = sample_rate;
-
37 phase_ = 0.0f;
+
9#pragma once
+
10#ifndef DSY_HARMONIC_H
+
11#define DSY_HARMONIC_H
+
12
+
13#include <stdint.h>
+
14#include "Utility/dsp.h"
+
15#ifdef __cplusplus
+
16
+
17
+
19namespace daisysp
+
20{
+
32template <int num_harmonics = 16>
+
+ +
34{
+
35 public:
+ +
38
-
39 for(int i = 0; i < num_harmonics; ++i)
-
40 {
-
41 amplitude_[i] = 0.0f;
-
42 newamplitude_[i] = 0.f;
-
43 }
-
44 amplitude_[0] = 1.f;
-
45 newamplitude_[0] = 1.f;
+
+
42 void Init(float sample_rate)
+
43 {
+
44 sample_rate_ = sample_rate;
+
45 phase_ = 0.0f;
46
- -
48 SetFreq(440.f);
-
49
-
50 recalc_ = false;
-
51 }
+
47 for(int i = 0; i < num_harmonics; ++i)
+
48 {
+
49 amplitude_[i] = 0.0f;
+
50 newamplitude_[i] = 0.f;
+
51 }
+
52 amplitude_[0] = 1.f;
+
53 newamplitude_[0] = 1.f;
+
54
+ +
56 SetFreq(440.f);
+
57
+
58 recalc_ = false;
+
59 }
-
52
-
-
54 float Process()
-
55 {
-
56 if(recalc_)
-
57 {
-
58 recalc_ = false;
-
59 for(int i = 0; i < num_harmonics; ++i)
-
60 {
-
61 float f = frequency_
-
62 * static_cast<float>(first_harmonic_index_ + i);
-
63 if(f >= 0.5f)
-
64 {
-
65 f = 0.5f;
-
66 }
-
67 amplitude_[i] = newamplitude_[i] * (1.0f - f * 2.0f);
-
68 }
-
69 }
-
70
-
71 phase_ += frequency_;
-
72 if(phase_ >= 1.0f)
-
73 {
-
74 phase_ -= 1.0f;
-
75 }
-
76 const float two_x = 2.0f * sinf(phase_ * TWOPI_F);
-
77 float previous, current;
-
78 if(first_harmonic_index_ == 1)
-
79 {
-
80 previous = 1.0f;
-
81 current = two_x * 0.5f;
-
82 }
-
83 else
-
84 {
-
85 const float k = first_harmonic_index_;
-
86 previous = sinf((phase_ * (k - 1.0f) + 0.25f) * TWOPI_F);
-
87 current = sinf((phase_ * k) * TWOPI_F);
-
88 }
-
89
-
90 float sum = 0.0f;
-
91 for(int i = 0; i < num_harmonics; ++i)
+
60
+
+
62 float Process()
+
63 {
+
64 if(recalc_)
+
65 {
+
66 recalc_ = false;
+
67 for(int i = 0; i < num_harmonics; ++i)
+
68 {
+
69 float f = frequency_
+
70 * static_cast<float>(first_harmonic_index_ + i);
+
71 if(f >= 0.5f)
+
72 {
+
73 f = 0.5f;
+
74 }
+
75 amplitude_[i] = newamplitude_[i] * (1.0f - f * 2.0f);
+
76 }
+
77 }
+
78
+
79 phase_ += frequency_;
+
80 if(phase_ >= 1.0f)
+
81 {
+
82 phase_ -= 1.0f;
+
83 }
+
84 const float two_x = 2.0f * sinf(phase_ * TWOPI_F);
+
85 float previous, current;
+
86 if(first_harmonic_index_ == 1)
+
87 {
+
88 previous = 1.0f;
+
89 current = two_x * 0.5f;
+
90 }
+
91 else
92 {
-
93 sum += amplitude_[i] * current;
-
94 float temp = current;
- -
96 previous = temp;
-
97 }
-
98
-
99 return sum;
-
100 }
+
93 const float k = first_harmonic_index_;
+
94 previous = sinf((phase_ * (k - 1.0f) + 0.25f) * TWOPI_F);
+
95 current = sinf((phase_ * k) * TWOPI_F);
+
96 }
+
97
+
98 float sum = 0.0f;
+
99 for(int i = 0; i < num_harmonics; ++i)
+
100 {
+
101 sum += amplitude_[i] * current;
+
102 float temp = current;
+ +
104 previous = temp;
+
105 }
+
106
+
107 return sum;
+
108 }
-
101
-
-
105 void SetFreq(float freq)
-
106 {
-
107 //convert from Hz to phase_inc / sample
-
108 freq = freq / sample_rate_;
-
109 freq = freq >= .5f ? .5f : freq;
-
110 freq = freq <= -.5f ? -.5f : freq;
-
111 recalc_ = cmp(freq, frequency_) || recalc_;
-
112 frequency_ = freq;
-
113 }
+
109
+
+
113 void SetFreq(float freq)
+
114 {
+
115 //convert from Hz to phase_inc / sample
+
116 freq = freq / sample_rate_;
+
117 freq = freq >= .5f ? .5f : freq;
+
118 freq = freq <= -.5f ? -.5f : freq;
+
119 recalc_ = cmp(freq, frequency_) || recalc_;
+
120 frequency_ = freq;
+
121 }
-
114
-
- -
119 {
-
120 idx = idx < 1 ? 1 : idx;
-
121 recalc_ = cmp(idx, first_harmonic_index_) || recalc_;
-
122 first_harmonic_index_ = idx;
-
123 }
+
122
+
+ +
127 {
+
128 idx = idx < 1 ? 1 : idx;
+
129 recalc_ = cmp(idx, first_harmonic_index_) || recalc_;
+
130 first_harmonic_index_ = idx;
+
131 }
-
124
-
-
128 void SetAmplitudes(const float* amplitudes)
-
129 {
-
130 for(int i = 0; i < num_harmonics; i++)
-
131 {
-
132 recalc_ = cmp(newamplitude_[i], amplitudes[i]) || recalc_;
-
133 newamplitude_[i] = amplitudes[i];
-
134 }
-
135 }
+
132
+
+
136 void SetAmplitudes(const float* amplitudes)
+
137 {
+
138 for(int i = 0; i < num_harmonics; i++)
+
139 {
+
140 recalc_ = cmp(newamplitude_[i], amplitudes[i]) || recalc_;
+
141 newamplitude_[i] = amplitudes[i];
+
142 }
+
143 }
-
136
-
-
141 void SetSingleAmp(const float amp, int idx)
-
142 {
- -
144 {
-
145 return;
-
146 }
-
147 recalc_ = cmp(amplitude_[idx], amp) || recalc_;
-
148 newamplitude_[idx] = amp;
-
149 }
+
144
+
+
149 void SetSingleAmp(const float amp, int idx)
+
150 {
+ +
152 {
+
153 return;
+
154 }
+
155 recalc_ = cmp(amplitude_[idx], amp) || recalc_;
+
156 newamplitude_[idx] = amp;
+
157 }
-
150
-
151
-
152 private:
-
153 bool cmp(float a, float b) { return fabsf(a - b) > .000001f; }
-
154
-
155 float sample_rate_;
-
156 float phase_;
-
157 float frequency_;
-
158 float amplitude_[num_harmonics];
-
159 float newamplitude_[num_harmonics];
-
160 bool recalc_;
-
161
-
162 int first_harmonic_index_;
-
163};
+
158
+
159
+
160 private:
+
161 bool cmp(float a, float b) { return fabsf(a - b) > .000001f; }
+
162
+
163 float sample_rate_;
+
164 float phase_;
+
165 float frequency_;
+
166 float amplitude_[num_harmonics];
+
167 float newamplitude_[num_harmonics];
+
168 bool recalc_;
+
169
+
170 int first_harmonic_index_;
+
171};
-
164} // namespace daisysp
-
165#endif
-
166#endif
-
Definition delayline.h:21
-
Harmonic Oscillator Module based on Chebyshev polynomials.
Definition harmonic_osc.h:26
-
float Process()
Definition harmonic_osc.h:54
-
void Init(float sample_rate)
Definition harmonic_osc.h:34
-
void SetFreq(float freq)
Definition harmonic_osc.h:105
-
void SetAmplitudes(const float *amplitudes)
Definition harmonic_osc.h:128
-
void SetFirstHarmIdx(int idx)
Definition harmonic_osc.h:118
-
void SetSingleAmp(const float amp, int idx)
Definition harmonic_osc.h:141
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
172} // namespace daisysp
+
173#endif
+
174#endif
+
Definition delayline.h:29
+
Harmonic Oscillator Module based on Chebyshev polynomials.
Definition harmonic_osc.h:34
+
float Process()
Definition harmonic_osc.h:62
+
void Init(float sample_rate)
Definition harmonic_osc.h:42
+
void SetFreq(float freq)
Definition harmonic_osc.h:113
+
void SetAmplitudes(const float *amplitudes)
Definition harmonic_osc.h:136
+
void SetFirstHarmIdx(int idx)
Definition harmonic_osc.h:126
+
void SetSingleAmp(const float amp, int idx)
Definition harmonic_osc.h:149
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
diff --git a/hihat_8h_source.html b/hihat_8h_source.html index 09181fe2..6a734b40 100644 --- a/hihat_8h_source.html +++ b/hihat_8h_source.html @@ -83,250 +83,258 @@
hihat.h
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_HIHAT_H
-
3#define DSY_HIHAT_H
-
4
-
5#include "Filters/svf.h"
-
6#include "Synthesis/oscillator.h"
-
7
-
8#include <stdint.h>
-
9#include <stdlib.h>
-
10#ifdef __cplusplus
-
11
-
14namespace daisysp
-
15{
-
- -
25{
-
26 public:
-
27 SquareNoise() {}
-
28 ~SquareNoise() {}
-
29
-
30 void Init(float sample_rate);
-
31
-
32 float Process(float f0);
-
33
-
34 private:
-
35 uint32_t phase_[6];
-
36};
-
+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_HIHAT_H
+
11#define DSY_HIHAT_H
+
12
+
13#include "Filters/svf.h"
+
14#include "Synthesis/oscillator.h"
+
15
+
16#include <stdint.h>
+
17#include <stdlib.h>
+
18#ifdef __cplusplus
+
19
+
22namespace daisysp
+
23{
+
+ +
33{
+
34 public:
+
35 SquareNoise() {}
+
36 ~SquareNoise() {}
37
-
- -
47{
-
48 public:
-
49 RingModNoise() {}
-
50 ~RingModNoise() {}
-
51
-
52 void Init(float sample_rate);
-
53
-
54 float Process(float f0);
-
55
-
56 private:
-
57 float ProcessPair(Oscillator* osc, float f1, float f2);
-
58 Oscillator oscillator_[6];
+
38 void Init(float sample_rate);
+
39
+
40 float Process(float f0);
+
41
+
42 private:
+
43 uint32_t phase_[6];
+
44};
+
+
45
+
+ +
55{
+
56 public:
+
57 RingModNoise() {}
+
58 ~RingModNoise() {}
59
-
60 float sample_rate_;
-
61};
+
60 void Init(float sample_rate);
+
61
+
62 float Process(float f0);
+
63
+
64 private:
+
65 float ProcessPair(Oscillator* osc, float f1, float f2);
+
66 Oscillator oscillator_[6];
+
67
+
68 float sample_rate_;
+
69};
-
62
-
- -
72{
-
73 public:
-
74 float operator()(float s, float gain)
-
75 {
-
76 s *= s > 0.0f ? 10.0f : 0.1f;
-
77 s = s / (1.0f + fabsf(s));
-
78 return (s + 1.0f) * gain;
-
79 }
-
80};
+
70
+
+ +
80{
+
81 public:
+
82 float operator()(float s, float gain)
+
83 {
+
84 s *= s > 0.0f ? 10.0f : 0.1f;
+
85 s = s / (1.0f + fabsf(s));
+
86 return (s + 1.0f) * gain;
+
87 }
+
88};
-
81
-
- -
91{
-
92 public:
-
93 float operator()(float s, float gain) { return s * gain; }
-
94};
+
89
+
+ +
99{
+
100 public:
+
101 float operator()(float s, float gain) { return s * gain; }
+
102};
-
95
-
106template <typename MetallicNoiseSource = SquareNoise,
-
107 typename VCA = LinearVCA,
-
108 bool resonance = true>
-
-
109class HiHat
-
110{
-
111 public:
-
112 HiHat() {}
-
113 ~HiHat() {}
-
114
-
-
118 void Init(float sample_rate)
-
119 {
-
120 sample_rate_ = sample_rate;
-
121
-
122 trig_ = false;
-
123
-
124 envelope_ = 0.0f;
-
125 noise_clock_ = 0.0f;
-
126 noise_sample_ = 0.0f;
-
127 sustain_gain_ = 0.0f;
-
128
-
129 SetFreq(3000.f);
-
130 SetTone(.5f);
-
131 SetDecay(.2f);
-
132 SetNoisiness(.8f);
-
133 SetAccent(.8f);
-
134 SetSustain(false);
-
135
-
136 metallic_noise_.Init(sample_rate_);
-
137 noise_coloration_svf_.Init(sample_rate_);
-
138 hpf_.Init(sample_rate_);
-
139 }
+
103
+
114template <typename MetallicNoiseSource = SquareNoise,
+
115 typename VCA = LinearVCA,
+
116 bool resonance = true>
+
+
117class HiHat
+
118{
+
119 public:
+
120 HiHat() {}
+
121 ~HiHat() {}
+
122
+
+
126 void Init(float sample_rate)
+
127 {
+
128 sample_rate_ = sample_rate;
+
129
+
130 trig_ = false;
+
131
+
132 envelope_ = 0.0f;
+
133 noise_clock_ = 0.0f;
+
134 noise_sample_ = 0.0f;
+
135 sustain_gain_ = 0.0f;
+
136
+
137 SetFreq(3000.f);
+
138 SetTone(.5f);
+
139 SetDecay(.2f);
+
140 SetNoisiness(.8f);
+
141 SetAccent(.8f);
+
142 SetSustain(false);
+
143
+
144 metallic_noise_.Init(sample_rate_);
+
145 noise_coloration_svf_.Init(sample_rate_);
+
146 hpf_.Init(sample_rate_);
+
147 }
-
140
-
-
144 float Process(bool trigger = false)
-
145 {
-
146 const float envelope_decay
-
147 = 1.0f - 0.003f * SemitonesToRatio(-decay_ * 84.0f);
-
148 const float cut_decay
-
149 = 1.0f - 0.0025f * SemitonesToRatio(-decay_ * 36.0f);
-
150
-
151 if(trigger || trig_)
-
152 {
-
153 trig_ = false;
-
154
-
155 envelope_
-
156 = (1.5f + 0.5f * (1.0f - decay_)) * (0.3f + 0.7f * accent_);
-
157 }
+
148
+
+
152 float Process(bool trigger = false)
+
153 {
+
154 const float envelope_decay
+
155 = 1.0f - 0.003f * SemitonesToRatio(-decay_ * 84.0f);
+
156 const float cut_decay
+
157 = 1.0f - 0.0025f * SemitonesToRatio(-decay_ * 36.0f);
158
-
159 // Process the metallic noise.
-
160 float out = metallic_noise_.Process(2.0f * f0_);
-
161
-
162 // Apply BPF on the metallic noise.
-
163 float cutoff = 150.0f / sample_rate_ * SemitonesToRatio(tone_ * 72.0f);
-
164
-
165 cutoff = fclamp(cutoff, 0.0f, 16000.0f / sample_rate_);
+
159 if(trigger || trig_)
+
160 {
+
161 trig_ = false;
+
162
+
163 envelope_
+
164 = (1.5f + 0.5f * (1.0f - decay_)) * (0.3f + 0.7f * accent_);
+
165 }
166
-
167
-
168 noise_coloration_svf_.SetFreq(cutoff * sample_rate_);
-
169 noise_coloration_svf_.SetRes(resonance ? 3.0f + 6.0f * tone_ : 1.0f);
-
170
-
171 noise_coloration_svf_.Process(out);
-
172 out = noise_coloration_svf_.Band();
-
173
-
174 // This is not at all part of the 808 circuit! But to add more variety, we
-
175 // add a variable amount of clocked noise to the output of the 6 schmitt
-
176 // trigger oscillators.
-
177 float noise_f = f0_ * (16.0f + 16.0f * (1.0f - noisiness_));
-
178 noise_f = fclamp(noise_f, 0.0f, 0.5f);
-
179
-
180 noise_clock_ += noise_f;
-
181 if(noise_clock_ >= 1.0f)
-
182 {
-
183 noise_clock_ -= 1.0f;
-
184 noise_sample_ = rand() * kRandFrac - 0.5f;
-
185 }
-
186 out += noisiness_ * (noise_sample_ - out);
+
167 // Process the metallic noise.
+
168 float out = metallic_noise_.Process(2.0f * f0_);
+
169
+
170 // Apply BPF on the metallic noise.
+
171 float cutoff = 150.0f / sample_rate_ * SemitonesToRatio(tone_ * 72.0f);
+
172
+
173 cutoff = fclamp(cutoff, 0.0f, 16000.0f / sample_rate_);
+
174
+
175
+
176 noise_coloration_svf_.SetFreq(cutoff * sample_rate_);
+
177 noise_coloration_svf_.SetRes(resonance ? 3.0f + 6.0f * tone_ : 1.0f);
+
178
+
179 noise_coloration_svf_.Process(out);
+
180 out = noise_coloration_svf_.Band();
+
181
+
182 // This is not at all part of the 808 circuit! But to add more variety, we
+
183 // add a variable amount of clocked noise to the output of the 6 schmitt
+
184 // trigger oscillators.
+
185 float noise_f = f0_ * (16.0f + 16.0f * (1.0f - noisiness_));
+
186 noise_f = fclamp(noise_f, 0.0f, 0.5f);
187
-
188 // Apply VCA.
-
189 sustain_gain_ = accent_ * decay_;
-
190 VCA vca;
-
191 envelope_ *= envelope_ > 0.5f ? envelope_decay : cut_decay;
-
192 out = vca(out, sustain_ ? sustain_gain_ : envelope_);
-
193
-
194 hpf_.SetFreq(cutoff * sample_rate_);
-
195 hpf_.SetRes(.5f);
-
196 hpf_.Process(out);
-
197 out = hpf_.High();
-
198
-
199 return out;
-
200 }
-
+
188 noise_clock_ += noise_f;
+
189 if(noise_clock_ >= 1.0f)
+
190 {
+
191 noise_clock_ -= 1.0f;
+
192 noise_sample_ = rand() * kRandFrac - 0.5f;
+
193 }
+
194 out += noisiness_ * (noise_sample_ - out);
+
195
+
196 // Apply VCA.
+
197 sustain_gain_ = accent_ * decay_;
+
198 VCA vca;
+
199 envelope_ *= envelope_ > 0.5f ? envelope_decay : cut_decay;
+
200 out = vca(out, sustain_ ? sustain_gain_ : envelope_);
201
-
203 void Trig() { trig_ = true; }
-
204
-
208 void SetSustain(bool sustain) { sustain_ = sustain; }
+
202 hpf_.SetFreq(cutoff * sample_rate_);
+
203 hpf_.SetRes(.5f);
+
204 hpf_.Process(out);
+
205 out = hpf_.High();
+
206
+
207 return out;
+
208 }
+
209
-
213 void SetAccent(float accent) { accent_ = fclamp(accent, 0.f, 1.f); }
-
214
-
-
218 void SetFreq(float f0)
-
219 {
-
220 f0 /= sample_rate_;
-
221 f0_ = fclamp(f0, 0.f, 1.f);
-
222 }
+
211 void Trig() { trig_ = true; }
+
212
+
216 void SetSustain(bool sustain) { sustain_ = sustain; }
+
217
+
221 void SetAccent(float accent) { accent_ = fclamp(accent, 0.f, 1.f); }
+
222
+
+
226 void SetFreq(float f0)
+
227 {
+
228 f0 /= sample_rate_;
+
229 f0_ = fclamp(f0, 0.f, 1.f);
+
230 }
-
223
-
227 void SetTone(float tone) { tone_ = fclamp(tone, 0.f, 1.f); }
-
228
-
-
232 void SetDecay(float decay)
-
233 {
-
234 decay_ = fmax(decay, 0.f);
-
235 decay_ *= 1.7;
-
236 decay_ -= 1.2;
-
237 }
+
231
+
235 void SetTone(float tone) { tone_ = fclamp(tone, 0.f, 1.f); }
+
236
+
+
240 void SetDecay(float decay)
+
241 {
+
242 decay_ = fmax(decay, 0.f);
+
243 decay_ *= 1.7;
+
244 decay_ -= 1.2;
+
245 }
-
238
-
-
242 void SetNoisiness(float noisiness)
-
243 {
-
244 noisiness_ = fclamp(noisiness, 0.f, 1.f);
-
245 noisiness_ *= noisiness_;
-
246 }
+
246
+
+
250 void SetNoisiness(float noisiness)
+
251 {
+
252 noisiness_ = fclamp(noisiness, 0.f, 1.f);
+
253 noisiness_ *= noisiness_;
+
254 }
-
247
-
248
-
249 private:
-
250 float sample_rate_;
-
251
-
252 float accent_, f0_, tone_, decay_, noisiness_;
-
253 bool sustain_;
-
254 bool trig_;
255
-
256 float SemitonesToRatio(float in) { return powf(2.f, in * kOneTwelfth); }
-
257
-
258 float envelope_;
-
259 float noise_clock_;
-
260 float noise_sample_;
-
261 float sustain_gain_;
-
262
-
263 MetallicNoiseSource metallic_noise_;
-
264 Svf noise_coloration_svf_;
-
265 Svf hpf_;
-
266};
+
256
+
257 private:
+
258 float sample_rate_;
+
259
+
260 float accent_, f0_, tone_, decay_, noisiness_;
+
261 bool sustain_;
+
262 bool trig_;
+
263
+
264 float SemitonesToRatio(float in) { return powf(2.f, in * kOneTwelfth); }
+
265
+
266 float envelope_;
+
267 float noise_clock_;
+
268 float noise_sample_;
+
269 float sustain_gain_;
+
270
+
271 MetallicNoiseSource metallic_noise_;
+
272 Svf noise_coloration_svf_;
+
273 Svf hpf_;
+
274};
-
267} // namespace daisysp
-
268#endif
-
269#endif
-
808 HH, with a few extra parameters to push things to the CY territory...
Definition hihat.h:110
-
void SetAccent(float accent)
Definition hihat.h:213
-
float Process(bool trigger=false)
Definition hihat.h:144
-
void SetNoisiness(float noisiness)
Definition hihat.h:242
-
void SetTone(float tone)
Definition hihat.h:227
-
void SetSustain(bool sustain)
Definition hihat.h:208
-
void SetDecay(float decay)
Definition hihat.h:232
-
void Init(float sample_rate)
Definition hihat.h:118
-
void Trig()
Definition hihat.h:203
-
void SetFreq(float f0)
Definition hihat.h:218
-
Linear type VCA.
Definition hihat.h:91
-
Definition oscillator.h:13
-
Ring mod style metallic noise generator.
Definition hihat.h:47
-
808 style "metallic noise" with 6 square oscillators.
Definition hihat.h:25
-
float Band()
Definition svf.h:60
+
275} // namespace daisysp
+
276#endif
+
277#endif
+
808 HH, with a few extra parameters to push things to the CY territory...
Definition hihat.h:118
+
void SetAccent(float accent)
Definition hihat.h:221
+
float Process(bool trigger=false)
Definition hihat.h:152
+
void SetNoisiness(float noisiness)
Definition hihat.h:250
+
void SetTone(float tone)
Definition hihat.h:235
+
void SetSustain(bool sustain)
Definition hihat.h:216
+
void SetDecay(float decay)
Definition hihat.h:240
+
void Init(float sample_rate)
Definition hihat.h:126
+
void Trig()
Definition hihat.h:211
+
void SetFreq(float f0)
Definition hihat.h:226
+
Linear type VCA.
Definition hihat.h:99
+
Definition oscillator.h:21
+
Ring mod style metallic noise generator.
Definition hihat.h:55
+
808 style "metallic noise" with 6 square oscillators.
Definition hihat.h:33
+
float Band()
Definition svf.h:68
void Process(float in)
Definition svf.cpp:31
void SetRes(float r)
Definition svf.cpp:71
void Init(float sample_rate)
Definition svf.cpp:8
-
float High()
Definition svf.h:56
+
float High()
Definition svf.h:64
void SetFreq(float f)
Definition svf.cpp:58
-
Swing type VCA.
Definition hihat.h:72
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
float fclamp(float in, float min, float max)
Definition dsp.h:56
-
float fmax(float a, float b)
Definition dsp.h:32
+
Swing type VCA.
Definition hihat.h:80
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
float fclamp(float in, float min, float max)
Definition dsp.h:64
+
float fmax(float a, float b)
Definition dsp.h:40
-
1#pragma once
-
2#ifndef LIMITER_H
-
3#define LIMITER_H
-
4#include <stdlib.h>
-
5namespace daisysp
-
6{
-
- +
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 LIMITER_H
+
11#define LIMITER_H
+
12#include <stdlib.h>
+
13namespace daisysp
14{
-
15 public:
-
16 Limiter() {}
-
17 ~Limiter() {}
-
20 void Init();
-
21
-
27 void ProcessBlock(float *in, size_t size, float pre_gain);
-
28
-
29 private:
-
30 float peak_;
-
31};
+
+ +
22{
+
23 public:
+
24 Limiter() {}
+
25 ~Limiter() {}
+
28 void Init();
+
29
+
35 void ProcessBlock(float *in, size_t size, float pre_gain);
+
36
+
37 private:
+
38 float peak_;
+
39};
-
32} // namespace daisysp
-
33#endif
-
Definition limiter.h:14
+
40} // namespace daisysp
+
41#endif
+
Definition limiter.h:22
void Init()
Definition limiter.cpp:12
void ProcessBlock(float *in, size_t size, float pre_gain)
Definition limiter.cpp:17
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#include <algorithm>
-
3#include "dsp.h"
-
4
-
5namespace daisysp
-
6{
-
-
17class Looper
-
18{
-
19 public:
-
20 Looper() {}
-
21 ~Looper() {}
-
22
-
-
33 enum class Mode
-
34 {
-
35 NORMAL,
-
36 ONETIME_DUB,
-
37 REPLACE,
-
38 FRIPPERTRONICS,
-
39 };
-
-
40
-
41 void Init(float *mem, size_t size)
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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#include <algorithm>
+
11#include "dsp.h"
+
12
+
13namespace daisysp
+
14{
+
+
25class Looper
+
26{
+
27 public:
+
28 Looper() {}
+
29 ~Looper() {}
+
30
+
+
41 enum class Mode
42 {
-
43 buffer_size_ = size;
-
44 buff_ = mem;
-
45
-
46 InitBuff();
-
47 state_ = State::EMPTY;
-
48 mode_ = Mode::NORMAL;
-
49 half_speed_ = false;
-
50 reverse_ = false;
-
51 rec_queue_ = false;
-
52 win_idx_ = 0;
-
53 }
-
54
-
-
56 float Process(const float input)
-
57 {
-
58 float sig = 0.f;
-
59 float inc;
-
60 bool hitloop = false;
-
61 // Record forward at normal speed during the first loop no matter what.
-
62 inc = state_ == State::EMPTY || state_ == State::REC_FIRST
-
63 ? 1.f
-
64 : GetIncrementSize();
-
65 win_ = WindowVal(win_idx_ * kWindowFactor);
-
66 switch(state_)
-
67 {
-
68 case State::EMPTY: sig = 0.0f; break;
-
69 case State::REC_FIRST:
-
70 sig = 0.f;
-
71 Write(pos_, input * win_);
-
72 if(win_idx_ < kWindowSamps - 1)
-
73 win_idx_ += 1;
-
74 recsize_ = pos_;
-
75 pos_ += inc;
-
76 if(pos_ > buffer_size_ - 1)
-
77 {
-
78 state_ = State::PLAYING;
-
79 recsize_ = pos_ - 1;
-
80 pos_ = 0;
-
81 }
-
82 break;
-
83 case State::PLAYING:
-
84 sig = Read(pos_);
-
88 if(win_idx_ < kWindowSamps - 1)
-
89 {
-
90 Write(pos_, sig + input * (1.f - win_));
-
91 win_idx_ += 1;
-
92 }
-
93
-
94 pos_ += inc;
-
95 if(pos_ > recsize_ - 1)
-
96 {
-
97 pos_ = 0;
-
98 hitloop = true;
-
99 }
-
100 else if(pos_ < 0)
-
101 {
-
102 pos_ = recsize_ - 1;
-
103 hitloop = true;
-
104 }
-
105 if(hitloop)
-
106
-
107 {
-
108 if(rec_queue_ && mode_ == Mode::ONETIME_DUB)
-
109 {
-
110 rec_queue_ = false;
-
111 state_ = State::REC_DUB;
-
112 win_idx_ = 0;
-
113 }
-
114 }
-
115 break;
-
116 case State::REC_DUB:
-
117 sig = Read(pos_);
-
118 switch(mode_)
-
119 {
-
120 case Mode::REPLACE: Write(pos_, input * win_); break;
-
121 case Mode::FRIPPERTRONICS:
-
122 Write(pos_, (input * win_) + (sig * kFripDecayVal));
-
123 break;
-
124 case Mode::NORMAL:
-
125 case Mode::ONETIME_DUB:
-
126 default: Write(pos_, (input * win_) + sig); break;
-
127 }
-
128 if(win_idx_ < kWindowSamps - 1)
-
129 win_idx_ += 1;
-
130 pos_ += inc;
-
131 if(pos_ > recsize_ - 1)
-
132 {
-
133 pos_ = 0;
-
134 hitloop = true;
+
43 NORMAL,
+
44 ONETIME_DUB,
+
45 REPLACE,
+
46 FRIPPERTRONICS,
+
47 };
+
+
48
+
49 void Init(float *mem, size_t size)
+
50 {
+
51 buffer_size_ = size;
+
52 buff_ = mem;
+
53
+
54 InitBuff();
+
55 state_ = State::EMPTY;
+
56 mode_ = Mode::NORMAL;
+
57 half_speed_ = false;
+
58 reverse_ = false;
+
59 rec_queue_ = false;
+
60 win_idx_ = 0;
+
61 }
+
62
+
+
64 float Process(const float input)
+
65 {
+
66 float sig = 0.f;
+
67 float inc;
+
68 bool hitloop = false;
+
69 // Record forward at normal speed during the first loop no matter what.
+
70 inc = state_ == State::EMPTY || state_ == State::REC_FIRST
+
71 ? 1.f
+
72 : GetIncrementSize();
+
73 win_ = WindowVal(win_idx_ * kWindowFactor);
+
74 switch(state_)
+
75 {
+
76 case State::EMPTY: sig = 0.0f; break;
+
77 case State::REC_FIRST:
+
78 sig = 0.f;
+
79 Write(pos_, input * win_);
+
80 if(win_idx_ < kWindowSamps - 1)
+
81 win_idx_ += 1;
+
82 recsize_ = pos_;
+
83 pos_ += inc;
+
84 if(pos_ > buffer_size_ - 1)
+
85 {
+
86 state_ = State::PLAYING;
+
87 recsize_ = pos_ - 1;
+
88 pos_ = 0;
+
89 }
+
90 break;
+
91 case State::PLAYING:
+
92 sig = Read(pos_);
+
96 if(win_idx_ < kWindowSamps - 1)
+
97 {
+
98 Write(pos_, sig + input * (1.f - win_));
+
99 win_idx_ += 1;
+
100 }
+
101
+
102 pos_ += inc;
+
103 if(pos_ > recsize_ - 1)
+
104 {
+
105 pos_ = 0;
+
106 hitloop = true;
+
107 }
+
108 else if(pos_ < 0)
+
109 {
+
110 pos_ = recsize_ - 1;
+
111 hitloop = true;
+
112 }
+
113 if(hitloop)
+
114
+
115 {
+
116 if(rec_queue_ && mode_ == Mode::ONETIME_DUB)
+
117 {
+
118 rec_queue_ = false;
+
119 state_ = State::REC_DUB;
+
120 win_idx_ = 0;
+
121 }
+
122 }
+
123 break;
+
124 case State::REC_DUB:
+
125 sig = Read(pos_);
+
126 switch(mode_)
+
127 {
+
128 case Mode::REPLACE: Write(pos_, input * win_); break;
+
129 case Mode::FRIPPERTRONICS:
+
130 Write(pos_, (input * win_) + (sig * kFripDecayVal));
+
131 break;
+
132 case Mode::NORMAL:
+
133 case Mode::ONETIME_DUB:
+
134 default: Write(pos_, (input * win_) + sig); break;
135 }
-
136 else if(pos_ < 0)
-
137 {
-
138 pos_ = recsize_ - 1;
-
139 hitloop = true;
-
140 }
-
141 if(hitloop && mode_ == Mode::ONETIME_DUB)
-
142 {
-
143 state_ = State::PLAYING;
-
144 win_idx_ = 0;
-
145 }
-
146
-
147 break;
-
148 default: break;
-
149 }
-
150 near_beginning_ = state_ != State::EMPTY && !Recording() && pos_ < 4800
-
151 ? true
-
152 : false;
-
153
-
154 return sig;
-
155 }
+
136 if(win_idx_ < kWindowSamps - 1)
+
137 win_idx_ += 1;
+
138 pos_ += inc;
+
139 if(pos_ > recsize_ - 1)
+
140 {
+
141 pos_ = 0;
+
142 hitloop = true;
+
143 }
+
144 else if(pos_ < 0)
+
145 {
+
146 pos_ = recsize_ - 1;
+
147 hitloop = true;
+
148 }
+
149 if(hitloop && mode_ == Mode::ONETIME_DUB)
+
150 {
+
151 state_ = State::PLAYING;
+
152 win_idx_ = 0;
+
153 }
+
154
+
155 break;
+
156 default: break;
+
157 }
+
158 near_beginning_ = state_ != State::EMPTY && !Recording() && pos_ < 4800
+
159 ? true
+
160 : false;
+
161
+
162 return sig;
+
163 }
-
156
-
159 inline void Clear() { state_ = State::EMPTY; }
-
160
-
-
165 inline void TrigRecord()
-
166 {
-
167 switch(state_)
-
168 {
-
169 case State::EMPTY:
-
170 pos_ = 0;
-
171 recsize_ = 0;
-
172 state_ = State::REC_FIRST;
-
173 half_speed_ = false;
-
174 reverse_ = false;
-
175 break;
-
176 case State::REC_FIRST:
-
177 case State::REC_DUB: state_ = State::PLAYING; break;
-
178 case State::PLAYING:
-
179 if(mode_ == Mode::ONETIME_DUB)
-
180 rec_queue_ = true;
-
181 else
-
182 state_ = State::REC_DUB;
+
164
+
167 inline void Clear() { state_ = State::EMPTY; }
+
168
+
+
173 inline void TrigRecord()
+
174 {
+
175 switch(state_)
+
176 {
+
177 case State::EMPTY:
+
178 pos_ = 0;
+
179 recsize_ = 0;
+
180 state_ = State::REC_FIRST;
+
181 half_speed_ = false;
+
182 reverse_ = false;
183 break;
-
184 default: state_ = State::EMPTY; break;
-
185 }
-
186 if(!rec_queue_)
-
187 win_idx_ = 0;
-
188 }
+
184 case State::REC_FIRST:
+
185 case State::REC_DUB: state_ = State::PLAYING; break;
+
186 case State::PLAYING:
+
187 if(mode_ == Mode::ONETIME_DUB)
+
188 rec_queue_ = true;
+
189 else
+
190 state_ = State::REC_DUB;
+
191 break;
+
192 default: state_ = State::EMPTY; break;
+
193 }
+
194 if(!rec_queue_)
+
195 win_idx_ = 0;
+
196 }
-
189
-
-
191 inline const bool Recording() const
-
192 {
-
193 return state_ == State::REC_DUB || state_ == State::REC_FIRST;
-
194 }
-
-
195
-
196 inline const bool RecordingQueued() const { return rec_queue_; }
197
-
199 inline void IncrementMode()
-
200 {
-
201 int m = static_cast<int>(mode_);
-
202 m = m + 1;
-
203 if(m > kNumModes - 1)
-
204 m = 0;
-
205 mode_ = static_cast<Mode>(m);
-
206 }
+
199 inline const bool Recording() const
+
200 {
+
201 return state_ == State::REC_DUB || state_ == State::REC_FIRST;
+
202 }
+
+
203
+
204 inline const bool RecordingQueued() const { return rec_queue_; }
+
205
+
+
207 inline void IncrementMode()
+
208 {
+
209 int m = static_cast<int>(mode_);
+
210 m = m + 1;
+
211 if(m > kNumModes - 1)
+
212 m = 0;
+
213 mode_ = static_cast<Mode>(m);
+
214 }
-
207
-
209 inline void SetMode(Mode mode) { mode_ = mode; }
-
210
-
212 inline const Mode GetMode() const { return mode_; }
-
213
-
214 inline void ToggleReverse() { reverse_ = !reverse_; }
-
215 inline void SetReverse(bool state) { reverse_ = state; }
-
216 inline bool GetReverse() const { return reverse_; }
-
217
-
218 inline void ToggleHalfSpeed() { half_speed_ = !half_speed_; }
-
219 inline void SetHalfSpeed(bool state) { half_speed_ = state; }
-
220 inline bool GetHalfSpeed() const { return half_speed_; }
+
215
+
217 inline void SetMode(Mode mode) { mode_ = mode; }
+
218
+
220 inline const Mode GetMode() const { return mode_; }
221
-
222 inline bool IsNearBeginning() { return near_beginning_; }
-
223
-
224 private:
-
228 static constexpr float kFripDecayVal = 0.7071067811865476f;
-
229 static constexpr int kNumModes = 4;
-
230 static constexpr int kNumPlaybackSpeeds = 3;
-
231 static constexpr int kWindowSamps = 1200;
-
232 static constexpr float kWindowFactor = (1.f / kWindowSamps);
-
233
-
235 float GetIncrementSize()
-
236 {
-
237 float inc = 1.f;
-
238 if(half_speed_)
-
239 inc = 0.5f;
-
240 return reverse_ ? -inc : inc;
-
241 }
-
242
-
244 void InitBuff() { std::fill(&buff_[0], &buff_[buffer_size_ - 1], 0); }
-
245
-
247 inline const float Read(size_t pos) const { return buff_[pos]; }
-
248
-
250 float ReadF(float pos)
-
251 {
-
252 float a, b, frac;
-
253 uint32_t i_idx = static_cast<uint32_t>(pos);
-
254 frac = pos - i_idx;
-
255 a = buff_[i_idx];
-
256 b = buff_[(i_idx + 1) % buffer_size_];
-
257 return a + (b - a) * frac;
-
258 }
-
259
-
261 inline void Write(size_t pos, float val) { buff_[pos] = val; }
-
262
-
264 float WindowVal(float in) { return sin(HALFPI_F * in); }
-
265
-
266 // Private Enums
+
222 inline void ToggleReverse() { reverse_ = !reverse_; }
+
223 inline void SetReverse(bool state) { reverse_ = state; }
+
224 inline bool GetReverse() const { return reverse_; }
+
225
+
226 inline void ToggleHalfSpeed() { half_speed_ = !half_speed_; }
+
227 inline void SetHalfSpeed(bool state) { half_speed_ = state; }
+
228 inline bool GetHalfSpeed() const { return half_speed_; }
+
229
+
230 inline bool IsNearBeginning() { return near_beginning_; }
+
231
+
232 private:
+
236 static constexpr float kFripDecayVal = 0.7071067811865476f;
+
237 static constexpr int kNumModes = 4;
+
238 static constexpr int kNumPlaybackSpeeds = 3;
+
239 static constexpr int kWindowSamps = 1200;
+
240 static constexpr float kWindowFactor = (1.f / kWindowSamps);
+
241
+
243 float GetIncrementSize()
+
244 {
+
245 float inc = 1.f;
+
246 if(half_speed_)
+
247 inc = 0.5f;
+
248 return reverse_ ? -inc : inc;
+
249 }
+
250
+
252 void InitBuff() { std::fill(&buff_[0], &buff_[buffer_size_ - 1], 0); }
+
253
+
255 inline const float Read(size_t pos) const { return buff_[pos]; }
+
256
+
258 float ReadF(float pos)
+
259 {
+
260 float a, b, frac;
+
261 uint32_t i_idx = static_cast<uint32_t>(pos);
+
262 frac = pos - i_idx;
+
263 a = buff_[i_idx];
+
264 b = buff_[(i_idx + 1) % buffer_size_];
+
265 return a + (b - a) * frac;
+
266 }
267
-
269 enum class State
-
270 {
-
271 EMPTY,
-
272 REC_FIRST,
-
273 PLAYING,
-
274 REC_DUB,
-
275 };
-
276
-
278 Mode mode_;
-
279 State state_;
-
280 float *buff_;
-
281 size_t buffer_size_;
-
282 float pos_, win_;
-
283 size_t win_idx_;
-
284 bool half_speed_;
-
285 bool reverse_;
-
286 size_t recsize_;
-
287 bool rec_queue_;
-
288 bool near_beginning_;
-
289};
+
269 inline void Write(size_t pos, float val) { buff_[pos] = val; }
+
270
+
272 float WindowVal(float in) { return sin(HALFPI_F * in); }
+
273
+
274 // Private Enums
+
275
+
277 enum class State
+
278 {
+
279 EMPTY,
+
280 REC_FIRST,
+
281 PLAYING,
+
282 REC_DUB,
+
283 };
+
284
+
286 Mode mode_;
+
287 State state_;
+
288 float *buff_;
+
289 size_t buffer_size_;
+
290 float pos_, win_;
+
291 size_t win_idx_;
+
292 bool half_speed_;
+
293 bool reverse_;
+
294 size_t recsize_;
+
295 bool rec_queue_;
+
296 bool near_beginning_;
+
297};
-
290
-
291} // namespace daisysp
-
Definition delayline.h:21
-
Definition looper.h:18
-
Mode
Definition looper.h:34
-
void SetMode(Mode mode)
Definition looper.h:209
-
void IncrementMode()
Definition looper.h:199
-
void Clear()
Definition looper.h:159
-
float Process(const float input)
Definition looper.h:56
-
const Mode GetMode() const
Definition looper.h:212
-
const bool Recording() const
Definition looper.h:191
-
void TrigRecord()
Definition looper.h:165
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
298
+
299} // namespace daisysp
+
Definition delayline.h:29
+
Definition looper.h:26
+
Mode
Definition looper.h:42
+
void SetMode(Mode mode)
Definition looper.h:217
+
void IncrementMode()
Definition looper.h:207
+
void Clear()
Definition looper.h:167
+
float Process(const float input)
Definition looper.h:64
+
const Mode GetMode() const
Definition looper.h:220
+
const bool Recording() const
Definition looper.h:199
+
void TrigRecord()
Definition looper.h:173
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_MAYTRIG_H
-
3#define DSY_MAYTRIG_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
- +
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
+
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_MAYTRIG_H
+
11#define DSY_MAYTRIG_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
16namespace daisysp
17{
-
18 public:
-
19 Maytrig() {}
-
20 ~Maytrig() {}
-
-
27 inline float Process(float prob)
-
28 {
-
29 return ((float)rand() / (float)RAND_MAX) <= prob ? true : false;
-
30 }
+
+ +
25{
+
26 public:
+
27 Maytrig() {}
+
28 ~Maytrig() {}
+
+
35 inline float Process(float prob)
+
36 {
+
37 return ((float)rand() / (float)RAND_MAX) <= prob ? true : false;
+
38 }
-
31
-
32 private:
-
33};
+
39
+
40 private:
+
41};
-
34} // namespace daisysp
-
35#endif
-
36#endif
-
Definition delayline.h:21
-
Definition maytrig.h:17
-
float Process(float prob)
Definition maytrig.h:27
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
42} // namespace daisysp
+
43#endif
+
44#endif
+
Definition delayline.h:29
+
Definition maytrig.h:25
+
float Process(float prob)
Definition maytrig.h:35
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_METRO_H
-
3#define DSY_METRO_H
-
4#include <stdint.h>
-
5#ifdef __cplusplus
-
6
-
7namespace daisysp
-
8{
-
-
11class Metro
-
12{
-
13 public:
-
14 Metro() {}
-
15 ~Metro() {}
-
23 void Init(float freq, float sample_rate);
-
24
- -
28
-
31 inline void Reset() { phs_ = 0.0f; }
-
34 void SetFreq(float freq);
-
35
-
38 inline float GetFreq() { return freq_; }
-
39
-
40 private:
-
41 float freq_;
-
42 float phs_, sample_rate_, phs_inc_;
-
43};
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_METRO_H
+
11#define DSY_METRO_H
+
12#include <stdint.h>
+
13#ifdef __cplusplus
+
14
+
15namespace daisysp
+
16{
+
+
19class Metro
+
20{
+
21 public:
+
22 Metro() {}
+
23 ~Metro() {}
+
31 void Init(float freq, float sample_rate);
+
32
+ +
36
+
39 inline void Reset() { phs_ = 0.0f; }
+
42 void SetFreq(float freq);
+
43
+
46 inline float GetFreq() { return freq_; }
+
47
+
48 private:
+
49 float freq_;
+
50 float phs_, sample_rate_, phs_inc_;
+
51};
-
44} // namespace daisysp
-
45#endif
-
46#endif
-
Definition delayline.h:21
-
Definition metro.h:12
-
float GetFreq()
Definition metro.h:38
+
52} // namespace daisysp
+
53#endif
+
54#endif
+
Definition delayline.h:29
+
Definition metro.h:20
+
float GetFreq()
Definition metro.h:46
void SetFreq(float freq)
Definition metro.cpp:26
-
void Reset()
Definition metro.h:31
+
void Reset()
Definition metro.h:39
void Init(float freq, float sample_rate)
Definition metro.cpp:7
uint8_t Process()
Definition metro.cpp:15
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_MODAL_H
-
3#define DSY_MODAL_H
-
4
-
5#include <stdint.h>
-
6#include "Filters/svf.h"
- -
8#include "Noise/dust.h"
-
9#ifdef __cplusplus
-
10
-
13namespace daisysp
-
14{
-
- -
26{
-
27 public:
-
28 ModalVoice() {}
-
29 ~ModalVoice() {}
-
30
-
34 void Init(float sample_rate);
-
35
-
39 float Process(bool trigger = false);
-
40
-
44 void SetSustain(bool sustain);
-
45
-
47 void Trig();
+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_MODAL_H
+
11#define DSY_MODAL_H
+
12
+
13#include <stdint.h>
+
14#include "Filters/svf.h"
+ +
16#include "Noise/dust.h"
+
17#ifdef __cplusplus
+
18
+
21namespace daisysp
+
22{
+
+ +
34{
+
35 public:
+
36 ModalVoice() {}
+
37 ~ModalVoice() {}
+
38
+
42 void Init(float sample_rate);
+
43
+
47 float Process(bool trigger = false);
48
-
52 void SetFreq(float freq);
+
52 void SetSustain(bool sustain);
53
-
57 void SetAccent(float accent);
-
58
-
62 void SetStructure(float structure);
-
63
-
67 void SetBrightness(float brightness);
-
68
-
72 void SetDamping(float damping);
-
73
-
75 float GetAux();
+
55 void Trig();
+
56
+
60 void SetFreq(float freq);
+
61
+
65 void SetAccent(float accent);
+
66
+
70 void SetStructure(float structure);
+
71
+
75 void SetBrightness(float brightness);
76
-
77 private:
-
78 float sample_rate_;
-
79
-
80 bool sustain_, trig_;
-
81 float f0_, structure_, brightness_, damping_;
-
82 float density_, accent_;
-
83 float aux_;
+
80 void SetDamping(float damping);
+
81
+
83 float GetAux();
84
-
85 ResonatorSvf<1> excitation_filter_;
-
86 Resonator resonator_;
-
87 Dust dust_;
-
88};
+
85 private:
+
86 float sample_rate_;
+
87
+
88 bool sustain_, trig_;
+
89 float f0_, structure_, brightness_, damping_;
+
90 float density_, accent_;
+
91 float aux_;
+
92
+
93 ResonatorSvf<1> excitation_filter_;
+
94 Resonator resonator_;
+
95 Dust dust_;
+
96};
-
89} // namespace daisysp
-
90#endif
-
91#endif
-
Definition delayline.h:21
-
Dust Module.
Definition dust.h:24
-
Simple modal synthesis voice with a mallet exciter: click -> LPF -> resonator.
Definition modalvoice.h:26
+
97} // namespace daisysp
+
98#endif
+
99#endif
+
Definition delayline.h:29
+
Dust Module.
Definition dust.h:32
+
Simple modal synthesis voice with a mallet exciter: click -> LPF -> resonator.
Definition modalvoice.h:34
void SetStructure(float structure)
Definition modalvoice.cpp:46
void SetDamping(float damping)
Definition modalvoice.cpp:57
void SetFreq(float freq)
Definition modalvoice.cpp:34
@@ -151,9 +159,9 @@
void Trig()
Definition modalvoice.cpp:29
float Process(bool trigger=false)
Definition modalvoice.cpp:67
void SetAccent(float accent)
Definition modalvoice.cpp:41
-
Resonant Body Simulation.
Definition resonator.h:126
+
Resonant Body Simulation.
Definition resonator.h:134
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
diff --git a/mode_8h_source.html b/mode_8h_source.html deleted file mode 100644 index d987bb8e..00000000 --- a/mode_8h_source.html +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - -DaisySP: Source/Filters/mode.h Source File - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
mode.h
-
-
-
1#pragma once
-
2#ifndef DAISY_MODE
-
3#define DAISY_MODE
-
4
-
5namespace daisysp
-
6{
-
-
19class Mode
-
20{
-
21 public:
-
22 Mode() {}
-
23 ~Mode() {}
-
27 void Init(float sample_rate);
-
28
-
31 float Process(float in);
-
32
-
35 void Clear();
-
36
-
40 inline void SetFreq(float freq) { freq_ = freq; }
-
44 inline void SetQ(float q) { q_ = q; }
-
45
-
46 private:
-
47 float freq_, q_;
-
48 float xnm1_, ynm1_, ynm2_, a0_, a1_, a2_;
-
49 float d_, lfq_, lq_, sr_;
-
50};
-
-
51} // namespace daisysp
-
52
-
53#endif
-
Definition delayline.h:21
-
Definition mode.h:20
-
void Clear()
Definition mode.cpp:38
-
void SetFreq(float freq)
Definition mode.h:40
-
void Init(float sample_rate)
Definition mode.cpp:27
-
void SetQ(float q)
Definition mode.h:44
-
float Process(float in)
Definition mode.cpp:47
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
- - - - diff --git a/moogladder_8h_source.html b/moogladder_8h_source.html deleted file mode 100644 index d3925471..00000000 --- a/moogladder_8h_source.html +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - -DaisySP: Source/Filters/moogladder.h Source File - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
moogladder.h
-
-
-
1#pragma once
-
2#ifndef DSY_MOOGLADDER_H
-
3#define DSY_MOOGLADDER_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
- -
18{
-
19 public:
-
20 MoogLadder() {}
-
21 ~MoogLadder() {}
-
25 void Init(float sample_rate);
-
26
-
27
-
30 float Process(float in);
-
31
-
37 inline void SetFreq(float freq) { freq_ = freq; }
-
41 inline void SetRes(float res) { res_ = res; }
-
42
-
43 private:
-
44 float istor_, res_, freq_, delay_[6], tanhstg_[3], old_freq_, old_res_,
-
45 sample_rate_, old_acr_, old_tune_;
-
46 float my_tanh(float x);
-
47};
-
-
48} // namespace daisysp
-
49#endif
-
50#endif
-
Definition delayline.h:21
-
Definition moogladder.h:18
-
void SetFreq(float freq)
Definition moogladder.h:37
-
float Process(float in)
Definition moogladder.cpp:43
-
void Init(float sample_rate)
Definition moogladder.cpp:26
-
void SetRes(float res)
Definition moogladder.h:41
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
- - - - diff --git a/namespacedaisysp.html b/namespacedaisysp.html index e478188d..63219c1d 100644 --- a/namespacedaisysp.html +++ b/namespacedaisysp.html @@ -89,26 +89,14 @@   class  Adsr   -class  Allpass -  class  AnalogBassDrum  808 bass drum model, revisited. More...
  class  AnalogSnareDrum  808 snare drum model, revisited. More...
  -class  ATone -  class  Autowah   -class  Balance -  -class  Biquad -  -class  Bitcrush -  -class  BlOsc -  class  Chorus  Chorus Effect. More...
  @@ -117,10 +105,6 @@   class  ClockedNoise   -class  Comb -  -class  Compressor -  class  CrossFade   class  DcBlock @@ -145,8 +129,6 @@   class  Fm2   -class  Fold -  class  FormantOscillator  Formant Oscillator Module. More...
  @@ -164,12 +146,8 @@ class  HiHat  808 HH, with a few extra parameters to push things to the CY territory... More...
  -class  Jitter -  class  Limiter   -class  Line -  class  LinearVCA  Linear type VCA. More...
  @@ -182,11 +160,8 @@ class  ModalVoice  Simple modal synthesis voice with a mallet exciter: click -> LPF -> resonator. More...
  -class  Mode -  -class  MoogLadder -  -class  NlFilt +class  OnePole + One Pole Lowpass / Highpass Filter. More...
  class  Oscillator   @@ -209,12 +184,6 @@   class  PitchShifter   -class  Pluck -  -class  PolyPluck -  -class  Port -  class  Resonator  Resonant Body Simulation. More...
  @@ -222,10 +191,6 @@  SVF for use in the Resonator Class
. More...
  -class  ReverbSc -  -struct  ReverbScDl -  class  RingModNoise  Ring mod style metallic noise generator. More...
  @@ -244,7 +209,7 @@  808 style "metallic noise" with 6 square oscillators. More...
  class  StringComb filter / KS string. More...
+ Comb filter / KS string. More...
  class  StringVoice  Extended Karplus-Strong, with all the niceties from Rings. More...
@@ -266,8 +231,6 @@ class  SyntheticSnareDrum  Naive snare drum model (two modulated oscillators + filtered noise). More...
  -class  Tone -  class  Tremolo  Tremolo effect. More...
  @@ -321,11 +284,6 @@
}   -enum  { PLUCK_MODE_RECURSIVE -, PLUCK_MODE_WEIGHTED_AVERAGE -, PLUCK_LAST - } -  enum class  Mapping { LINEAR , EXP , LOG @@ -342,7 +300,7 @@ float fmin (float a, float b)   -float fclamp (float in, float min, float max) +float fclamp (float in, float min, float max)   float fastpower (float f, int n)   @@ -363,7 +321,7 @@   void fonepole (float &out, float in, float coeff)   -float fmap (float in, float min, float max, Mapping curve=Mapping::LINEAR) +float fmap (float in, float min, float max, Mapping curve=Mapping::LINEAR)   template<typename T > T median (T a, T b, T c) @@ -434,24 +392,6 @@

-

◆ anonymous enum

- -
-
- - - - -
anonymous enum
-
-

The method of natural decay that the algorithm will use.

    -
  • RECURSIVE: 1st order recursive filter, with coefs .5.
  • -
  • WEIGHTED_AVERAGE: weighted averaging.
  • -
-
diff --git a/namespaces.html b/namespaces.html index 145171a0..5d7ca6d7 100644 --- a/namespaces.html +++ b/namespaces.html @@ -79,89 +79,70 @@  NdaisyspFIR Filter implementation, generic and ARM CMSIS DSP based  CAdEnv  CAdsr - CAllpass - CAnalogBassDrum808 bass drum model, revisited - CAnalogSnareDrum808 snare drum model, revisited - CATone - CAutowah - CBalance - CBiquad - CBitcrush - CBlOsc - CChorusChorus Effect - CChorusEngineSingle Chorus engine. Used in Chorus - CClockedNoise - CComb - CCompressor - CCrossFade - CDcBlock - CDecimator - CDelayLine - CDrip - CDustDust Module - CFIRFilterImplGeneric - CFIRMemory - CFIRMemory< 0, 0 > - CFlangerFlanging Audio Effect - CFm2 - CFold - CFormantOscillatorFormant Oscillator Module - CFractalRandomGeneratorFractal Noise, stacks octaves of a noise source - CGrainletOscillatorGranular Oscillator Module - CGranularPlayer - CHarmonicOscillatorHarmonic Oscillator Module based on Chebyshev polynomials - CHiHat808 HH, with a few extra parameters to push things to the CY territory.. - CJitter - CLimiter - CLine - CLinearVCALinear type VCA - CLooper - CMaytrig - CMetro - CModalVoiceSimple modal synthesis voice with a mallet exciter: click -> LPF -> resonator - CMode - CMoogLadder - CNlFilt - COscillator - COscillatorBankOscillator Bank module - COverdriveDistortion / Overdrive Module - CParticleRandom impulse train processed by a resonant filter - CPhaserPhaser Effect - CPhaserEngineSingle Phaser engine. Used in Phaser - CPhasor - CPitchShifter - CPluck - CPolyPluck - CPort - CResonatorResonant Body Simulation - CResonatorSvfSVF for use in the Resonator Class
+ CAnalogBassDrum808 bass drum model, revisited + CAnalogSnareDrum808 snare drum model, revisited + CAutowah + CChorusChorus Effect + CChorusEngineSingle Chorus engine. Used in Chorus + CClockedNoise + CCrossFade + CDcBlock + CDecimator + CDelayLine + CDrip + CDustDust Module + CFIRFilterImplGeneric + CFIRMemory + CFIRMemory< 0, 0 > + CFlangerFlanging Audio Effect + CFm2 + CFormantOscillatorFormant Oscillator Module + CFractalRandomGeneratorFractal Noise, stacks octaves of a noise source + CGrainletOscillatorGranular Oscillator Module + CGranularPlayer + CHarmonicOscillatorHarmonic Oscillator Module based on Chebyshev polynomials + CHiHat808 HH, with a few extra parameters to push things to the CY territory.. + CLimiter + CLinearVCALinear type VCA + CLooper + CMaytrig + CMetro + CModalVoiceSimple modal synthesis voice with a mallet exciter: click -> LPF -> resonator + COnePoleOne Pole Lowpass / Highpass Filter + COscillator + COscillatorBankOscillator Bank module + COverdriveDistortion / Overdrive Module + CParticleRandom impulse train processed by a resonant filter + CPhaserPhaser Effect + CPhaserEngineSingle Phaser engine. Used in Phaser + CPhasor + CPitchShifter + CResonatorResonant Body Simulation + CResonatorSvfSVF for use in the Resonator Class
- CReverbSc - CReverbScDl - CRingModNoiseRing mod style metallic noise generator - CSampleHold - CSampleRateReducerSample rate reducer - CSmoothRandomGeneratorSmooth random generator for internal modulation.
+ CRingModNoiseRing mod style metallic noise generator + CSampleHold + CSampleRateReducerSample rate reducer + CSmoothRandomGeneratorSmooth random generator for internal modulation.
- CSoap - CSquareNoise808 style "metallic noise" with 6 square oscillators - CStringComb filter / KS string - CStringVoiceExtended Karplus-Strong, with all the niceties from Rings - CSvf - CSwingVCASwing type VCA - CSyntheticBassDrumNaive bass drum model (modulated oscillator with FM + envelope) - CSyntheticBassDrumAttackNoiseAttack Noise generator for SyntheticBassDrum - CSyntheticBassDrumClickClick noise for SyntheticBassDrum - CSyntheticSnareDrumNaive snare drum model (two modulated oscillators + filtered noise) - CTone - CTremoloTremolo effect - CVariableSawOscillatorVariable Saw Oscillator - CVariableShapeOscillatorVariable Waveshape Oscillator - CVosimOscillatorVosim Oscillator Module
+ CSoap + CSquareNoise808 style "metallic noise" with 6 square oscillators + CStringComb filter / KS string + CStringVoiceExtended Karplus-Strong, with all the niceties from Rings + CSvf + CSwingVCASwing type VCA + CSyntheticBassDrumNaive bass drum model (modulated oscillator with FM + envelope) + CSyntheticBassDrumAttackNoiseAttack Noise generator for SyntheticBassDrum + CSyntheticBassDrumClickClick noise for SyntheticBassDrum + CSyntheticSnareDrumNaive snare drum model (two modulated oscillators + filtered noise) + CTremoloTremolo effect + CVariableSawOscillatorVariable Saw Oscillator + CVariableShapeOscillatorVariable Waveshape Oscillator + CVosimOscillatorVosim Oscillator Module
- CWavefolder - CWhiteNoise - CZOscillatorZOscillator Module
+ CWavefolder + CWhiteNoise + CZOscillatorZOscillator Module

diff --git a/nlfilt_8h_source.html b/nlfilt_8h_source.html deleted file mode 100644 index 9e9d93c8..00000000 --- a/nlfilt_8h_source.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - -DaisySP: Source/Filters/nlfilt.h Source File - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
nlfilt.h
-
-
-
1#pragma once
-
2#ifndef DSY_NLFILT_H
-
3#define DSY_NLFILT_H
-
4#include <stdlib.h>
-
5#include <stdint.h>
-
6#define DSY_NLFILT_MAX_DELAY 1024
-
7
-
8namespace daisysp
-
9{
-
-
30class NlFilt
-
31{
-
32 public:
-
35 void Init();
-
36
-
40 void ProcessBlock(float *in, float *out, size_t size);
-
41
-
42
-
-
45 inline void SetCoefficients(float a, float b, float d, float C, float L)
-
46 {
-
47 a_ = a;
-
48 b_ = b;
-
49 d_ = d;
-
50 C_ = C;
-
51 L_ = L;
-
52 }
-
-
53
-
54
-
57 inline void SetA(float a) { a_ = a; }
-
60 inline void SetB(float b) { b_ = b; }
-
63 inline void SetD(float d) { d_ = d; }
-
66 inline void SetC(float C) { C_ = C; }
-
69 inline void SetL(float L) { L_ = L; }
-
70
-
71 private:
-
72 int32_t Set();
-
73
-
74 float in_, a_, b_, d_, C_, L_;
-
75 float delay_[DSY_NLFILT_MAX_DELAY];
-
76 int32_t point_;
-
77};
-
-
78} // namespace daisysp
-
79
-
80#endif
-
Definition delayline.h:21
-
Definition nlfilt.h:31
-
void SetCoefficients(float a, float b, float d, float C, float L)
Definition nlfilt.h:45
-
void SetD(float d)
Definition nlfilt.h:63
-
void SetC(float C)
Definition nlfilt.h:66
-
void Init()
Definition nlfilt.cpp:13
-
void ProcessBlock(float *in, float *out, size_t size)
Definition nlfilt.cpp:23
-
void SetA(float a)
Definition nlfilt.h:57
-
void SetL(float L)
Definition nlfilt.h:69
-
void SetB(float b)
Definition nlfilt.h:60
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
- - - - diff --git a/onepole_8h_source.html b/onepole_8h_source.html new file mode 100644 index 00000000..3ee71065 --- /dev/null +++ b/onepole_8h_source.html @@ -0,0 +1,196 @@ + + + + + + + +DaisySP: Source/Filters/onepole.h Source File + + + + + + + + + + + +
+
+ + + + + + +
+
DaisySP +
+
+
+ + + + + + + + + +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ + +
+
+
onepole.h
+
+
+
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#ifndef DSY_ONEPOLE_H
+
10#define DSY_ONEPOLE_H
+
11
+
12#include "Utility/dsp.h"
+
13#include <cmath>
+
14#include <algorithm>
+
15
+
16namespace daisysp
+
17{
+
+ +
27{
+
28 public:
+
29 OnePole() {}
+
30 ~OnePole() {}
+
31
+
+ +
38 {
+
39 FILTER_MODE_LOW_PASS,
+
40 FILTER_MODE_HIGH_PASS
+
41 };
+
+
42
+
+
44 void Init()
+
45 {
+
46 Reset();
+
47 mode_ = FILTER_MODE_LOW_PASS;
+
48 }
+
+
49
+
51 inline void Reset() { state_ = 0.0f; }
+
52
+
+
56 inline void SetFrequency(float freq)
+
57 {
+
58 // Clip coefficient to about 100.
+
59 freq = freq < 0.497f ? freq : 0.497f;
+
60
+
61 g_ = tanf(PI_F * freq);
+
62 gi_ = 1.f / (1.f + g_);
+
63 }
+
+
64
+
68 inline void SetFilterMode(FilterMode mode) { mode_ = mode; }
+
69
+
+
73 inline float Process(float in)
+
74 {
+
75 float lp;
+
76 lp = (g_ * in + state_) * gi_;
+
77 state_ = g_ * (in - lp) + lp;
+
78
+
79 switch(mode_)
+
80 {
+
81 case FILTER_MODE_LOW_PASS: return lp;
+
82 case FILTER_MODE_HIGH_PASS: return in - lp;
+
83 }
+
84
+
85 return 0.0f;
+
86 }
+
+
87
+
+
92 inline void ProcessBlock(float* in_out, size_t size)
+
93 {
+
94 while(size--)
+
95 {
+ +
97 ++in_out;
+
98 }
+
99 }
+
+
100
+
101 private:
+
102 float g_;
+
103 float gi_;
+
104 float state_;
+
105 FilterMode mode_;
+
106};
+
+
107
+
108} // namespace daisysp
+
109
+
110#endif // DSY_ONEPOLE_H
+
Definition delayline.h:29
+
One Pole Lowpass / Highpass Filter.
Definition onepole.h:27
+
FilterMode
Operational modes of the filter.
Definition onepole.h:38
+
float Process(float in)
Definition onepole.h:73
+
void Init()
Definition onepole.h:44
+
void ProcessBlock(float *in_out, size_t size)
Definition onepole.h:92
+
void Reset()
Definition onepole.h:51
+
void SetFilterMode(FilterMode mode)
Definition onepole.h:68
+
void SetFrequency(float freq)
Definition onepole.h:56
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
+ + + + diff --git a/oscillator_8h_source.html b/oscillator_8h_source.html index d826172d..e1485f1b 100644 --- a/oscillator_8h_source.html +++ b/oscillator_8h_source.html @@ -83,112 +83,120 @@
oscillator.h
-
1#pragma once
-
2#ifndef DSY_OSCILLATOR_H
-
3#define DSY_OSCILLATOR_H
-
4#include <stdint.h>
-
5#include "Utility/dsp.h"
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
- -
13{
-
14 public:
-
15 Oscillator() {}
-
16 ~Oscillator() {}
-
19 enum
-
20 {
-
21 WAVE_SIN,
-
22 WAVE_TRI,
-
23 WAVE_SAW,
-
24 WAVE_RAMP,
-
25 WAVE_SQUARE,
-
26 WAVE_POLYBLEP_TRI,
-
27 WAVE_POLYBLEP_SAW,
-
28 WAVE_POLYBLEP_SQUARE,
-
29 WAVE_LAST,
-
30 };
-
31
-
32
-
-
42 void Init(float sample_rate)
-
43 {
-
44 sr_ = sample_rate;
-
45 sr_recip_ = 1.0f / sample_rate;
-
46 freq_ = 100.0f;
-
47 amp_ = 0.5f;
-
48 pw_ = 0.5f;
-
49 phase_ = 0.0f;
-
50 phase_inc_ = CalcPhaseInc(freq_);
-
51 waveform_ = WAVE_SIN;
-
52 eoc_ = true;
-
53 eor_ = true;
-
54 }
-
-
55
-
56
-
-
59 inline void SetFreq(const float f)
-
60 {
-
61 freq_ = f;
-
62 phase_inc_ = CalcPhaseInc(f);
-
63 }
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_OSCILLATOR_H
+
11#define DSY_OSCILLATOR_H
+
12#include <stdint.h>
+
13#include "Utility/dsp.h"
+
14#ifdef __cplusplus
+
15
+
16namespace daisysp
+
17{
+
+ +
21{
+
22 public:
+
23 Oscillator() {}
+
24 ~Oscillator() {}
+
27 enum
+
28 {
+
29 WAVE_SIN,
+
30 WAVE_TRI,
+
31 WAVE_SAW,
+
32 WAVE_RAMP,
+
33 WAVE_SQUARE,
+
34 WAVE_POLYBLEP_TRI,
+
35 WAVE_POLYBLEP_SAW,
+
36 WAVE_POLYBLEP_SQUARE,
+
37 WAVE_LAST,
+
38 };
+
39
+
40
+
+
50 void Init(float sample_rate)
+
51 {
+
52 sr_ = sample_rate;
+
53 sr_recip_ = 1.0f / sample_rate;
+
54 freq_ = 100.0f;
+
55 amp_ = 0.5f;
+
56 pw_ = 0.5f;
+
57 phase_ = 0.0f;
+
58 phase_inc_ = CalcPhaseInc(freq_);
+
59 waveform_ = WAVE_SIN;
+
60 eoc_ = true;
+
61 eor_ = true;
+
62 }
+
63
64
-
65
-
68 inline void SetAmp(const float a) { amp_ = a; }
-
-
71 inline void SetWaveform(const uint8_t wf)
-
72 {
-
73 waveform_ = wf < WAVE_LAST ? wf : WAVE_SIN;
-
74 }
+
+
67 inline void SetFreq(const float f)
+
68 {
+
69 freq_ = f;
+
70 phase_inc_ = CalcPhaseInc(f);
+
71 }
+
+
72
+
73
+
76 inline void SetAmp(const float a) { amp_ = a; }
+
+
79 inline void SetWaveform(const uint8_t wf)
+
80 {
+
81 waveform_ = wf < WAVE_LAST ? wf : WAVE_SIN;
+
82 }
-
77 inline void SetPw(const float pw) { pw_ = fclamp(pw, 0.0f, 1.0f); }
-
78
-
81 inline bool IsEOR() { return eor_; }
-
82
-
85 inline bool IsEOC() { return eoc_; }
+
85 inline void SetPw(const float pw) { pw_ = fclamp(pw, 0.0f, 1.0f); }
86
-
89 inline bool IsRising() { return phase_ < 0.5f; }
+
89 inline bool IsEOR() { return eor_; }
90
-
93 inline bool IsFalling() { return phase_ >= 0.5f; }
+
93 inline bool IsEOC() { return eoc_; }
94
-
97 float Process();
+
97 inline bool IsRising() { return phase_ < 0.5f; }
98
-
99
-
102 void PhaseAdd(float _phase) { phase_ += _phase; }
-
105 void Reset(float _phase = 0.0f) { phase_ = _phase; }
+
101 inline bool IsFalling() { return phase_ >= 0.5f; }
+
102
+
105 float Process();
106
-
107 private:
-
108 float CalcPhaseInc(float f);
-
109 uint8_t waveform_;
-
110 float amp_, freq_, pw_;
-
111 float sr_, sr_recip_, phase_, phase_inc_;
-
112 float last_out_, last_freq_;
-
113 bool eor_, eoc_;
-
114};
+
107
+
110 void PhaseAdd(float _phase) { phase_ += _phase; }
+
113 void Reset(float _phase = 0.0f) { phase_ = _phase; }
+
114
+
115 private:
+
116 float CalcPhaseInc(float f);
+
117 uint8_t waveform_;
+
118 float amp_, freq_, pw_;
+
119 float sr_, sr_recip_, phase_, phase_inc_;
+
120 float last_out_, last_freq_;
+
121 bool eor_, eoc_;
+
122};
-
115} // namespace daisysp
-
116#endif
-
117#endif
-
Definition delayline.h:21
-
Definition oscillator.h:13
-
bool IsEOR()
Definition oscillator.h:81
-
void Init(float sample_rate)
Definition oscillator.h:42
-
void PhaseAdd(float _phase)
Definition oscillator.h:102
-
bool IsRising()
Definition oscillator.h:89
-
void SetWaveform(const uint8_t wf)
Definition oscillator.h:71
-
bool IsEOC()
Definition oscillator.h:85
-
void SetFreq(const float f)
Definition oscillator.h:59
-
void Reset(float _phase=0.0f)
Definition oscillator.h:105
+
123} // namespace daisysp
+
124#endif
+
125#endif
+
Definition delayline.h:29
+
Definition oscillator.h:21
+
bool IsEOR()
Definition oscillator.h:89
+
void Init(float sample_rate)
Definition oscillator.h:50
+
void PhaseAdd(float _phase)
Definition oscillator.h:110
+
bool IsRising()
Definition oscillator.h:97
+
void SetWaveform(const uint8_t wf)
Definition oscillator.h:79
+
bool IsEOC()
Definition oscillator.h:93
+
void SetFreq(const float f)
Definition oscillator.h:67
+
void Reset(float _phase=0.0f)
Definition oscillator.h:113
float Process()
Definition oscillator.cpp:7
-
void SetPw(const float pw)
Definition oscillator.h:77
-
bool IsFalling()
Definition oscillator.h:93
-
void SetAmp(const float a)
Definition oscillator.h:68
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
float fclamp(float in, float min, float max)
Definition dsp.h:56
+
void SetPw(const float pw)
Definition oscillator.h:85
+
bool IsFalling()
Definition oscillator.h:101
+
void SetAmp(const float a)
Definition oscillator.h:76
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
float fclamp(float in, float min, float max)
Definition dsp.h:64
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_OSCILLATORBANK_H
-
3#define DSY_OSCILLATORBANK_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
- -
23{
-
24 public:
- - -
27
-
31 void Init(float sample_rate);
-
32
-
35 float Process();
-
36
-
40 void SetFreq(float freq);
-
41
-
45 void SetAmplitudes(const float* amplitudes);
-
46
-
51 void SetSingleAmp(float amp, int idx);
-
52
-
56 void SetGain(float gain);
-
57
-
58 private:
-
59 // Oscillator state.
-
60 float phase_;
-
61 float next_sample_;
-
62 int segment_;
-
63 float gain_;
-
64 float registration_[7];
-
65 float unshifted_registration_[7];
-
66
-
67 float frequency_;
-
68 float saw_8_gain_;
-
69 float saw_4_gain_;
-
70 float saw_2_gain_;
-
71 float saw_1_gain_;
-
72
-
73 float sample_rate_;
-
74 bool recalc_, recalc_gain_;
-
75
-
76 bool cmp(float a, float b) { return fabsf(a - b) > .0000001; }
-
77};
+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_OSCILLATORBANK_H
+
11#define DSY_OSCILLATORBANK_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
+ +
31{
+
32 public:
+ + +
35
+
39 void Init(float sample_rate);
+
40
+
43 float Process();
+
44
+
48 void SetFreq(float freq);
+
49
+
53 void SetAmplitudes(const float* amplitudes);
+
54
+
59 void SetSingleAmp(float amp, int idx);
+
60
+
64 void SetGain(float gain);
+
65
+
66 private:
+
67 // Oscillator state.
+
68 float phase_;
+
69 float next_sample_;
+
70 int segment_;
+
71 float gain_;
+
72 float registration_[7];
+
73 float unshifted_registration_[7];
+
74
+
75 float frequency_;
+
76 float saw_8_gain_;
+
77 float saw_4_gain_;
+
78 float saw_2_gain_;
+
79 float saw_1_gain_;
+
80
+
81 float sample_rate_;
+
82 bool recalc_, recalc_gain_;
+
83
+
84 bool cmp(float a, float b) { return fabsf(a - b) > .0000001; }
+
85};
-
78} // namespace daisysp
-
79#endif
-
80#endif
-
Definition delayline.h:21
-
Oscillator Bank module.
Definition oscillatorbank.h:23
+
86} // namespace daisysp
+
87#endif
+
88#endif
+
Definition delayline.h:29
+
Oscillator Bank module.
Definition oscillatorbank.h:31
void SetGain(float gain)
Definition oscillatorbank.cpp:141
float Process()
Definition oscillatorbank.cpp:33
void SetSingleAmp(float amp, int idx)
Definition oscillatorbank.cpp:131
void SetAmplitudes(const float *amplitudes)
Definition oscillatorbank.cpp:122
void SetFreq(float freq)
Definition oscillatorbank.cpp:114
void Init(float sample_rate)
Definition oscillatorbank.cpp:7
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_OVERDRIVE_H
-
3#define DSY_OVERDRIVE_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
- -
21{
-
22 public:
-
23 Overdrive() {}
-
24 ~Overdrive() {}
-
25
-
27 void Init();
-
28
-
32 float Process(float in);
+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_OVERDRIVE_H
+
11#define DSY_OVERDRIVE_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
+ +
29{
+
30 public:
+
31 Overdrive() {}
+
32 ~Overdrive() {}
33
-
37 void SetDrive(float drive);
-
38
-
39 private:
-
40 float drive_;
-
41 float pre_gain_;
-
42 float post_gain_;
-
43};
+
35 void Init();
+
36
+
40 float Process(float in);
+
41
+
45 void SetDrive(float drive);
+
46
+
47 private:
+
48 float drive_;
+
49 float pre_gain_;
+
50 float post_gain_;
+
51};
-
44} // namespace daisysp
-
45#endif
-
46#endif
-
Distortion / Overdrive Module.
Definition overdrive.h:21
+
52} // namespace daisysp
+
53#endif
+
54#endif
+
Distortion / Overdrive Module.
Definition overdrive.h:29
void SetDrive(float drive)
Definition overdrive.cpp:18
float Process(float in)
Definition overdrive.cpp:12
void Init()
Definition overdrive.cpp:7
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_PHASER_H
-
3#define DSY_PHASER_H
-
4#ifdef __cplusplus
-
5
-
6#include <stdint.h>
-
7#include "Utility/delayline.h"
+Go to the documentation of this file.
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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
-
11namespace daisysp
-
12{
-
- -
18{
-
19 public:
-
20 PhaserEngine() {}
-
21 ~PhaserEngine() {}
-
22
-
26 void Init(float sample_rate);
-
27
-
31 float Process(float in);
-
32
-
36 void SetLfoDepth(float depth);
-
37
-
41 void SetLfoFreq(float lfo_freq);
-
42
-
46 void SetFreq(float ap_freq);
-
47
-
51 void SetFeedback(float feedback);
-
52
-
53 private:
-
54 float sample_rate_;
-
55 static constexpr int32_t kDelayLength
-
56 = 2400; // 50 ms at 48kHz = .05 * 48000
-
57
-
58 //triangle lfo
-
59 float lfo_phase_;
-
60 float lfo_freq_;
-
61 float lfo_amp_;
-
62
-
63 float os_;
-
64
-
65 float feedback_;
-
66 float ap_freq_;
-
67
-
68 float deltime_;
-
69 float last_sample_;
+
9#pragma once
+
10#ifndef DSY_PHASER_H
+
11#define DSY_PHASER_H
+
12#ifdef __cplusplus
+
13
+
14#include <stdint.h>
+
15#include "Utility/delayline.h"
+
16
+
19namespace daisysp
+
20{
+
+ +
26{
+
27 public:
+
28 PhaserEngine() {}
+
29 ~PhaserEngine() {}
+
30
+
34 void Init(float sample_rate);
+
35
+
39 float Process(float in);
+
40
+
44 void SetLfoDepth(float depth);
+
45
+
49 void SetLfoFreq(float lfo_freq);
+
50
+
54 void SetFreq(float ap_freq);
+
55
+
59 void SetFeedback(float feedback);
+
60
+
61 private:
+
62 float sample_rate_;
+
63 static constexpr int32_t kDelayLength
+
64 = 2400; // 50 ms at 48kHz = .05 * 48000
+
65
+
66 //triangle lfo
+
67 float lfo_phase_;
+
68 float lfo_freq_;
+
69 float lfo_amp_;
70
- +
71 float os_;
72
-
73 float ProcessLfo();
-
74};
-
+
73 float feedback_;
+
74 float ap_freq_;
75
-
76//wraps up all of the phaser engines
-
-
82class Phaser
-
83{
-
84 public:
-
85 Phaser() {}
-
86 ~Phaser() {}
-
87
-
91 void Init(float sample_rate);
-
92
-
96 float Process(float in);
-
97
-
101 void SetPoles(int poles);
-
102
-
106 void SetLfoDepth(float depth);
-
107
-
111 void SetLfoFreq(float lfo_freq);
-
112
-
116 void SetFreq(float ap_freq);
-
117
-
121 void SetFeedback(float feedback);
-
122
-
123 private:
-
124 static constexpr int kMaxPoles = 8;
-
125 PhaserEngine engines_[kMaxPoles];
-
126 float gain_frac_;
-
127 int poles_;
-
128};
+
76 float deltime_;
+
77 float last_sample_;
+
78
+ +
80
+
81 float ProcessLfo();
+
82};
+
+
83
+
84//wraps up all of the phaser engines
+
+
90class Phaser
+
91{
+
92 public:
+
93 Phaser() {}
+
94 ~Phaser() {}
+
95
+
99 void Init(float sample_rate);
+
100
+
104 float Process(float in);
+
105
+
109 void SetPoles(int poles);
+
110
+
114 void SetLfoDepth(float depth);
+
115
+
119 void SetLfoFreq(float lfo_freq);
+
120
+
124 void SetFreq(float ap_freq);
+
125
+
129 void SetFeedback(float feedback);
+
130
+
131 private:
+
132 static constexpr int kMaxPoles = 8;
+
133 PhaserEngine engines_[kMaxPoles];
+
134 float gain_frac_;
+
135 int poles_;
+
136};
-
129} //namespace daisysp
-
130#endif
-
131#endif
-
Definition delayline.h:21
-
Single Phaser engine. Used in Phaser.
Definition phaser.h:18
+
137} //namespace daisysp
+
138#endif
+
139#endif
+
Definition delayline.h:29
+
Single Phaser engine. Used in Phaser.
Definition phaser.h:26
void SetLfoDepth(float depth)
Definition phaser.cpp:38
void Init(float sample_rate)
Definition phaser.cpp:8
void SetFeedback(float feedback)
Definition phaser.cpp:55
void SetLfoFreq(float lfo_freq)
Definition phaser.cpp:43
float Process(float in)
Definition phaser.cpp:28
void SetFreq(float ap_freq)
Definition phaser.cpp:50
-
Phaser Effect.
Definition phaser.h:83
+
Phaser Effect.
Definition phaser.h:91
float Process(float in)
Definition phaser.cpp:91
void SetFreq(float ap_freq)
Definition phaser.cpp:124
void SetFeedback(float feedback)
Definition phaser.cpp:132
@@ -184,7 +192,7 @@
void Init(float sample_rate)
Definition phaser.cpp:80
void SetLfoFreq(float lfo_freq)
Definition phaser.cpp:116
void SetPoles(int poles)
Definition phaser.cpp:103
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_PHASOR_H
-
3#define DSY_PHASOR_H
-
4#ifdef __cplusplus
-
5
-
6namespace daisysp
-
7{
-
-
14class Phasor
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_PHASOR_H
+
11#define DSY_PHASOR_H
+
12#ifdef __cplusplus
+
13
+
14namespace daisysp
15{
-
16 public:
-
17 Phasor() {}
-
18 ~Phasor() {}
-
-
26 inline void Init(float sample_rate, float freq, float initial_phase)
-
27 {
-
28 sample_rate_ = sample_rate;
-
29 phs_ = initial_phase;
-
30 SetFreq(freq);
-
31 }
+
+
22class Phasor
+
23{
+
24 public:
+
25 Phasor() {}
+
26 ~Phasor() {}
+
+
34 inline void Init(float sample_rate, float freq, float initial_phase)
+
35 {
+
36 sample_rate_ = sample_rate;
+
37 phs_ = initial_phase;
+
38 SetFreq(freq);
+
39 }
-
32
-
-
35 inline void Init(float sample_rate, float freq)
-
36 {
-
37 Init(sample_rate, freq, 0.0f);
-
38 }
+
40
+
+
43 inline void Init(float sample_rate, float freq)
+
44 {
+
45 Init(sample_rate, freq, 0.0f);
+
46 }
-
39
-
42 inline void Init(float sample_rate) { Init(sample_rate, 1.0f, 0.0f); }
-
45 float Process();
-
46
47
-
50 void SetFreq(float freq);
-
51
-
52
-
55 inline float GetFreq() { return freq_; }
-
56
-
57 private:
-
58 float freq_;
-
59 float sample_rate_, inc_, phs_;
-
60};
+
50 inline void Init(float sample_rate) { Init(sample_rate, 1.0f, 0.0f); }
+
53 float Process();
+
54
+
55
+
58 void SetFreq(float freq);
+
59
+
60
+
63 inline float GetFreq() { return freq_; }
+
64
+
65 private:
+
66 float freq_;
+
67 float sample_rate_, inc_, phs_;
+
68};
-
61} // namespace daisysp
-
62#endif
-
63#endif
-
Definition phasor.h:15
+
69} // namespace daisysp
+
70#endif
+
71#endif
+
Definition phasor.h:23
float Process()
Definition phasor.cpp:13
void SetFreq(float freq)
Definition phasor.cpp:7
-
void Init(float sample_rate)
Definition phasor.h:42
-
void Init(float sample_rate, float freq)
Definition phasor.h:35
-
void Init(float sample_rate, float freq, float initial_phase)
Definition phasor.h:26
-
float GetFreq()
Definition phasor.h:55
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
void Init(float sample_rate)
Definition phasor.h:50
+
void Init(float sample_rate, float freq)
Definition phasor.h:43
+
void Init(float sample_rate, float freq, float initial_phase)
Definition phasor.h:34
+
float GetFreq()
Definition phasor.h:63
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_PITCHSHIFTER_H
-
3#define DSY_PITCHSHIFTER_H
-
4#include <stdint.h>
-
5#include <cmath>
-
6#ifdef USE_ARM_DSP
-
7#include "arm_math.h"
-
8#endif
-
9#include "Utility/dsp.h"
-
10#include "Utility/delayline.h"
-
11#include "Control/phasor.h"
-
12
-
16#define SHIFT_BUFFER_SIZE 16384
-
17//#define SHIFT_BUFFER_SIZE 4800
-
18//#define SHIFT_BUFFER_SIZE 8192
-
19//#define SHIFT_BUFFER_SIZE 1024
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_PITCHSHIFTER_H
+
11#define DSY_PITCHSHIFTER_H
+
12#include <stdint.h>
+
13#include <cmath>
+
14#ifdef USE_ARM_DSP
+
15#include "arm_math.h"
+
16#endif
+
17#include "Utility/dsp.h"
+
18#include "Utility/delayline.h"
+
19#include "Control/phasor.h"
20
-
21namespace daisysp
-
22{
-
23static inline uint32_t hash_xs32(uint32_t x)
-
24{
-
25 x ^= x << 13;
-
26 x ^= x >> 17;
-
27 x ^= x << 5;
-
28 return x;
-
29}
-
30
-
31inline uint32_t myrand()
+
24#define SHIFT_BUFFER_SIZE 16384
+
25//#define SHIFT_BUFFER_SIZE 4800
+
26//#define SHIFT_BUFFER_SIZE 8192
+
27//#define SHIFT_BUFFER_SIZE 1024
+
28
+
29namespace daisysp
+
30{
+
31static inline uint32_t hash_xs32(uint32_t x)
32{
-
33 static uint32_t seed = 1;
-
34 seed = hash_xs32(seed);
-
35 return seed;
-
36}
-
37
-
- -
57{
-
58 public:
-
59 PitchShifter() {}
-
60 ~PitchShifter() {}
-
-
63 void Init(float sr)
-
64 {
-
65 force_recalc_ = false;
-
66 sr_ = sr;
-
67 mod_freq_ = 5.0f;
-
68 SetSemitones();
-
69 for(uint8_t i = 0; i < 2; i++)
-
70 {
-
71 gain_[i] = 0.0f;
-
72 d_[i].Init();
-
73 phs_[i].Init(sr, 50, i == 0 ? 0 : PI_F);
-
74 }
-
75 shift_up_ = true;
-
76 del_size_ = SHIFT_BUFFER_SIZE;
-
77 SetDelSize(del_size_);
-
78 fun_ = 0.0f;
-
79 }
+
33 x ^= x << 13;
+
34 x ^= x >> 17;
+
35 x ^= x << 5;
+
36 return x;
+
37}
+
38
+
39inline uint32_t myrand()
+
40{
+
41 static uint32_t seed = 1;
+
42 seed = hash_xs32(seed);
+
43 return seed;
+
44}
+
45
+
+ +
65{
+
66 public:
+
67 PitchShifter() {}
+
68 ~PitchShifter() {}
+
+
71 void Init(float sr)
+
72 {
+
73 force_recalc_ = false;
+
74 sr_ = sr;
+
75 mod_freq_ = 5.0f;
+
76 SetSemitones();
+
77 for(uint8_t i = 0; i < 2; i++)
+
78 {
+
79 gain_[i] = 0.0f;
+
80 d_[i].Init();
+
81 phs_[i].Init(sr, 50, i == 0 ? 0 : PI_F);
+
82 }
+
83 shift_up_ = true;
+
84 del_size_ = SHIFT_BUFFER_SIZE;
+
85 SetDelSize(del_size_);
+
86 fun_ = 0.0f;
+
87 }
-
80
-
-
83 float Process(float &in)
-
84 {
-
85 float val, fade1, fade2;
-
86 // First Process delay mod/crossfade
-
87 fade1 = phs_[0].Process();
-
88 fade2 = phs_[1].Process();
-
89 if(prev_phs_a_ > fade1)
-
90 {
-
91 mod_a_amt_ = fun_ * ((float)(myrand() % 255) / 255.0f)
-
92 * (del_size_ * 0.5f);
-
93 mod_coeff_[0]
-
94 = 0.0002f + (((float)(myrand() % 255) / 255.0f) * 0.001f);
-
95 }
-
96 if(prev_phs_b_ > fade2)
-
97 {
-
98 mod_b_amt_ = fun_ * ((float)(myrand() % 255) / 255.0f)
-
99 * (del_size_ * 0.5f);
-
100 mod_coeff_[1]
-
101 = 0.0002f + (((float)(myrand() % 255) / 255.0f) * 0.001f);
-
102 }
-
103 slewed_mod_[0] += mod_coeff_[0] * (mod_a_amt_ - slewed_mod_[0]);
-
104 slewed_mod_[1] += mod_coeff_[1] * (mod_b_amt_ - slewed_mod_[1]);
-
105 prev_phs_a_ = fade1;
-
106 prev_phs_b_ = fade2;
-
107 if(shift_up_)
-
108 {
-
109 fade1 = 1.0f - fade1;
-
110 fade2 = 1.0f - fade2;
-
111 }
-
112 mod_[0] = fade1 * (del_size_ - 1);
-
113 mod_[1] = fade2 * (del_size_ - 1);
-
114#ifdef USE_ARM_DSP
-
115 gain_[0] = arm_sin_f32(fade1 * (float)M_PI);
-
116 gain_[1] = arm_sin_f32(fade2 * (float)M_PI);
-
117#else
-
118 gain_[0] = sinf(fade1 * PI_F);
-
119 gain_[1] = sinf(fade2 * PI_F);
-
120#endif
-
121
-
122 // Handle Delay Writing
-
123 d_[0].Write(in);
-
124 d_[1].Write(in);
-
125 // Modulate Delay Lines
-
126 //mod_a_amt = mod_b_amt = 0.0f;
-
127 d_[0].SetDelay(mod_[0] + mod_a_amt_);
-
128 d_[1].SetDelay(mod_[1] + mod_b_amt_);
-
129 d_[0].SetDelay(mod_[0] + slewed_mod_[0]);
-
130 d_[1].SetDelay(mod_[1] + slewed_mod_[1]);
-
131 val = 0.0f;
-
132 val += (d_[0].Read() * gain_[0]);
-
133 val += (d_[1].Read() * gain_[1]);
-
134 return val;
-
135 }
+
88
+
+
91 float Process(float &in)
+
92 {
+
93 float val, fade1, fade2;
+
94 // First Process delay mod/crossfade
+
95 fade1 = phs_[0].Process();
+
96 fade2 = phs_[1].Process();
+
97 if(prev_phs_a_ > fade1)
+
98 {
+
99 mod_a_amt_ = fun_ * ((float)(myrand() % 255) / 255.0f)
+
100 * (del_size_ * 0.5f);
+
101 mod_coeff_[0]
+
102 = 0.0002f + (((float)(myrand() % 255) / 255.0f) * 0.001f);
+
103 }
+
104 if(prev_phs_b_ > fade2)
+
105 {
+
106 mod_b_amt_ = fun_ * ((float)(myrand() % 255) / 255.0f)
+
107 * (del_size_ * 0.5f);
+
108 mod_coeff_[1]
+
109 = 0.0002f + (((float)(myrand() % 255) / 255.0f) * 0.001f);
+
110 }
+
111 slewed_mod_[0] += mod_coeff_[0] * (mod_a_amt_ - slewed_mod_[0]);
+
112 slewed_mod_[1] += mod_coeff_[1] * (mod_b_amt_ - slewed_mod_[1]);
+
113 prev_phs_a_ = fade1;
+
114 prev_phs_b_ = fade2;
+
115 if(shift_up_)
+
116 {
+
117 fade1 = 1.0f - fade1;
+
118 fade2 = 1.0f - fade2;
+
119 }
+
120 mod_[0] = fade1 * (del_size_ - 1);
+
121 mod_[1] = fade2 * (del_size_ - 1);
+
122#ifdef USE_ARM_DSP
+
123 gain_[0] = arm_sin_f32(fade1 * (float)M_PI);
+
124 gain_[1] = arm_sin_f32(fade2 * (float)M_PI);
+
125#else
+
126 gain_[0] = sinf(fade1 * PI_F);
+
127 gain_[1] = sinf(fade2 * PI_F);
+
128#endif
+
129
+
130 // Handle Delay Writing
+
131 d_[0].Write(in);
+
132 d_[1].Write(in);
+
133 // Modulate Delay Lines
+
134 //mod_a_amt = mod_b_amt = 0.0f;
+
135 d_[0].SetDelay(mod_[0] + mod_a_amt_);
+
136 d_[1].SetDelay(mod_[1] + mod_b_amt_);
+
137 d_[0].SetDelay(mod_[0] + slewed_mod_[0]);
+
138 d_[1].SetDelay(mod_[1] + slewed_mod_[1]);
+
139 val = 0.0f;
+
140 val += (d_[0].Read() * gain_[0]);
+
141 val += (d_[1].Read() * gain_[1]);
+
142 return val;
+
143 }
-
136
-
-
139 void SetTransposition(const float &transpose)
-
140 {
-
141 float ratio;
-
142 uint8_t idx;
-
143 if(transpose_ != transpose || force_recalc_)
-
144 {
-
145 transpose_ = transpose;
-
146 idx = (uint8_t)fabsf(transpose);
-
147 ratio = semitone_ratios_[idx % 12];
-
148 ratio *= (uint8_t)(fabsf(transpose) / 12) + 1;
-
149 if(transpose > 0.0f)
-
150 {
-
151 shift_up_ = true;
-
152 }
-
153 else
-
154 {
-
155 shift_up_ = false;
-
156 }
-
157 mod_freq_ = ((ratio - 1.0f) * sr_) / del_size_;
-
158 if(mod_freq_ < 0.0f)
-
159 {
-
160 mod_freq_ = 0.0f;
-
161 }
-
162 phs_[0].SetFreq(mod_freq_);
-
163 phs_[1].SetFreq(mod_freq_);
-
164 if(force_recalc_)
-
165 {
-
166 force_recalc_ = false;
-
167 }
-
168 }
-
169 }
+
144
+
+
147 void SetTransposition(const float &transpose)
+
148 {
+
149 float ratio;
+
150 uint8_t idx;
+
151 if(transpose_ != transpose || force_recalc_)
+
152 {
+
153 transpose_ = transpose;
+
154 idx = (uint8_t)fabsf(transpose);
+
155 ratio = semitone_ratios_[idx % 12];
+
156 ratio *= (uint8_t)(fabsf(transpose) / 12) + 1;
+
157 if(transpose > 0.0f)
+
158 {
+
159 shift_up_ = true;
+
160 }
+
161 else
+
162 {
+
163 shift_up_ = false;
+
164 }
+
165 mod_freq_ = ((ratio - 1.0f) * sr_) / del_size_;
+
166 if(mod_freq_ < 0.0f)
+
167 {
+
168 mod_freq_ = 0.0f;
+
169 }
+
170 phs_[0].SetFreq(mod_freq_);
+
171 phs_[1].SetFreq(mod_freq_);
+
172 if(force_recalc_)
+
173 {
+
174 force_recalc_ = false;
+
175 }
+
176 }
+
177 }
-
170
-
-
173 void SetDelSize(uint32_t size)
-
174 {
-
175 del_size_ = size < SHIFT_BUFFER_SIZE ? size : SHIFT_BUFFER_SIZE;
-
176 force_recalc_ = true;
-
177 SetTransposition(transpose_);
-
178 }
+
178
+
+
181 void SetDelSize(uint32_t size)
+
182 {
+
183 del_size_ = size < SHIFT_BUFFER_SIZE ? size : SHIFT_BUFFER_SIZE;
+
184 force_recalc_ = true;
+
185 SetTransposition(transpose_);
+
186 }
-
179
-
182 inline void SetFun(float f) { fun_ = f; }
-
183
-
184 private:
-
185 inline void SetSemitones()
-
186 {
-
187 for(size_t i = 0; i < 12; i++)
-
188 {
-
189 semitone_ratios_[i] = powf(2.0f, (float)i / 12);
-
190 }
-
191 }
-
192 typedef DelayLine<float, SHIFT_BUFFER_SIZE> ShiftDelay;
-
193 ShiftDelay d_[2];
-
194 float pitch_shift_, mod_freq_;
-
195 uint32_t del_size_;
-
198 bool force_recalc_;
-
199 float sr_;
-
200 bool shift_up_;
-
201 Phasor phs_[2];
-
202 float gain_[2], mod_[2], transpose_;
-
203 float fun_, mod_a_amt_, mod_b_amt_, prev_phs_a_, prev_phs_b_;
-
204 float slewed_mod_[2], mod_coeff_[2];
-
207 float semitone_ratios_[12];
-
208};
+
187
+
190 inline void SetFun(float f) { fun_ = f; }
+
191
+
192 private:
+
193 inline void SetSemitones()
+
194 {
+
195 for(size_t i = 0; i < 12; i++)
+
196 {
+
197 semitone_ratios_[i] = powf(2.0f, (float)i / 12);
+
198 }
+
199 }
+
200 typedef DelayLine<float, SHIFT_BUFFER_SIZE> ShiftDelay;
+
201 ShiftDelay d_[2];
+
202 float pitch_shift_, mod_freq_;
+
203 uint32_t del_size_;
+
206 bool force_recalc_;
+
207 float sr_;
+
208 bool shift_up_;
+
209 Phasor phs_[2];
+
210 float gain_[2], mod_[2], transpose_;
+
211 float fun_, mod_a_amt_, mod_b_amt_, prev_phs_a_, prev_phs_b_;
+
212 float slewed_mod_[2], mod_coeff_[2];
+
215 float semitone_ratios_[12];
+
216};
-
209} // namespace daisysp
-
210
-
211#endif
-
void SetDelay(size_t delay)
Definition delayline.h:43
-
const T Read() const
Definition delayline.h:70
-
void Write(const T sample)
Definition delayline.h:62
-
void Init()
Definition delayline.h:27
+
217} // namespace daisysp
+
218
+
219#endif
+
void SetDelay(size_t delay)
Definition delayline.h:51
+
const T Read() const
Definition delayline.h:78
+
void Write(const T sample)
Definition delayline.h:70
+
void Init()
Definition delayline.h:35
float Process()
Definition phasor.cpp:13
void SetFreq(float freq)
Definition phasor.cpp:7
-
void Init(float sample_rate, float freq, float initial_phase)
Definition phasor.h:26
-
Definition pitchshifter.h:57
-
void Init(float sr)
Definition pitchshifter.h:63
-
void SetTransposition(const float &transpose)
Definition pitchshifter.h:139
-
float Process(float &in)
Definition pitchshifter.h:83
-
void SetDelSize(uint32_t size)
Definition pitchshifter.h:173
-
void SetFun(float f)
Definition pitchshifter.h:182
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
void Init(float sample_rate, float freq, float initial_phase)
Definition phasor.h:34
+
Definition pitchshifter.h:65
+
void Init(float sr)
Definition pitchshifter.h:71
+
void SetTransposition(const float &transpose)
Definition pitchshifter.h:147
+
float Process(float &in)
Definition pitchshifter.h:91
+
void SetDelSize(uint32_t size)
Definition pitchshifter.h:181
+
void SetFun(float f)
Definition pitchshifter.h:190
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_RESONATOR_H
-
3#define DSY_RESONATOR_H
-
4
-
5#include <stdint.h>
-
6#include <stddef.h>
-
7#include "Utility/dsp.h"
-
8#ifdef __cplusplus
-
9
-
10
-
13namespace daisysp
-
14{
-
15// We render 4 modes simultaneously since there are enough registers to hold
-
16// all state variables.
-
25template <int batch_size>
-
- -
27{
-
28 public:
-
29 enum FilterMode
-
30 {
-
31 LOW_PASS,
-
32 BAND_PASS,
-
33 BAND_PASS_NORMALIZED,
-
34 HIGH_PASS
-
35 };
-
36
-
37 ResonatorSvf() {}
-
38 ~ResonatorSvf() {}
-
39
-
40 void Init()
-
41 {
-
42 for(int i = 0; i < batch_size; ++i)
-
43 {
-
44 state_1_[i] = state_2_[i] = 0.0f;
-
45 }
-
46 }
+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_RESONATOR_H
+
11#define DSY_RESONATOR_H
+
12
+
13#include <stdint.h>
+
14#include <stddef.h>
+
15#include "Utility/dsp.h"
+
16#ifdef __cplusplus
+
17
+
18
+
21namespace daisysp
+
22{
+
23// We render 4 modes simultaneously since there are enough registers to hold
+
24// all state variables.
+
33template <int batch_size>
+
+ +
35{
+
36 public:
+
37 enum FilterMode
+
38 {
+
39 LOW_PASS,
+
40 BAND_PASS,
+
41 BAND_PASS_NORMALIZED,
+
42 HIGH_PASS
+
43 };
+
44
+
45 ResonatorSvf() {}
+
46 ~ResonatorSvf() {}
47
-
48 template <FilterMode mode, bool add>
-
49 void Process(const float* f,
-
50 const float* q,
-
51 const float* gain,
-
52 const float in,
-
53 float* out)
-
54 {
-
55 float g[batch_size];
-
56 float r[batch_size];
-
57 float r_plus_g[batch_size];
-
58 float h[batch_size];
-
59 float state_1[batch_size];
-
60 float state_2[batch_size];
-
61 float gains[batch_size];
-
62 for(int i = 0; i < batch_size; ++i)
-
63 {
-
64 g[i] = fasttan(f[i]);
-
65 r[i] = 1.0f / q[i];
-
66 h[i] = 1.0f / (1.0f + r[i] * g[i] + g[i] * g[i]);
-
67 r_plus_g[i] = r[i] + g[i];
-
68 state_1[i] = state_1_[i];
-
69 state_2[i] = state_2_[i];
-
70 gains[i] = gain[i];
-
71 }
-
72
-
73 float s_in = in;
-
74 float s_out = 0.0f;
-
75 for(int i = 0; i < batch_size; ++i)
-
76 {
-
77 const float hp
-
78 = (s_in - r_plus_g[i] * state_1[i] - state_2[i]) * h[i];
-
79 const float bp = g[i] * hp + state_1[i];
-
80 state_1[i] = g[i] * hp + bp;
-
81 const float lp = g[i] * bp + state_2[i];
-
82 state_2[i] = g[i] * bp + lp;
-
83 s_out += gains[i] * ((mode == LOW_PASS) ? lp : bp);
-
84 }
-
85 if(add)
-
86 {
-
87 *out++ += s_out;
-
88 }
-
89 else
-
90 {
-
91 *out++ = s_out;
+
48 void Init()
+
49 {
+
50 for(int i = 0; i < batch_size; ++i)
+
51 {
+
52 state_1_[i] = state_2_[i] = 0.0f;
+
53 }
+
54 }
+
55
+
56 template <FilterMode mode, bool add>
+
57 void Process(const float* f,
+
58 const float* q,
+
59 const float* gain,
+
60 const float in,
+
61 float* out)
+
62 {
+
63 float g[batch_size];
+
64 float r[batch_size];
+
65 float r_plus_g[batch_size];
+
66 float h[batch_size];
+
67 float state_1[batch_size];
+
68 float state_2[batch_size];
+
69 float gains[batch_size];
+
70 for(int i = 0; i < batch_size; ++i)
+
71 {
+
72 g[i] = fasttan(f[i]);
+
73 r[i] = 1.0f / q[i];
+
74 h[i] = 1.0f / (1.0f + r[i] * g[i] + g[i] * g[i]);
+
75 r_plus_g[i] = r[i] + g[i];
+
76 state_1[i] = state_1_[i];
+
77 state_2[i] = state_2_[i];
+
78 gains[i] = gain[i];
+
79 }
+
80
+
81 float s_in = in;
+
82 float s_out = 0.0f;
+
83 for(int i = 0; i < batch_size; ++i)
+
84 {
+
85 const float hp
+
86 = (s_in - r_plus_g[i] * state_1[i] - state_2[i]) * h[i];
+
87 const float bp = g[i] * hp + state_1[i];
+
88 state_1[i] = g[i] * hp + bp;
+
89 const float lp = g[i] * bp + state_2[i];
+
90 state_2[i] = g[i] * bp + lp;
+
91 s_out += gains[i] * ((mode == LOW_PASS) ? lp : bp);
92 }
-
93
-
94 for(int i = 0; i < batch_size; ++i)
-
95 {
-
96 state_1_[i] = state_1[i];
-
97 state_2_[i] = state_2[i];
-
98 }
-
99 }
-
100
-
101 private:
-
102 static constexpr float kPiPow3 = PI_F * PI_F * PI_F;
-
103 static constexpr float kPiPow5 = kPiPow3 * PI_F * PI_F;
-
104 static inline float fasttan(float f)
-
105 {
-
106 const float a = 3.260e-01 * kPiPow3;
-
107 const float b = 1.823e-01 * kPiPow5;
-
108 float f2 = f * f;
-
109 return f * (PI_F + f2 * (a + b * f2));
-
110 }
-
111
-
112 float state_1_[batch_size];
-
113 float state_2_[batch_size];
-
114};
+
93 if(add)
+
94 {
+
95 *out++ += s_out;
+
96 }
+
97 else
+
98 {
+
99 *out++ = s_out;
+
100 }
+
101
+
102 for(int i = 0; i < batch_size; ++i)
+
103 {
+
104 state_1_[i] = state_1[i];
+
105 state_2_[i] = state_2[i];
+
106 }
+
107 }
+
108
+
109 private:
+
110 static constexpr float kPiPow3 = PI_F * PI_F * PI_F;
+
111 static constexpr float kPiPow5 = kPiPow3 * PI_F * PI_F;
+
112 static inline float fasttan(float f)
+
113 {
+
114 const float a = 3.260e-01 * kPiPow3;
+
115 const float b = 1.823e-01 * kPiPow5;
+
116 float f2 = f * f;
+
117 return f * (PI_F + f2 * (a + b * f2));
+
118 }
+
119
+
120 float state_1_[batch_size];
+
121 float state_2_[batch_size];
+
122};
-
115
-
116
-
- -
126{
-
127 public:
-
128 Resonator() {}
-
129 ~Resonator() {}
-
130
-
136 void Init(float position, int resolution, float sample_rate);
-
137
-
141 float Process(const float in);
-
142
-
146 void SetFreq(float freq);
-
147
-
151 void SetStructure(float structure);
-
152
-
156 void SetBrightness(float brightness);
-
157
-
161 void SetDamping(float damping);
-
162
-
163 private:
-
164 int resolution_;
-
165 float frequency_, brightness_, structure_, damping_;
-
166
-
167 static constexpr int kMaxNumModes = 24;
-
168 static constexpr int kModeBatchSize = 4;
-
169 static constexpr float ratiofrac_ = 1.f / 12.f;
-
170 static constexpr float stiff_frac_ = 1.f / 64.f;
-
171 static constexpr float stiff_frac_2 = 1.f / .6f;
-
172
-
173 float sample_rate_;
+
123
+
124
+
+ +
134{
+
135 public:
+
136 Resonator() {}
+
137 ~Resonator() {}
+
138
+
144 void Init(float position, int resolution, float sample_rate);
+
145
+
149 float Process(const float in);
+
150
+
154 void SetFreq(float freq);
+
155
+
159 void SetStructure(float structure);
+
160
+
164 void SetBrightness(float brightness);
+
165
+
169 void SetDamping(float damping);
+
170
+
171 private:
+
172 int resolution_;
+
173 float frequency_, brightness_, structure_, damping_;
174
-
175 float CalcStiff(float sig);
-
176
-
177 float mode_amplitude_[kMaxNumModes];
-
178 ResonatorSvf<kModeBatchSize> mode_filters_[kMaxNumModes / kModeBatchSize];
-
179};
-
+
175 static constexpr int kMaxNumModes = 24;
+
176 static constexpr int kModeBatchSize = 4;
+
177 static constexpr float ratiofrac_ = 1.f / 12.f;
+
178 static constexpr float stiff_frac_ = 1.f / 64.f;
+
179 static constexpr float stiff_frac_2 = 1.f / .6f;
180
-
181} // namespace daisysp
-
182#endif
-
183#endif
-
Definition delayline.h:21
-
Resonant Body Simulation.
Definition resonator.h:126
+
181 float sample_rate_;
+
182
+
183 float CalcStiff(float sig);
+
184
+
185 float mode_amplitude_[kMaxNumModes];
+
186 ResonatorSvf<kModeBatchSize> mode_filters_[kMaxNumModes / kModeBatchSize];
+
187};
+
+
188
+
189} // namespace daisysp
+
190#endif
+
191#endif
+
Definition delayline.h:29
+
Resonant Body Simulation.
Definition resonator.h:134
void SetDamping(float damping)
Definition resonator.cpp:129
void Init(float position, int resolution, float sample_rate)
Definition resonator.cpp:6
float Process(const float in)
Definition resonator.cpp:46
void SetStructure(float structure)
Definition resonator.cpp:119
void SetFreq(float freq)
Definition resonator.cpp:114
void SetBrightness(float brightness)
Definition resonator.cpp:124
-
SVF for use in the Resonator Class .
Definition resonator.h:27
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
SVF for use in the Resonator Class .
Definition resonator.h:35
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_SAMPLEHOLD_H
-
3#define DSY_SAMPLEHOLD_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
- -
16{
-
17 public:
-
18 SampleHold() {}
-
19 ~SampleHold() {}
-
20
-
21 enum Mode
-
22 {
-
23 MODE_SAMPLE_HOLD,
-
24 MODE_TRACK_HOLD,
-
25 MODE_LAST,
-
26 };
-
27
-
33 inline float
-
-
34 Process(bool trigger, float input, Mode mode = MODE_SAMPLE_HOLD)
-
35 {
-
36 Update(trigger, input);
-
37 return mode == MODE_SAMPLE_HOLD ? sample_ : track_;
-
38 }
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Paul Batchelor
+
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_SAMPLEHOLD_H
+
11#define DSY_SAMPLEHOLD_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
16namespace daisysp
+
17{
+
+ +
24{
+
25 public:
+
26 SampleHold() {}
+
27 ~SampleHold() {}
+
28
+
29 enum Mode
+
30 {
+
31 MODE_SAMPLE_HOLD,
+
32 MODE_TRACK_HOLD,
+
33 MODE_LAST,
+
34 };
+
35
+
41 inline float
+
+
42 Process(bool trigger, float input, Mode mode = MODE_SAMPLE_HOLD)
+
43 {
+
44 Update(trigger, input);
+
45 return mode == MODE_SAMPLE_HOLD ? sample_ : track_;
+
46 }
-
39
-
40 private:
-
41 float track_ = 0;
-
42 float sample_ = 0;
-
43 bool previous_ = false;
-
44
-
45
-
46 inline void Update(bool trigger, float input)
-
47 {
-
48 if(trigger)
-
49 {
-
50 if(!previous_)
-
51 {
-
52 sample_ = input;
-
53 }
-
54 track_ = input;
-
55 }
-
56 previous_ = trigger;
-
57 }
-
58};
+
47
+
48 private:
+
49 float track_ = 0;
+
50 float sample_ = 0;
+
51 bool previous_ = false;
+
52
+
53
+
54 inline void Update(bool trigger, float input)
+
55 {
+
56 if(trigger)
+
57 {
+
58 if(!previous_)
+
59 {
+
60 sample_ = input;
+
61 }
+
62 track_ = input;
+
63 }
+
64 previous_ = trigger;
+
65 }
+
66};
-
59} // namespace daisysp
-
60#endif
-
61#endif
-
Definition delayline.h:21
-
Definition samplehold.h:16
-
float Process(bool trigger, float input, Mode mode=MODE_SAMPLE_HOLD)
Definition samplehold.h:34
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
67} // namespace daisysp
+
68#endif
+
69#endif
+
Definition delayline.h:29
+
Definition samplehold.h:24
+
float Process(bool trigger, float input, Mode mode=MODE_SAMPLE_HOLD)
Definition samplehold.h:42
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_SR_REDUCER_H
-
3#define DSY_SR_REDUCER_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
- -
21{
-
22 public:
- - -
25
-
27 void Init();
-
28
-
32 float Process(float in);
+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_SR_REDUCER_H
+
11#define DSY_SR_REDUCER_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
+ +
29{
+
30 public:
+ +
33
-
37 void SetFreq(float frequency);
-
38
-
39 private:
-
40 float frequency_;
-
41 float phase_;
-
42 float sample_;
-
43 float previous_sample_;
-
44 float next_sample_;
-
45};
+
35 void Init();
+
36
+
40 float Process(float in);
+
41
+
45 void SetFreq(float frequency);
+
46
+
47 private:
+
48 float frequency_;
+
49 float phase_;
+
50 float sample_;
+
51 float previous_sample_;
+
52 float next_sample_;
+
53};
-
46} // namespace daisysp
-
47#endif
-
48#endif
-
Definition delayline.h:21
-
Sample rate reducer.
Definition sampleratereducer.h:21
+
54} // namespace daisysp
+
55#endif
+
56#endif
+
Definition delayline.h:29
+
Sample rate reducer.
Definition sampleratereducer.h:29
float Process(float in)
Definition sampleratereducer.cpp:15
void SetFreq(float frequency)
Definition sampleratereducer.cpp:40
void Init()
Definition sampleratereducer.cpp:6
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_SMOOTHRANDOM_H
-
3#define DSY_SMOOTHRANDOM_H
-
4
-
5#include "dsp.h"
-
6#include <stdint.h>
-
7#include <stdlib.h>
-
8#ifdef __cplusplus
-
9
-
12namespace daisysp
-
13{
-
- -
23{
-
24 public:
- - -
27
-
-
31 void Init(float sample_rate)
-
32 {
-
33 sample_rate_ = sample_rate;
-
34
-
35 SetFreq(1.f);
-
36 phase_ = 0.0f;
-
37 from_ = 0.0f;
-
38 interval_ = 0.0f;
-
39 }
+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_SMOOTHRANDOM_H
+
11#define DSY_SMOOTHRANDOM_H
+
12
+
13#include "dsp.h"
+
14#include <stdint.h>
+
15#include <stdlib.h>
+
16#ifdef __cplusplus
+
17
+
20namespace daisysp
+
21{
+
+ +
31{
+
32 public:
+ + +
35
+
+
39 void Init(float sample_rate)
+
40 {
+
41 sample_rate_ = sample_rate;
+
42
+
43 SetFreq(1.f);
+
44 phase_ = 0.0f;
+
45 from_ = 0.0f;
+
46 interval_ = 0.0f;
+
47 }
-
40
-
-
42 float Process()
-
43 {
-
44 phase_ += frequency_;
-
45 if(phase_ >= 1.0f)
-
46 {
-
47 phase_ -= 1.0f;
-
48 from_ += interval_;
-
49 interval_ = rand() * kRandFrac * 2.0f - 1.0f - from_;
-
50 }
-
51 float t = phase_ * phase_ * (3.0f - 2.0f * phase_);
-
52 return from_ + interval_ * t;
-
53 }
+
48
+
+
50 float Process()
+
51 {
+
52 phase_ += frequency_;
+
53 if(phase_ >= 1.0f)
+
54 {
+
55 phase_ -= 1.0f;
+
56 from_ += interval_;
+
57 interval_ = rand() * kRandFrac * 2.0f - 1.0f - from_;
+
58 }
+
59 float t = phase_ * phase_ * (3.0f - 2.0f * phase_);
+
60 return from_ + interval_ * t;
+
61 }
-
54
-
-
58 void SetFreq(float freq)
-
59 {
-
60 freq = freq / sample_rate_;
-
61 frequency_ = fclamp(freq, 0.f, 1.f);
-
62 }
+
62
+
+
66 void SetFreq(float freq)
+
67 {
+
68 freq = freq / sample_rate_;
+
69 frequency_ = fclamp(freq, 0.f, 1.f);
+
70 }
-
63
-
64 private:
-
65 float frequency_;
-
66 float phase_;
-
67 float from_;
-
68 float interval_;
-
69
-
70 float sample_rate_;
71
-
72 static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
-
73};
+
72 private:
+
73 float frequency_;
+
74 float phase_;
+
75 float from_;
+
76 float interval_;
+
77
+
78 float sample_rate_;
+
79
+
80 static constexpr float kRandFrac = 1.f / (float)RAND_MAX;
+
81};
-
74
-
75} // namespace daisysp
-
76#endif
-
77#endif
-
Definition delayline.h:21
-
Smooth random generator for internal modulation. .
Definition smooth_random.h:23
-
float Process()
Definition smooth_random.h:42
-
void SetFreq(float freq)
Definition smooth_random.h:58
-
void Init(float sample_rate)
Definition smooth_random.h:31
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
float fclamp(float in, float min, float max)
Definition dsp.h:56
+
82
+
83} // namespace daisysp
+
84#endif
+
85#endif
+
Definition delayline.h:29
+
Smooth random generator for internal modulation. .
Definition smooth_random.h:31
+
float Process()
Definition smooth_random.h:50
+
void SetFreq(float freq)
Definition smooth_random.h:66
+
void Init(float sample_rate)
Definition smooth_random.h:39
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
+
float fclamp(float in, float min, float max)
Definition dsp.h:64
-
1#pragma once
-
2
-
3namespace daisysp
-
4{
-
-
12class Soap
-
13{
-
14 public:
-
15 Soap() {}
-
16 ~Soap() {}
-
17
-
21 void Init(float sample_rate);
-
22
-
26 void Process(float in);
-
27
-
31 void SetCenterFreq(float f);
-
32
-
36 void SetFilterBandwidth(float b);
-
37
-
41 inline float Bandpass() { return out_bandpass_; }
-
42
-
46 inline float Bandreject() { return out_bandreject_; }
-
47
-
48 private:
-
49 float soap_center_freq_;
-
50 float soap_bandwidth_;
-
51 float in_0_;
-
52 float din_1_;
-
53 float din_2_;
-
54 float dout_1_;
-
55 float dout_2_;
-
56 float all_output_;
-
57 float out_bandpass_;
-
58 float out_bandreject_;
-
59 float sr_;
-
60};
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Brian Tice, Tom Erbe
+
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
+
11namespace daisysp
+
12{
+
+
20class Soap
+
21{
+
22 public:
+
23 Soap() {}
+
24 ~Soap() {}
+
25
+
29 void Init(float sample_rate);
+
30
+
34 void Process(float in);
+
35
+
39 void SetCenterFreq(float f);
+
40
+
44 void SetFilterBandwidth(float b);
+
45
+
49 inline float Bandpass() { return out_bandpass_; }
+
50
+
54 inline float Bandreject() { return out_bandreject_; }
+
55
+
56 private:
+
57 float soap_center_freq_;
+
58 float soap_bandwidth_;
+
59 float in_0_;
+
60 float din_1_;
+
61 float din_2_;
+
62 float dout_1_;
+
63 float dout_2_;
+
64 float all_output_;
+
65 float out_bandpass_;
+
66 float out_bandreject_;
+
67 float sr_;
+
68};
-
61
-
62} // namespace daisysp
-
Definition delayline.h:21
-
Definition soap.h:13
-
float Bandreject()
Definition soap.h:46
+
69
+
70} // namespace daisysp
+
Definition delayline.h:29
+
Definition soap.h:21
+
float Bandreject()
Definition soap.h:54
void SetCenterFreq(float f)
Definition soap.cpp:55
void SetFilterBandwidth(float b)
Definition soap.cpp:61
-
float Bandpass()
Definition soap.h:41
+
float Bandpass()
Definition soap.h:49
void Process(float in)
Definition soap.cpp:24
void Init(float sample_rate)
Definition soap.cpp:8
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_STRINGVOICE_H
-
3#define DSY_STRINGVOICE_H
-
4
-
5#include "Filters/svf.h"
- -
7#include "Noise/dust.h"
-
8#include <stdint.h>
-
9#ifdef __cplusplus
-
10
-
13namespace daisysp
-
14{
-
- -
25{
-
26 public:
-
27 StringVoice() {}
-
28 ~StringVoice() {}
-
29
-
33 void Init(float sample_rate);
-
34
-
36 void Reset();
+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_STRINGVOICE_H
+
11#define DSY_STRINGVOICE_H
+
12
+
13#include "Filters/svf.h"
+ +
15#include "Noise/dust.h"
+
16#include <stdint.h>
+
17#ifdef __cplusplus
+
18
+
21namespace daisysp
+
22{
+
+ +
33{
+
34 public:
+
35 StringVoice() {}
+
36 ~StringVoice() {}
37
-
41 float Process(bool trigger = false);
+
41 void Init(float sample_rate);
42
-
46 void SetSustain(bool sustain);
-
47
-
49 void Trig();
+
44 void Reset();
+
45
+
49 float Process(bool trigger = false);
50
-
54 void SetFreq(float freq);
+
54 void SetSustain(bool sustain);
55
-
59 void SetAccent(float accent);
-
60
-
64 void SetStructure(float structure);
-
65
-
69 void SetBrightness(float brightness);
-
70
-
74 void SetDamping(float damping);
-
75
-
77 float GetAux();
+
57 void Trig();
+
58
+
62 void SetFreq(float freq);
+
63
+
67 void SetAccent(float accent);
+
68
+
72 void SetStructure(float structure);
+
73
+
77 void SetBrightness(float brightness);
78
-
79 private:
-
80 float sample_rate_;
-
81
-
82 bool sustain_, trig_;
-
83 float f0_, brightness_, damping_;
-
84 float density_, accent_;
-
85 float aux_;
+
82 void SetDamping(float damping);
+
83
+
85 float GetAux();
86
-
87 Dust dust_;
-
88 Svf excitation_filter_;
-
89 String string_;
-
90 size_t remaining_noise_samples_;
-
91};
+
87 private:
+
88 float sample_rate_;
+
89
+
90 bool sustain_, trig_;
+
91 float f0_, brightness_, damping_;
+
92 float density_, accent_;
+
93 float aux_;
+
94
+
95 Dust dust_;
+
96 Svf excitation_filter_;
+
97 String string_;
+
98 size_t remaining_noise_samples_;
+
99};
-
92} // namespace daisysp
-
93#endif
-
94#endif
+
100} // namespace daisysp
+
101#endif
+
102#endif
-
Definition delayline.h:21
-
Dust Module.
Definition dust.h:24
-
Comb filter / KS string.
Definition KarplusString.h:29
-
Extended Karplus-Strong, with all the niceties from Rings.
Definition stringvoice.h:25
+
Definition delayline.h:29
+
Dust Module.
Definition dust.h:32
+
Comb filter / KS string.
Definition KarplusString.h:36
+
Extended Karplus-Strong, with all the niceties from Rings.
Definition stringvoice.h:33
void SetFreq(float freq)
Definition stringvoice.cpp:39
void Reset()
Definition stringvoice.cpp:24
float GetAux()
Definition stringvoice.cpp:72
@@ -157,9 +165,9 @@
void SetSustain(bool sustain)
Definition stringvoice.cpp:29
void Init(float sample_rate)
Definition stringvoice.cpp:7
float Process(bool trigger=false)
Definition stringvoice.cpp:77
-
Definition svf.h:19
+
Definition svf.h:27
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_SVF_H
-
3#define DSY_SVF_H
-
4
-
5namespace daisysp
-
6{
-
-
18class Svf
-
19{
-
20 public:
-
21 Svf() {}
-
22 ~Svf() {}
-
26 void Init(float sample_rate);
-
27
-
28
-
32 void Process(float in);
-
33
-
34
-
38 void SetFreq(float f);
-
39
-
43 void SetRes(float r);
-
44
-
48 void SetDrive(float d);
-
52 inline float Low() { return out_low_; }
-
56 inline float High() { return out_high_; }
-
60 inline float Band() { return out_band_; }
-
64 inline float Notch() { return out_notch_; }
-
68 inline float Peak() { return out_peak_; }
-
69
-
70 private:
-
71 float sr_, fc_, res_, drive_, freq_, damp_;
-
72 float notch_, low_, high_, band_, peak_;
-
73 float input_;
-
74 float out_low_, out_high_, out_band_, out_peak_, out_notch_;
-
75 float pre_drive_, fc_max_;
-
76};
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_SVF_H
+
11#define DSY_SVF_H
+
12
+
13namespace daisysp
+
14{
+
+
26class Svf
+
27{
+
28 public:
+
29 Svf() {}
+
30 ~Svf() {}
+
34 void Init(float sample_rate);
+
35
+
36
+
40 void Process(float in);
+
41
+
42
+
46 void SetFreq(float f);
+
47
+
51 void SetRes(float r);
+
52
+
56 void SetDrive(float d);
+
60 inline float Low() { return out_low_; }
+
64 inline float High() { return out_high_; }
+
68 inline float Band() { return out_band_; }
+
72 inline float Notch() { return out_notch_; }
+
76 inline float Peak() { return out_peak_; }
+
77
+
78 private:
+
79 float sr_, fc_, res_, drive_, freq_, damp_;
+
80 float notch_, low_, high_, band_, peak_;
+
81 float input_;
+
82 float out_low_, out_high_, out_band_, out_peak_, out_notch_;
+
83 float pre_drive_, fc_max_;
+
84};
-
77} // namespace daisysp
-
78
-
79#endif
-
Definition delayline.h:21
-
Definition svf.h:19
-
float Band()
Definition svf.h:60
-
float Low()
Definition svf.h:52
+
85} // namespace daisysp
+
86
+
87#endif
+
Definition delayline.h:29
+
Definition svf.h:27
+
float Band()
Definition svf.h:68
+
float Low()
Definition svf.h:60
void Process(float in)
Definition svf.cpp:31
-
float Peak()
Definition svf.h:68
+
float Peak()
Definition svf.h:76
void SetRes(float r)
Definition svf.cpp:71
void Init(float sample_rate)
Definition svf.cpp:8
-
float High()
Definition svf.h:56
+
float High()
Definition svf.h:64
void SetFreq(float f)
Definition svf.cpp:58
-
float Notch()
Definition svf.h:64
+
float Notch()
Definition svf.h:72
void SetDrive(float d)
Definition svf.cpp:81
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_SYNTHBD_H
-
3#define DSY_SYNTHBD_H
-
4
-
5#include "Filters/svf.h"
-
6#include "Utility/dsp.h"
-
7
-
8#include <stdint.h>
-
9#ifdef __cplusplus
-
10
-
13namespace daisysp
-
14{
-
- -
24{
-
25 public:
- - -
28
-
32 void Init(float sample_rate);
-
33
-
37 float Process(float in);
-
38
-
39 private:
-
40 float lp_;
-
41 float hp_;
-
42 Svf filter_;
-
43};
-
-
44
-
- -
54{
-
55 public:
- - -
58
-
60 void Init();
-
61
-
63 float Process();
-
64
-
65 private:
-
66 float lp_;
-
67 float hp_;
-
68};
+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
-
- -
80{
-
81 public:
- - -
84
-
88 void Init(float sample_rate);
-
89
-
91 inline float DistortedSine(float phase, float phase_noise, float dirtiness);
+
71 float Process();
+
72
+
73 private:
+
74 float lp_;
+
75 float hp_;
+
76};
+
+
77
+
+ +
88{
+
89 public:
+ +
92
-
97 inline float TransistorVCA(float s, float gain);
-
98
-
102 float Process(bool trigger = false);
-
103
-
105 void Trig();
+
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 void SetSustain(bool sustain);
+
110 float Process(bool trigger = false);
111
-
115 void SetAccent(float accent);
-
116
-
120 void SetFreq(float freq);
-
121
-
125 void SetTone(float tone);
-
126
-
130 void SetDecay(float decay);
-
131
-
135 void SetDirtiness(float dirtiness);
-
136
-
140 void SetFmEnvelopeAmount(float fm_envelope_amount);
-
141
-
145 void SetFmEnvelopeDecay(float fm_envelope_decay);
-
146
-
147 private:
-
148 float sample_rate_;
+
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
-
150 bool trig_;
-
151 bool sustain_;
-
152 float accent_, new_f0_, tone_, decay_;
-
153 float dirtiness_, fm_envelope_amount_, fm_envelope_decay_;
+
153 void SetFmEnvelopeDecay(float fm_envelope_decay);
154
-
155 float f0_;
-
156 float phase_;
-
157 float phase_noise_;
-
158
-
159 float fm_;
-
160 float fm_lp_;
-
161 float body_env_;
-
162 float body_env_lp_;
-
163 float transient_env_;
-
164 float transient_env_lp_;
-
165
-
166 float sustain_gain_;
-
167
-
168 float tone_lp_;
-
169
- - -
172
-
173 int body_env_pulse_width_;
-
174 int fm_pulse_width_;
-
175};
+
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};
-
176
-
177} // namespace daisysp
-
178#endif
-
179#endif
-
Definition svf.h:19
-
Attack Noise generator for SyntheticBassDrum.
Definition synthbassdrum.h:54
+
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:24
+
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:80
+
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
@@ -218,7 +226,7 @@
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:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_SYNTHSD_H
-
3#define DSY_SYNTHSD_H
-
4
-
5#include "Filters/svf.h"
-
6
-
7#include <stdint.h>
-
8#ifdef __cplusplus
-
9
-
12namespace daisysp
-
13{
-
- -
27{
-
28 public:
- - -
31
-
35 void Init(float sample_rate);
-
36
-
40 float Process(bool trigger = false);
-
41
-
43 void Trig();
+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 void SetSustain(bool sustain);
+
48 float Process(bool trigger = false);
49
-
53 void SetAccent(float accent);
-
54
-
58 void SetFreq(float f0);
-
59
-
63 void SetFmAmount(float fm_amount);
-
64
-
68 void SetDecay(float decay);
-
69
-
73 void SetSnappy(float snappy);
-
74
-
75 private:
-
76 inline float DistortedSine(float phase);
+
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
-
78 float sample_rate_;
-
79
-
80 bool trig_;
-
81 bool sustain_;
-
82 float accent_, f0_, fm_amount_, decay_, snappy_;
-
83
-
84 float phase_[2];
-
85 float drum_amplitude_;
-
86 float snare_amplitude_;
-
87 float fm_;
-
88 float sustain_gain_;
-
89 int hold_counter_;
-
90
-
91 Svf drum_lp_;
-
92 Svf snare_hp_;
-
93 Svf snare_lp_;
-
94};
+
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};
-
95} // namespace daisysp
-
96#endif
-
97#endif
-
Definition svf.h:19
-
Naive snare drum model (two modulated oscillators + filtered noise).
Definition synthsnaredrum.h:27
+
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
@@ -154,7 +162,7 @@
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:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
diff --git a/tone_8h_source.html b/tone_8h_source.html deleted file mode 100644 index abc5fd2c..00000000 --- a/tone_8h_source.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - -DaisySP: Source/Filters/tone.h Source File - - - - - - - - - - - -
-
- - - - - - -
-
DaisySP -
-
-
- - - - - - - - - -
-
- - -
-
-
-
-
-
Loading...
-
Searching...
-
No Matches
-
-
-
-
- - -
-
-
tone.h
-
-
-
1#pragma once
-
2#ifndef DSY_TONE_H
-
3#define DSY_TONE_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8namespace daisysp
-
9{
-
-
12class Tone
-
13{
-
14 public:
-
15 Tone() {}
-
16 ~Tone() {}
-
20 void Init(float sample_rate);
-
21
-
22
-
26 float Process(float in);
-
27
-
-
32 inline void SetFreq(float freq)
-
33 {
-
34 freq_ = freq;
-
35 CalculateCoefficients();
-
36 }
-
-
37
-
41 inline float GetFreq() { return freq_; }
-
42
-
43 private:
-
44 void CalculateCoefficients();
-
45 float out_, prevout_, in_, freq_, c1_, c2_, sample_rate_;
-
46};
-
-
47} // namespace daisysp
-
48#endif
-
49#endif
-
Definition delayline.h:21
-
Definition tone.h:13
-
float Process(float in)
Definition tone.cpp:16
-
void Init(float sample_rate)
Definition tone.cpp:7
-
float GetFreq()
Definition tone.h:41
-
void SetFreq(float freq)
Definition tone.h:32
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
-
- - - - diff --git a/tremolo_8h_source.html b/tremolo_8h_source.html index 8d00d0d0..a410e5d9 100644 --- a/tremolo_8h_source.html +++ b/tremolo_8h_source.html @@ -83,53 +83,61 @@
tremolo.h
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_TREMOLO_H
-
3#define DSY_TREMOLO_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
8#include <math.h>
-
9#include "Synthesis/oscillator.h"
-
10
-
13namespace daisysp
-
14{
-
- +Go to the documentation of this file.
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_TREMOLO_H
+
11#define DSY_TREMOLO_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
16#include <math.h>
+
17#include "Synthesis/oscillator.h"
+
18
+
21namespace daisysp
22{
-
23 public:
-
24 Tremolo() {}
-
25 ~Tremolo() {}
-
26
-
30 void Init(float sample_rate);
-
31
-
36 float Process(float in);
-
37
-
41 void SetFreq(float freq);
-
42
-
46 void SetWaveform(int waveform);
-
47
-
51 void SetDepth(float depth);
-
52
-
53
-
54 private:
-
55 float sample_rate_, dc_os_;
-
56 Oscillator osc_;
-
57};
+
+ +
30{
+
31 public:
+
32 Tremolo() {}
+
33 ~Tremolo() {}
+
34
+
38 void Init(float sample_rate);
+
39
+
44 float Process(float in);
+
45
+
49 void SetFreq(float freq);
+
50
+
54 void SetWaveform(int waveform);
+
55
+
59 void SetDepth(float depth);
+
60
+
61
+
62 private:
+
63 float sample_rate_, dc_os_;
+
64 Oscillator osc_;
+
65};
-
58} // namespace daisysp
-
59#endif
-
60#endif
-
Definition delayline.h:21
-
Definition oscillator.h:13
-
Tremolo effect.
Definition tremolo.h:22
+
66} // namespace daisysp
+
67#endif
+
68#endif
+
Definition delayline.h:29
+
Definition oscillator.h:21
+
Tremolo effect.
Definition tremolo.h:30
void SetFreq(float freq)
Definition tremolo.cpp:21
void SetWaveform(int waveform)
Definition tremolo.cpp:26
void SetDepth(float depth)
Definition tremolo.cpp:30
void Init(float sample_rate)
Definition tremolo.cpp:6
float Process(float in)
Definition tremolo.cpp:15
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_VARISAWOSCILLATOR_H
-
3#define DSY_VARISAWOSCILLATOR_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
9namespace daisysp
-
10{
-
- -
21{
-
22 public:
- - -
25
-
26 void Init(float sample_rate);
-
27
-
29 float Process();
-
30
-
34 void SetFreq(float frequency);
+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_VARISAWOSCILLATOR_H
+
11#define DSY_VARISAWOSCILLATOR_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
17namespace daisysp
+
18{
+
+ +
29{
+
30 public:
+ + +
33
+
34 void Init(float sample_rate);
35
-
39 void SetPW(float pw);
-
40
-
44 void SetWaveshape(float waveshape);
-
45
-
46
-
47 private:
-
48 float ComputeNaiveSample(float phase,
-
49 float pw,
-
50 float slope_up,
-
51 float slope_down,
-
52 float triangle_amount,
-
53 float notch_amount);
+
37 float Process();
+
38
+
42 void SetFreq(float frequency);
+
43
+
47 void SetPW(float pw);
+
48
+
52 void SetWaveshape(float waveshape);
+
53
54
-
55 float sample_rate_;
-
56
-
57 // Oscillator state.
-
58 float phase_;
-
59 float next_sample_;
-
60 float previous_pw_;
-
61 bool high_;
+
55 private:
+
56 float ComputeNaiveSample(float phase,
+
57 float pw,
+
58 float slope_up,
+
59 float slope_down,
+
60 float triangle_amount,
+
61 float notch_amount);
62
-
63 const float kVariableSawNotchDepth = 0.2f;
+
63 float sample_rate_;
64
-
65 // For interpolation of parameters.
-
66 float frequency_;
-
67 float pw_;
-
68 float waveshape_;
-
69};
+
65 // Oscillator state.
+
66 float phase_;
+
67 float next_sample_;
+
68 float previous_pw_;
+
69 bool high_;
+
70
+
71 const float kVariableSawNotchDepth = 0.2f;
+
72
+
73 // For interpolation of parameters.
+
74 float frequency_;
+
75 float pw_;
+
76 float waveshape_;
+
77};
-
70} // namespace daisysp
-
71#endif
-
72#endif
-
Definition delayline.h:21
-
Variable Saw Oscillator.
Definition variablesawosc.h:21
+
78} // namespace daisysp
+
79#endif
+
80#endif
+
Definition delayline.h:29
+
Variable Saw Oscillator.
Definition variablesawosc.h:29
void SetPW(float pw)
Definition variablesawosc.cpp:78
float Process()
Definition variablesawosc.cpp:21
void SetWaveshape(float waveshape)
Definition variablesawosc.cpp:90
void SetFreq(float frequency)
Definition variablesawosc.cpp:70
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_VARIABLESHAPEOSCILLATOR_H
-
3#define DSY_VARIABLESHAPEOSCILLATOR_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
- -
22{
-
23 public:
- - -
26
-
30 void Init(float sample_rate);
-
31
-
34 float Process();
-
35
-
39 void SetFreq(float frequency);
-
40
-
44 void SetPW(float pw);
-
45
-
49 void SetWaveshape(float waveshape);
-
50
-
54 void SetSync(bool enable_sync);
-
55
-
59 void SetSyncFreq(float frequency);
-
60
-
61 private:
-
62 float ComputeNaiveSample(float phase,
-
63 float pw,
-
64 float slope_up,
-
65 float slope_down,
-
66 float triangle_amount,
-
67 float square_amount);
+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_VARIABLESHAPEOSCILLATOR_H
+
11#define DSY_VARIABLESHAPEOSCILLATOR_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
+ +
30{
+
31 public:
+ + +
34
+
38 void Init(float sample_rate);
+
39
+
42 float Process();
+
43
+
47 void SetFreq(float frequency);
+
48
+
52 void SetPW(float pw);
+
53
+
57 void SetWaveshape(float waveshape);
+
58
+
62 void SetSync(bool enable_sync);
+
63
+
67 void SetSyncFreq(float frequency);
68
-
69 float sample_rate_;
-
70 bool enable_sync_;
-
71
-
72 // Oscillator state.
-
73 float master_phase_;
-
74 float slave_phase_;
-
75 float next_sample_;
-
76 float previous_pw_;
-
77 bool high_;
-
78
-
79 // For interpolation of parameters.
-
80 float master_frequency_;
-
81 float slave_frequency_;
-
82 float pw_;
-
83 float waveshape_;
-
84};
+
69 private:
+
70 float ComputeNaiveSample(float phase,
+
71 float pw,
+
72 float slope_up,
+
73 float slope_down,
+
74 float triangle_amount,
+
75 float square_amount);
+
76
+
77 float sample_rate_;
+
78 bool enable_sync_;
+
79
+
80 // Oscillator state.
+
81 float master_phase_;
+
82 float slave_phase_;
+
83 float next_sample_;
+
84 float previous_pw_;
+
85 bool high_;
+
86
+
87 // For interpolation of parameters.
+
88 float master_frequency_;
+
89 float slave_frequency_;
+
90 float pw_;
+
91 float waveshape_;
+
92};
-
85} // namespace daisysp
-
86#endif
-
87#endif
-
Definition delayline.h:21
-
Variable Waveshape Oscillator.
Definition variableshapeosc.h:22
+
93} // namespace daisysp
+
94#endif
+
95#endif
+
Definition delayline.h:29
+
Variable Waveshape Oscillator.
Definition variableshapeosc.h:30
void SetWaveshape(float waveshape)
Definition variableshapeosc.cpp:150
void SetSyncFreq(float frequency)
Definition variableshapeosc.cpp:160
void SetSync(bool enable_sync)
Definition variableshapeosc.cpp:155
@@ -150,7 +158,7 @@
void Init(float sample_rate)
Definition variableshapeosc.cpp:7
void SetPW(float pw)
Definition variableshapeosc.cpp:137
void SetFreq(float frequency)
Definition variableshapeosc.cpp:130
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_VOSIM_H
-
3#define DSY_VOSIM_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
10namespace daisysp
-
11{
-
- -
22{
-
23 public:
- - -
26
-
30 void Init(float sample_rate);
-
31
-
34 float Process();
-
35
-
39 void SetFreq(float freq);
-
40
-
44 void SetForm1Freq(float freq);
-
45
-
49 void SetForm2Freq(float freq);
-
50
-
54 void SetShape(float shape);
-
55
-
56 private:
-
57 float Sine(float phase);
+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_VOSIM_H
+
11#define DSY_VOSIM_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
18namespace daisysp
+
19{
+
+ +
30{
+
31 public:
+ + +
34
+
38 void Init(float sample_rate);
+
39
+
42 float Process();
+
43
+
47 void SetFreq(float freq);
+
48
+
52 void SetForm1Freq(float freq);
+
53
+
57 void SetForm2Freq(float freq);
58
-
59 float sample_rate_;
-
60
-
61 // Oscillator state.
-
62 float carrier_phase_;
-
63 float formant_1_phase_;
-
64 float formant_2_phase_;
-
65
-
66 // For interpolation of parameters.
-
67 float carrier_frequency_;
-
68 float formant_1_frequency_;
-
69 float formant_2_frequency_;
-
70 float carrier_shape_;
-
71};
+
62 void SetShape(float shape);
+
63
+
64 private:
+
65 float Sine(float phase);
+
66
+
67 float sample_rate_;
+
68
+
69 // Oscillator state.
+
70 float carrier_phase_;
+
71 float formant_1_phase_;
+
72 float formant_2_phase_;
+
73
+
74 // For interpolation of parameters.
+
75 float carrier_frequency_;
+
76 float formant_1_frequency_;
+
77 float formant_2_frequency_;
+
78 float carrier_shape_;
+
79};
-
72} // namespace daisysp
-
73#endif
-
74#endif
-
Definition delayline.h:21
-
Vosim Oscillator Module .
Definition vosim.h:22
+
80} // namespace daisysp
+
81#endif
+
82#endif
+
Definition delayline.h:29
+
Vosim Oscillator Module .
Definition vosim.h:30
void SetForm1Freq(float freq)
Definition vosim.cpp:59
void SetShape(float shape)
Definition vosim.cpp:73
float Process()
Definition vosim.cpp:21
void SetForm2Freq(float freq)
Definition vosim.cpp:66
void SetFreq(float freq)
Definition vosim.cpp:53
void Init(float sample_rate)
Definition vosim.cpp:7
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_WAVEFOFOLDER_H
-
3#define DSY_WAVEFOFOLDER_H
-
4
-
5#include <stdint.h>
-
6#include "Utility/dcblock.h"
-
7#ifdef __cplusplus
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp, Nick Donaldson
+
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
-
9namespace daisysp
-
10{
-
- -
20{
-
21 public:
-
22 Wavefolder() {}
-
23 ~Wavefolder() {}
-
26 void Init();
-
29 float Process(float in);
-
34 inline void SetGain(float gain) { gain_ = gain; }
-
38 inline void SetOffset(float offset) { offset_ = offset; }
-
39
-
40 private:
-
41 float gain_, offset_;
-
42};
+
9#pragma once
+
10#ifndef DSY_WAVEFOFOLDER_H
+
11#define DSY_WAVEFOFOLDER_H
+
12
+
13#include <stdint.h>
+
14#include "Utility/dcblock.h"
+
15#ifdef __cplusplus
+
16
+
17namespace daisysp
+
18{
+
+ +
28{
+
29 public:
+
30 Wavefolder() {}
+
31 ~Wavefolder() {}
+
34 void Init();
+
37 float Process(float in);
+
42 inline void SetGain(float gain) { gain_ = gain; }
+
46 inline void SetOffset(float offset) { offset_ = offset; }
+
47
+
48 private:
+
49 float gain_, offset_;
+
50};
-
43} // namespace daisysp
-
44#endif
-
45#endif
-
Definition delayline.h:21
-
Definition wavefolder.h:20
-
void SetGain(float gain)
Definition wavefolder.h:34
+
51} // namespace daisysp
+
52#endif
+
53#endif
+
Definition delayline.h:29
+
Definition wavefolder.h:28
+
void SetGain(float gain)
Definition wavefolder.h:42
void Init()
Definition wavefolder.cpp:6
-
void SetOffset(float offset)
Definition wavefolder.h:38
+
void SetOffset(float offset)
Definition wavefolder.h:46
float Process(float in)
Definition wavefolder.cpp:12
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-
1#pragma once
-
2#ifndef DSY_WHITENOISE_H
-
3#define DSY_WHITENOISE_H
-
4#include <stdint.h>
-
5#ifdef __cplusplus
-
6namespace daisysp
-
7{
-
- -
13{
-
14 public:
-
15 WhiteNoise() {}
-
16 ~WhiteNoise() {}
-
-
19 void Init()
-
20 {
-
21 amp_ = 1.0f;
-
22 randseed_ = 1;
-
23 }
+
1/*
+
2Copyright (c) 2020 Electrosmith, Corp
+
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_WHITENOISE_H
+
11#define DSY_WHITENOISE_H
+
12#include <stdint.h>
+
13#ifdef __cplusplus
+
14namespace daisysp
+
15{
+
+ +
21{
+
22 public:
+
23 WhiteNoise() {}
+
24 ~WhiteNoise() {}
+
+
27 void Init()
+
28 {
+
29 amp_ = 1.0f;
+
30 randseed_ = 1;
+
31 }
-
24
-
27 inline void SetAmp(float a) { amp_ = a; }
-
-
30 inline float Process()
-
31 {
-
32 randseed_ *= 16807;
-
33 return (randseed_ * coeff_) * amp_;
-
34 }
+
32
+
35 inline void SetAmp(float a) { amp_ = a; }
+
+
38 inline float Process()
+
39 {
+
40 randseed_ *= 16807;
+
41 return (randseed_ * coeff_) * amp_;
+
42 }
-
35
-
37 inline void SetSeed(int32_t s) { randseed_ = s == 0 ? 1 : s; }
-
38
-
39 private:
-
40 static constexpr float coeff_ = 4.6566129e-010f;
-
41 float amp_;
-
42 int32_t randseed_;
-
43};
+
43
+
45 inline void SetSeed(int32_t s) { randseed_ = s == 0 ? 1 : s; }
+
46
+
47 private:
+
48 static constexpr float coeff_ = 4.6566129e-010f;
+
49 float amp_;
+
50 int32_t randseed_;
+
51};
-
44} // namespace daisysp
-
45#endif
-
46#endif
-
Definition delayline.h:21
-
Definition whitenoise.h:13
-
void Init()
Definition whitenoise.h:19
-
void SetSeed(int32_t s)
Definition whitenoise.h:37
-
float Process()
Definition whitenoise.h:30
-
void SetAmp(float a)
Definition whitenoise.h:27
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
52} // namespace daisysp
+
53#endif
+
54#endif
+
Definition delayline.h:29
+
Definition whitenoise.h:21
+
void Init()
Definition whitenoise.h:27
+
void SetSeed(int32_t s)
Definition whitenoise.h:45
+
float Process()
Definition whitenoise.h:38
+
void SetAmp(float a)
Definition whitenoise.h:35
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16
-Go to the documentation of this file.
1#pragma once
-
2#ifndef DSY_ZOSCILLATOR_H
-
3#define DSY_ZOSCILLATOR_H
-
4
-
5#include <stdint.h>
-
6#ifdef __cplusplus
-
7
-
9namespace daisysp
-
10{
-
- -
21{
-
22 public:
-
23 ZOscillator() {}
-
24 ~ZOscillator() {}
-
25
-
29 void Init(float sample_rate);
-
30
-
33 float Process();
-
34
-
38 void SetFreq(float freq);
-
39
-
43 void SetFormantFreq(float freq);
-
44
-
48 void SetShape(float shape);
-
49
-
54 void SetMode(float mode);
-
55
-
56 private:
-
57 inline float Sine(float phase);
-
58 inline float Z(float c, float d, float f, float shape, float mode);
-
59
-
60 float sample_rate_;
-
61
-
62 // Oscillator state.
-
63 float carrier_phase_;
-
64 float discontinuity_phase_;
-
65 float formant_phase_;
-
66 float next_sample_;
+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_ZOSCILLATOR_H
+
11#define DSY_ZOSCILLATOR_H
+
12
+
13#include <stdint.h>
+
14#ifdef __cplusplus
+
15
+
17namespace daisysp
+
18{
+
+ +
29{
+
30 public:
+
31 ZOscillator() {}
+
32 ~ZOscillator() {}
+
33
+
37 void Init(float sample_rate);
+
38
+
41 float Process();
+
42
+
46 void SetFreq(float freq);
+
47
+
51 void SetFormantFreq(float freq);
+
52
+
56 void SetShape(float shape);
+
57
+
62 void SetMode(float mode);
+
63
+
64 private:
+
65 inline float Sine(float phase);
+
66 inline float Z(float c, float d, float f, float shape, float mode);
67
-
68 // For interpolation of parameters.
-
69 float carrier_frequency_;
-
70 float formant_frequency_;
-
71 float carrier_shape_, shape_new_;
-
72 float mode_, mode_new_;
-
73};
+
68 float sample_rate_;
+
69
+
70 // Oscillator state.
+
71 float carrier_phase_;
+
72 float discontinuity_phase_;
+
73 float formant_phase_;
+
74 float next_sample_;
+
75
+
76 // For interpolation of parameters.
+
77 float carrier_frequency_;
+
78 float formant_frequency_;
+
79 float carrier_shape_, shape_new_;
+
80 float mode_, mode_new_;
+
81};
-
74} // namespace daisysp
-
75#endif
-
76#endif
-
Definition delayline.h:21
-
ZOscillator Module .
Definition zoscillator.h:21
+
82} // namespace daisysp
+
83#endif
+
84#endif
+
Definition delayline.h:29
+
ZOscillator Module .
Definition zoscillator.h:29
void SetFreq(float freq)
Definition zoscillator.cpp:97
void SetFormantFreq(float freq)
Definition zoscillator.cpp:104
void SetShape(float shape)
Definition zoscillator.cpp:111
void SetMode(float mode)
Definition zoscillator.cpp:116
void Init(float sample_rate)
Definition zoscillator.cpp:7
float Process()
Definition zoscillator.cpp:22
-
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:8
+
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16