UAudioComponent::GetCookedFFTData
#include "Components/AudioComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Retrieves cooked spectral (FFT) data at the current playback time for the requested frequencies. If multiple sound waves are playing on this component, the data is averaged and interpolated across all of them.
Caveats & Gotchas
- • Returns false, leaving OutSoundWaveSpectralData empty or stale, if the component isn't playing or the playing sound has no cooked FFT data — check HasCookedFFTData() first.
- • Because results are averaged across all currently-playing sound waves on the component, per-sound spectral detail is lost when multiple sounds overlap — use GetCookedFFTDataForAllPlayingSounds() if you need per-sound breakdowns.
- • Requesting a frequency not present in the cooked data returns interpolated values, not an error, so garbage-in frequencies (e.g. negative or absurdly high) can silently produce meaningless results.
Signature
bool GetCookedFFTData(const TArray<float>& FrequenciesToGet, TArray<FSoundWaveSpectralData>& OutSoundWaveSpectralData) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| FrequenciesToGet | const TArray<float>& | The list of frequencies, in Hz, to sample spectral magnitude/phase data for. | — |
| OutSoundWaveSpectralData | TArray<FSoundWaveSpectralData>& | Receives one entry per requested frequency with the interpolated spectral data at the current playback time. | — |
Return Type
bool Example
Sample spectral data for a visualizer C++
TArray<float> Frequencies = { 100.0f, 500.0f, 2000.0f, 8000.0f };
TArray<FSoundWaveSpectralData> SpectralData;
if (AudioComponent->GetCookedFFTData(Frequencies, SpectralData))
{
UpdateSpectrumBars(SpectralData);
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?