DaisySP
Loading...
Searching...
No Matches
grainlet.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_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 Init(float sample_rate);
40
42 float Process();
43
47 void SetFreq(float freq);
48
52 void SetFormantFreq(float freq);
53
57 void SetShape(float shape);
58
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};
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:16