Spectrum Visualizer: Fix frequency range, bands

Reduce the virtual resolution to match the actual resolution, and set
the analyzere frequency to Nyquist of the audio input, as it seems to
behave as if the entire range of the input FFT bands are up to the
specified frequency, rather than half of it. Otherwise, we lose half of
the frequency range provided by the input data.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
CQTexperiment
Christopher Snowhill 2022-02-14 21:10:57 -08:00
parent 934589ebdd
commit 52443066e7
1 changed files with 2 additions and 2 deletions

View File

@ -66,7 +66,7 @@ extern NSString *CogPlaybackDidStopNotficiation;
ddb_analyzer_init(&_analyzer);
_analyzer.db_lower_bound = LOWER_BOUND;
_analyzer.peak_hold = 10;
_analyzer.view_width = 1000;
_analyzer.view_width = 64;
_analyzer.fractional_bars = 1;
_analyzer.octave_bars_step = 2;
_analyzer.max_of_stereo_data = 1;
@ -247,7 +247,7 @@ extern NSString *CogPlaybackDidStopNotficiation;
[self->visController copyVisPCM:&visAudio[0] visFFT:&visFFT[0]];
ddb_analyzer_process(&_analyzer, [self->visController readSampleRate], 1, visFFT, 4096);
ddb_analyzer_process(&_analyzer, [self->visController readSampleRate] / 2.0, 1, visFFT, 4096);
ddb_analyzer_tick(&_analyzer);
ddb_analyzer_get_draw_data(&_analyzer, self.bounds.size.width, self.bounds.size.height, &_draw_data);