gtreshchev / RuntimeAudioImporter

Runtime Audio Importer plugin for Unreal Engine. Importing audio of various formats at runtime.
MIT License
308 stars 67 forks source link

create capturable sound wave is a multi-threaded process execution? The moment I pressed the on trigger microphone to record audio while the character was walking, I felt it affect the main thread. It's going to stall. #37

Closed Lemondogdog closed 1 year ago

Lemondogdog commented 1 year ago

create capturable sound wave is a multi-threaded process execution? The moment I pressed the on trigger microphone to record audio while the character was walking, I felt it affect the main thread. It's going to stall. My blueprint nodes are as follows: 2023-04-04 135757

Lemondogdog commented 1 year ago

I seem to know that every time I create a new capturable sound wave variable, there will be a pause for a few tenths of a second, just a second.

gtreshchev commented 1 year ago

There is an issue on the engine side that every time you call StartCapture, it has a small freeze. This issue is most likely not in the thread (I checked and moved all the logic to a background thread, but the issue remained), but in something on the capture implementation side, for example, on the RtAudio side in the case of Windows, although I'm not 100% sure. Exactly the same problem exists in the built-in capture solution in the engine, just to mention.

As a workaround, I can advise using the ToggleMute function instead of re-creating the capturable sound wave and enabling capturing, this is written here: https://github.com/gtreshchev/RuntimeAudioImporter/wiki/Capturable-sound-wave

Lemondogdog commented 1 year ago

There is an issue on the engine side that every time you call StartCapture, it has a small freeze. This issue is most likely not in the thread (I checked and moved all the logic to a background thread, but the issue remained), but in something on the capture implementation side, for example, on the RtAudio side in the case of Windows, although I'm not 100% sure. Exactly the same problem exists in the built-in capture solution in the engine, just to mention.

As a workaround, I can advise using the ToggleMute function instead of re-creating the capturable sound wave and enabling capturing, this is written here: https://github.com/gtreshchev/RuntimeAudioImporter/wiki/Capturable-sound-wave

This method can subside the stuttering phenomenon, but it seems that the audio information of the recording is not refresher each time, but always superimposed on the previous recording. There should be a way to refresh each recording with a different audio