Answered
0
0

Hi everyone,

I’m using FMOD to create a custom voice chat system for UE4, and part of this is encoding and transfering the sound data over the network. So far, I’ve studied the low-level examples of FMOD and I’m successfully recording data into a stream.
I’m not too savvy when it comes to audio data and codecs, so I hope someone can point me in the right direction doing the following things:

1.
Like in record.cpp, I’m recording the mic’s sound into a FMOD::Sound. I wish to encode this data using the Opus codec. UE4’s opus encoder initializes by passing it a sample rate and the number of channels, both of which are known from the recording device. For the encoding itself it needs:

const uint8* RawPCMData

Is this what I get from FMOD::Sound::readData? How do I know how many bytes to read from my FMOD::Sound? I want to read the latest added recording data. (So, recordDelta in record.cpp)

2.
After I have my encoded data, do I have to decode it or can FMOD play encoded Opus data?

Thanks for the help!

Bas

  • You must to post comments
Best Answer
0
0

The API you would use to get the audio out of the FMOD::Sound object is Sound::lock and Sound::unlock.
You can use the record position to know where FMOD is writing to and copy data out behind that position, please note that this is a ring buffer.

You can control the format of the recorded audio via FMOD_SOUND_FORMAT, I’m not familiar with the requirements of the UE4 encoder, but it should be documented somewhere. PCM16 is fairly common.

FMOD does not support decoding Opus, you would need to develop a custom FMOD codec to perform this step (or decode it yourself and feed it to FMOD).

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.