EchoMap
2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Toggle main menu visibility
Loading...
Searching...
No Matches
FrequencySpectrum.hpp
Go to the documentation of this file.
1
9
10
#ifndef ECHOMAP_FREQUENCYSPECTRUM_HPP
11
#define ECHOMAP_FREQUENCYSPECTRUM_HPP
12
13
#include <
vector
>
14
15
#include "
Object.hpp
"
16
#include "
factories/WindowFunctions.hpp
"
17
18
namespace
echomap
19
{
20
21
class
FrequencySpectrumFactory
;
22
26
class
FrequencySpectrum :
public
Object<FrequencySpectrum>
27
{
28
public
:
33
struct
Bin
34
{
35
float
frequency
;
36
float
magnitude
;
37
float
phase
;
38
};
39
40
private
:
41
std::vector<Bin>
bins;
42
43
public
:
44
[[nodiscard]]
decltype
(bins)::const_iterator begin()
const
;
45
[[nodiscard]]
decltype
(bins)::const_iterator end()
const
;
46
[[nodiscard]]
decltype
(bins)::const_iterator cbegin()
const
noexcept
;
47
[[nodiscard]]
decltype
(bins)::const_iterator cend()
const
noexcept
;
48
49
[[nodiscard]]
std::size_t
get_bin_count() const noexcept;
50
51
[[nodiscard]]
float
get_minimum_frequency() const noexcept;
52
[[nodiscard]]
float
get_maximum_frequency() const noexcept;
53
[[nodiscard]]
float
get_minimum_magnitude() const noexcept;
54
[[nodiscard]]
float
get_maximum_magnitude() const noexcept;
55
56
const
WindowFunctions
::AllFunctions& observe_preprocessor() const noexcept;
57
58
private:
59
friend FrequencySpectrumFactory;
60
61
explicit FrequencySpectrum(
62
WindowFunctions
::AllFunctions preprocessor,
63
std
::string_view
name
64
);
65
66
void
reserve_bins(
std
::
size_t
bin_count);
67
68
void
emplace_bin(
69
float
frequency,
70
float
magnitude,
71
float
phase
72
);
73
74
WindowFunctions
::AllFunctions preprocessor;
75
76
float
minimum_frequency =
std
::numeric_limits<
float
>::max();
77
float
maximum_frequency =
std
::numeric_limits<
float
>::min();
78
float
minimum_magnitude =
std
::numeric_limits<
float
>::max();
79
float
maximum_magnitude =
std
::numeric_limits<
float
>::min();
80
};
81
82
template <> constexpr
std
::string_view Object<FrequencySpectrum>::
class_name
=
"FreqSpec"
;
83
84
}
// namespace echomap
85
86
#endif
// ECHOMAP_FREQUENCYSPECTRUM_HPP
Object.hpp
Object specification.
WindowFunctions.hpp
WindowFunctions specification.
echomap::FrequencySpectrumFactory
Provides a static helper to perform discrete Fourier transforms on Signal objects to produce frequenc...
Definition
FrequencySpectrumFactory.hpp:28
echomap::Object< FrequencySpectrum >::name
std::string name
Definition
Object.hpp:239
echomap::Object< FrequencySpectrum >::class_name
static constexpr std::string_view class_name
Definition
Object.hpp:235
echomap::WindowFunctions
Aggregation of callable DSP window functions.
Definition
WindowFunctions.hpp:33
echomap
The main EchoMap outermost namespace for all non-exported symbols.
Definition
ActionController.hpp:20
std
STL namespace.
std::size_t
echomap::FrequencySpectrum::Bin
A bin within the spectrum, denoting the magnitude (and optionally, complex phase) of a Signal at a gi...
Definition
FrequencySpectrum.hpp:34
echomap::FrequencySpectrum::Bin::magnitude
float magnitude
The magnitude of the frequency, in dBfs (decibels relative to full scale).
Definition
FrequencySpectrum.hpp:36
echomap::FrequencySpectrum::Bin::phase
float phase
The complex phase of the DFT value, in radians.
Definition
FrequencySpectrum.hpp:37
echomap::FrequencySpectrum::Bin::frequency
float frequency
The frequency quantised by the Bin, in Hz.
Definition
FrequencySpectrum.hpp:35
vector
src
objects
FrequencySpectrum.hpp
Generated by
1.17.0