Voice record in multiplayer during gameplay. Saving it in a binary and playing the audio back gives garbage sound play
My aim is to record player voices when record gameplay is initiated. I wish to save the recorded voice as a binary file, and replay it back. I have used https://answers.unrealengine.com/questions/347976/basic-microphone-input-with-ue4.html tutorial to play the recorded audio. Works fine.
The above function is being called on every tick. Works fine!
Next I tried to save the recorded audio in binary format and retrieve the data back using this tutorial https://wiki.unrealengine.com/Save_System,_Read_%26_Write_Any_Data_to_Compressed_Binary_Files I get the same data which I saved. But when I queue the sound and play it, garage sound plays.
all the above is happening in a single function which is called once.
Is there any other approach to do the same. Also let me know if anyone can find my mistake here.
asked Dec 28 '17 at 06:48 AM in C++ Programming
Every tick you are overwriting VoiceCaptureBuffer, so at most you are only saving one ticks worth of data. Instead you should be adding to the end of VoiceCaptureBuffer.
This explains the garbage sound. Var is actually very short but you're loading 2000 times as much random memory data into the queue. This should just be sizeof(uint8) * Var.Num().
This works! :) The trick is to append the data to a new array and save it properly. also you need to reduce the increase the microphone boost in your recording settings, because unreal chops the sound below a certain level.
answered Feb 28 '18 at 02:45 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here