Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to decompress SoundWave?

Hi, I'm trying to decompress a SoundWave to access raw PCM data.

I've been trying like this, at BeginPlay():

 if (MusicWave != nullptr) {
     //    MusicWave->AudioDecompressor->StartSynchronousTask();
         UE_LOG(LogMyActor, Log, TEXT("RAW PCM DATA SIZE %d"), MusicWave->RawPCMDataSize);

Starting a sync task crashed the UE editor immediately when hitting Play, so I tried it in the background and wait, but yielded the same crash.

Product Version: UE 4.21
more ▼

asked Jan 17 '19 at 12:49 PM in C++ Programming

avatar image

6 2 2

avatar image sandorvasas Jan 17 '19 at 12:52 PM

I've managed to access some raw data as follows:

 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"));

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).

avatar image sandorvasas Jan 17 '19 at 08:11 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question