Skip to content

Commit

Permalink
Added +12 dB compensation on measurement of the spectrum to match the…
Browse files Browse the repository at this point in the history
… amplitude of the pure sine wave on the graph
  • Loading branch information
sadko4u committed Sep 12, 2024
1 parent 5665724 commit e143ee0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*******************************************************************************

=== 1.0.27 ===

* Added +12 dB compensation on measurement of the spectrum to match the amplitude
of the pure sine wave on the graph.

=== 1.0.26 ===
* Updated build scripts and dependencies.
Expand Down
3 changes: 2 additions & 1 deletion include/private/meta/spectrum_analyzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ namespace lsp

static constexpr float THRESH_HI_DB = 0.0f;
static constexpr float THRESH_LO_DB = -48.0f;
static constexpr float SPECTRALIZER_BOOST = 16.0f;
static constexpr float SPECTRALIZER_BOOST = GAIN_AMP_P_24_DB;
static constexpr float ANALYZER_BOOST = GAIN_AMP_P_12_DB;
static constexpr size_t MMESH_STEP = 16;
static constexpr size_t WND_DFL = dspu::windows::HANN;
static constexpr size_t ENV_DFL = dspu::envelope::PINK_NOISE;
Expand Down
6 changes: 3 additions & 3 deletions src/main/plug/spectrum_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ namespace lsp
// Apply gain
float gain = (flags & F_BOOST) ?
vChannels[channel].fGain * meta::spectrum_analyzer::SPECTRALIZER_BOOST:
vChannels[channel].fGain ;
vChannels[channel].fGain * meta::spectrum_analyzer::ANALYZER_BOOST;
dsp::mul_k2(dst, gain * fPreamp, meta::spectrum_analyzer::MESH_POINTS);

// Apply log scale if necessary
Expand Down Expand Up @@ -926,8 +926,8 @@ namespace lsp
{
size_t idx = fSelector * ((fft_size - 1) >> 1);
pFrequency->set_value(float(idx * fSampleRate) / float(fft_size));
float lvl = sAnalyzer.get_level(nChannel, idx);
pLevel->set_value(lvl * c->fGain * fPreamp );
float lvl = sAnalyzer.get_level(nChannel, idx) * meta::spectrum_analyzer::ANALYZER_BOOST;
pLevel->set_value(lvl * c->fGain * fPreamp);
}

// Mesh is requested?
Expand Down

0 comments on commit e143ee0

Please sign in to comment.