Skip to content

AudioEffectSpectrumAnalyzerInstance.get_magnitude_for_frequency_range reports jittered values #67650

@Zylann

Description

@Zylann

Godot version

3.5 stable
4.0 beta3
4.4.1 stable

System information

Windows 10 64 bits NVIDIA GeForce GTX 1060

Issue description

I started playing with rendering a spectrum, and even after some smoothing and peaking, noticed it was kinda low quality. Then I noticed that the reported frequencies were actually jittering along the frequency axis.

It happens for all FFT sizes, but can be mistaken for a "normal precision issue" with the default 1024. It is a lot more obvious with larger FFT sizes and a chirp sound. The frequency peak "wiggles" constantly around the frequency it is supposed to be "following".

2022-10-19.22-58-06.mp4

After seeing this, it becomes clear other FFT sizes also have this problem, but around a shorter width.
It seems the issue is temporal: reported values alternate between some time close to now and some time in the past. To the point when the chirp restarts, we can see values from the previous chirp still flicker back and forth for a brief moment.

Such discrepancy is not expected. It really looks like something is wrong in the way values are reported. Maybe the data from the ringbuffer is read in the wrong way?

Steps to reproduce

Test project:

3.5:
AudioAnalyzerFFTBug.zip
4.0 beta3:
AudioAnalyzerFFTBug_GD4.zip

Minimal reproduction project

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions