DaisySP
Loading...
Searching...
No Matches
whitenoise.h
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 }
32
35 inline void SetAmp(float a) { amp_ = a; }
38 inline float Process()
39 {
40 randseed_ *= 16807;
41 return (randseed_ * coeff_) * amp_;
42 }
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};
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