const uint8* data = (const uint8*)MusicWave->RawData.Lock(LOCK_READ_ONLY);
if (data != nullptr) {
FString str;
for (int32 i = 0; i < MusicWave->RawData.GetBulkDataSize(); ++i) {
char buf[8];
sprintf(buf, " %d", data[i]);
str += (const char*)buf;
}
UE_LOG(LogMyActor, Log, TEXT("str %s"), str.GetCharArray().GetData());
}
else {
UE_LOG(LogMyActor, Log, TEXT("data is nullptr"));
}
MusicWave->RawData.Unlock();
However I’m not sure if this is the raw sound data which is ready to be processed (e.g. to which I can apply FFT to), or it’s the raw bytes of the sound file (including WAV metadata).
I would also be very happy if someone could point out how it’s possible to create such an UPROPERTY to which I can assign any kind of file (.wav in this case) as a buffer. From then on it would be a simple .wav file parsing to get the PCM data and apply FFT to extract the spectrum.
6 years later im struggling with this…
Im using AudioMixerDevice, in my level I have an actor and its USynthComponent decompress the audio, but couldnt get an audio data in PIE.
I would be really happy if someone done this and could help
You could consider using Runtime Audio Importer, specifically its pre-import audio feature, which allows direct access to PCM data at any time: Pre-import audio | Georgy Dev Docs