HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: TF3RDL on 2023-05-27 10:22:08

Title: Questions about visualization streams
Post by: TF3RDL on 2023-05-27 10:22:08
I have a question regarding visualization streams, especially with get_chunk_absolute(), since the sliding DFT only works if the audio data is fed into the algorithm properly (new data since last calculation)

Does get_chunk_absolute() have requested_length/2 offset ahead actual playback, or perhaps full samples offset ahead of it?
Title: Re: Questions about visualization streams
Post by: TF3RDL on 2023-06-29 10:58:33
Apologies if my question sounds stupid. By looking at the specified line of unrelated component (foo_r128meter) (https://github.com/stengerh/foo_r128meter/blob/master/foo_r128meter/foo_r128meter.cpp#L241), it seems like the offset from actual playback (time of the latest sample from visualization streams vs the actual playback time in samples) is proportional to the requested length (not half of it contrary to oscilloscope visualization) right?

Especially when comes to something like an analog-style spectrum analyzer (By analog-style, I meant it doesn't use FFT, and instead it uses banks of IIR filters) inside foobar2000 (which doesn't exist yet besides VST plugins, which is out-of-scope for this topic), and when either the buffer alignment is wrong or the size of current visualization chunk is different from time difference between current and previous calculations in samples, it produces garbage results (where the frequency spectrum starts to look like spectrum of audio with clicking/popping caused by buffer underruns) as said in the comment of my non-realtime spectrogram sketch (https://editor.p5js.org/jayadiandri/sketches/GyKsfn8JO) code (apologies if my sketch is completely unrelated to fb2k at all) when using either SWIFT or standard Sb-sDFT. So you need to have both correct alignment and buffer size (equal to time difference between current and previous like I said) to only cover newest samples since previous calculations in order to correctly visualize sliding DFT algorithm.
Title: Re: Questions about visualization streams
Post by: TF3RDL on 2023-10-22 03:57:01
Another questions especially when comes to developing a Mid/Side spectrum visualization component:

Since I have no idea on how get_spectrum_absolute works beyond the fact it provides FFT data because I haven't used foobar2000 SDK yet (also, I can't find the information whether or not the get_spectrum_absolute() function returns complex FFT data) and I'm used to develop WebAudio visualizations like this (https://codepen.io/TF3RDL/pen/poQJwRW) that involves custom FFT implementation (this should also apply to fb2k component development as well as I think the enhanced spectrum analyzer already use custom FFT right?)

BTW, I've attached the audio-only .webm file (sure, foobar2000 can load webm files, except audio-only) of some sort of test tone thing that contains left-only, right-only, in-phase, and out-of-phase segments.