How to save a USoundWave recording permanently?

I’m recording audio in game using the ‘start recording audio’ function, and later need to call back that audio in game. It all works fine, I can recall the audio in game as needed and the sound file appears in the content folder, however it disappears every time I close the engine. Is there some way to save it permanently?

I should add that I have saved it as a variable then serialized and saved that variable to a save file, but the sound itself is gone when it opens again. It goes directly into the top level Content folder on creation, I can see it and play it in the content browser as well as triggering it from the variable in game. But then it’s gone when I close the engine and open it again. The variable is saved but the asset itself is no longer there.

If I export as a wav file then it saves permanently at the desired location, but the issue then is that I can’t save it as a variable to recall in game. As far as I can tell there is nothing you can do at runtime with a wav file which hasn’t been imported manually as a USoundWave in the editor? Correct me if I’m wrong.

I’ve found a plugin called Runtime Audio Importer which I may be able to use as a workaround to generate a wav then re-import it, so I’ll update how that went when I get a chance to try it later. However I would prefer if there was some way I could just keep the USoundWave file I have already created.

OK so just to update, I have reworked the system by exporting a wav then using the Runtime Audio Importer to reimport the file and rewrite the variables each new session. There are a few problems, these are quirks of the plugin itself which I don’t think will be resolved, so it looks like this will not be a viable solution and I’m back to square one. Any help or advice would be much appreciated thanks.

In case anyone is interested I never found a way to do this in either blueprints or C++. The method I ended up using was rather than recording to a SoundWave I recorded to a .wav file, saved the filename to an array, and made a custom node to convert the .wav file to a USoundWave. So you can then pull up the filename and convert it to a USoundWave as needed. This has to be done each session but in the end it works fine.

This thread was helpful for me in making the conversion node if someone wants to do something similar:

@NickNickNickTom Hey I was wondering if you were able to solve this issue. What I am doing is basically getting the raw audio data from an api service and importing it using the Runtime Audio Importer plugin. After importing it, instead of saving it as .wav or using it right away, I want to save it as a UASSET. Let me know if you have any ideas of how I can do it.

Hey there, as I said above I ended up making a custom node in C++ to convert a wav file. Instead of saving the actual USoundWave I save wav files and save the filenames as strings. Then every game session it goes through the list of wav files and converts them to USounds.

This worked well for me because I also need to import wav files so I can just use the same system for both, there could potentially be a way to save a new USoundWave directly with C++ but I didn’t look into it.

If you like I can share the code for the conversion blueprint I made, but as I said it will still not allow you to save a USoundWave permanently.