LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_siggen_impl.h
Go to the documentation of this file.
1#pragma once
2#include "lasp_siggen.h"
3#include "lasp_types.h"
17class Noise : public Siggen {
18 d level_linear;
19 virtual vd genSignalUnscaled(const us nframes) override;
20 void resetImpl() override;
21 public:
22
29 Noise();
30 ~Noise() = default;
31
32};
33
37class Sine : public Siggen {
38 d phase = 0;
39 d omg;
40 protected:
41
42 void resetImpl() override final { phase=0; }
43 virtual vd genSignalUnscaled(const us nframes) override final;
44
45 public:
46
52 Sine(const d freq_Hz);
53 ~Sine() = default;
54 void setFreq(const d newFreq) { omg = 2*arma::datum::pi*newFreq; } ;
55};
56
62class Periodic: public Siggen {
63 protected:
64 vd _signal { 1, arma::fill::zeros};
66 public:
72 vd getSequence() const { return _signal; }
73
74 virtual vd genSignalUnscaled(const us nframes) override final;
75 ~Periodic() = default;
76
77};
78
82class Sweep : public Periodic {
83 d fl_, fu_, Ts, Tq;
84 us index;
85 us flags;
86
87 void resetImpl() override;
88
89 public:
90
91 static constexpr int ForwardSweep = 1 << 0;
92 static constexpr int BackwardSweep = 1 << 1;
93 static constexpr int LinearSweep = 1 << 2;
94 static constexpr int LogSweep = 1 << 3;
95
106 Sweep(const d fl, const d fu, const d Ts, const d Tq,
107 const us sweep_flags);
108
109 ~Sweep() = default;
110
111};
Generate a random signal (noise)
~Noise()=default
Noise()
Constructs a noise generator. If no filter is used, the output will be white noise....
Base class for all periodic signals (that are exactly periodic based on the sampling frequency)....
~Periodic()=default
vd getSequence() const
Return copy of the generated sequence.
virtual vd genSignalUnscaled(const us nframes) override final
Signal generation abstract base class. Implementation is required for resetImpl(),...
Definition lasp_siggen.h:23
Generate a sine wave.
~Sine()=default
void setFreq(const d newFreq)
void resetImpl() override final
virtual vd genSignalUnscaled(const us nframes) override final
Sweep signal.
static constexpr int BackwardSweep
static constexpr int LogSweep
~Sweep()=default
static constexpr int LinearSweep
static constexpr int ForwardSweep
arma::Col< d > vd
size_t us
We often use boolean values.
Definition lasp_types.h:29