DaisySP
Loading...
Searching...
No Matches
zoscillator.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_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 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};
82} // namespace daisysp
83#endif
84#endif
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:16