How to load an audio file from a external folder in runtime?

I’m trying to access a wav file in runtime and play it from an external folder. I can’t import it as an asset in the editor because the file is being generated by an external program in another folder.

I’ve tried using the StaticLoadObject function but it always searchs inside the content folder and ignores an absolute path.

I’ve checked VictoryPlugin but the function it provides for loading objects in runtime only applies to the content folder too.

In all the forums I have checked people refer to VictoryPlugin or there are no answers to the questions other people have asked, but there must be a way of accessing external folders from C++ code, because I’m able to load a JSON file with LoadFileToString and create a process with CreateProc, but can’t find a way to load an audio file.

I am not sure this will work in your case but try IFileManager. I use it to read and write raw data:

.h
    FString Path;
    FString Filename;
    FString Fullpath;

.cpp
    Path = FPaths::ProjectSavedDir();
    Filename = "GameData.bin";
    Fullpath = Path + Filename;

    FArchive* outFile = IFileManager::Get().CreateFileReader(*Fullpath);

The header defines a few useful functions:

class CORE_API IFileManager
{
	static IFileManager& Get();
	virtual FArchive* CreateFileReader( const TCHAR* Filename, uint32 ReadFlags=0 )=0;
	virtual FArchive* CreateFileWriter( const TCHAR* Filename, uint32 WriteFlags=0 )=0;
	 :
}