File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ v22.2
2+ -----
3+ * Added NoiseOscillator (whitenoise s+h)
14* Added PhaseShiftOscillator template
25* Added Biquad allpass filter configuration
36* Fixed Antialiased oscillators (Triangle, SquareWave, Ramp)
Original file line number Diff line number Diff line change 11#ifndef NOISE_OSCILLATOR_HPP
22#define NOISE_OSCILLATOR_HPP
33
4- #include "NoiseGenerator .h"
4+ #include " Oscillator .h"
55
6- #warning "NoiseOscillator.h is deprecated, use NoiseGenerator.h instead"
7-
8- typedef WhiteNoiseGenerator WhiteNoiseOscillator ;
9- typedef PinkNoiseGenerator PinkNoiseOscillator ;
10- typedef BrownNoiseGenerator BrownNoiseOscillator ;
11- typedef GaussianNoiseGenerator GaussianNoiseOscillator ;
6+ /* *
7+ * The NoiseOscillator generates random values in the range [-1, 1] at
8+ * a given frequency.
9+ * It behaves like a white noise generator going into a sample and hold.
10+ */
11+ class NoiseOscillator : public OscillatorTemplate <NoiseOscillator> {
12+ protected:
13+ float sample = 0 ;
14+ public:
15+ static constexpr float begin_phase = 0 ;
16+ static constexpr float end_phase = 1 ;
17+ NoiseOscillator (){}
18+ NoiseOscillator (float sr){
19+ setSampleRate (sr);
20+ }
21+ float getSample (){
22+ return sample;
23+ }
24+ float generate () {
25+ phase += incr;
26+ if (phase >= 1 ){
27+ sample = randf ()*2 - 1 ;
28+ phase -= 1 ;
29+ }
30+ return sample;
31+ }
32+ using OscillatorTemplate<NoiseOscillator>::generate;
33+ void reset (){
34+ sample = randf ()*2 - 1 ;
35+ phase = 0 ;
36+ }
37+ using SignalGenerator::generate;
38+ };
1239
1340#endif /* NOISE_OSCILLATOR_HPP */
Original file line number Diff line number Diff line change 3333#include "MorphingOscillator.h"
3434#include "MonophonicProcessor.h"
3535#include "NoiseGenerator.h"
36+ #include "NoiseOscillator.h"
3637#include "OpenWareMidiControl.h"
3738#include "Oscillator.h"
3839#include "Patch.h"
You can’t perform that action at this time.
0 commit comments