Create/Join Session Blueprint Voice Chat

Ok, it still keeps crashing, but I manage to have voice working by properly creating and joining sessions through blueprints :slight_smile:

Is voice supposed to work also in remote connections (e.g. machines not on the same LAN)? I mean, I know OnlineSubsystemNull is meant to provide the facilities to find sessions only in the LAN, but provided I’m not using these facilities, can I use the voicechat with OnlineSubsystemNull connecting to a machine in the Internet? Is there a way to join a remote session specifying the IP address with this subsystem?

I’ve just replaced the OpenAL code with CoreAudio - commit #c8d4759 - that should stop the crash closing the voice capture objects. This code still hasn’t been well tested though, so there may be other problems. I’m not familiar with how the voice-module integrates with the rest of the engine & games, so I’m afraid I can’t be of much help there.

Hi, I’ll try it out soon. I get the following errors compiling:
UnrealEngine-4.7.2-release/Engine/Source/Runtime/Online/Voice/Private/Mac/VoiceModuleMac.cpp:49:31: Too few arguments to function call, expected 2, have 1
UnrealEngine-4.7.2-release/Engine/Source/Runtime/Online/Voice/Private/Mac/VoiceModuleMac.cpp:176:30: Too few arguments to function call, expected 2, have 1

I had to change the two calls from FMemory::Memzero(BufferList); to FMemory::MemZero(BufferList);
and from FMemory::Memzero(NativeDesc); to FMemory::MemZero(NativeDesc);

Ehi @marksatt-pitbull, any update on this? Is there anything more I can do to investigate the problem?
Checking the source code, I see it is the following command in GetVoiceData (inVoiceModuleMac.cpp) to fail whenever CurrentRead != 0:

State = CopyBuffer(ReadBuffer, Data, ReadOffset, CurrentRead);

in particular, inside CopyBuffer, the conversion from different sample rates (16000 and 44100) fails with an kAudioConverterErr_InvalidInputSize error code:

			**if ( AudioConverterFillComplexBuffer(StreamConverter, &FVoiceCaptureCoreAudio::ConvertInputFormat, &InputBuffer, &FramesToCopy, &OutputBuffer, nullptr) == 0 )**

So, it is probably the size of the input buffer not set properly? I’ve not found yet how to fix this…

So, kind of fixed the kAudioConverterErr_InvalidInputSize error by adding
*IONumberDataPackets = (IOData->mBuffers[0].mDataByteSize / 2);
inside static OSStatus ConvertInputFormat.

Now “online test voice” plays my voice back, but the audio is slowed down and stretched, so there’s something wrong with the sample rate conversion still…

Ok, figured it out, it was a bit more complex than that. There where a couple of things that needed to be modified in the sample rate conversione in order to have it working. Created pull request #952

I’m not going to be able to help too much with the actual creation of the Mac audio output, but I can help with the Opus encoding/decoding and the transmission of voice over the connection.

At present voice depends greatly on the proper setup of your online session through create/join session. UserIds must be registered with all parties in order for voice to work.

You can do **DumpOnlineSessionState **on all clients/servers to see the status of the sessions and player registration.
You can do DumpVoiceMutingState, as you have seen, to see what players are registered with the voice system. Anyone not listed there probably can’t speak/hear anyone listed there.

**OnlineSubsystemNULL **provides only a basic mock interface/functionality but still has enough to provide unique UserIds per player and should go through the session/voice registration flow.

It might be useful to provide the dump output here so we can take a look. Also in the logs on all clients/servers, if you unsuppress LogVoice, are notifications for **RegisterRemoteTalker **and RegisterLocalTalker. These calls must be made for voice to work

Now with push to talk disabled, there should be a call to **StartNetworkedVoice **which is also logged via LogVoice. This is called by **ToggleSpeaking **or more importantly ClientEnableNetworkVoice which is called in PostLogin of the AGameMode.

If you follow some of these paths, you should be able to determine whether the network code is setup properly to transmit voice. Let me know where any shunting or early outs occur and we can address that.

You can also #define VOICE_LOOPBACK 1 in VoiceInterface.h to have the local data piped back into the “received remote packet” flow. You should then hear exactly what you’re sending.

The core “transmit voice” code flow is

Client sending voice traffic:

// Generate local packets
FOnlineVoiceImpl::ProcessLocalVoicePackets
FVoiceEngineImpl::ReadLocalVoiceData

// Send any local packets queued
UNetDriver::ProcessLocalServerPackets
UNetDriver::ProcessLocalClientPackets
UNetDriver::ReplicateVoicePacket
UVoiceChannel::Tick

Client Receiving voice traffic:

// Packet received
UVoiceChannel::ReceivedBunch
// Packet put on remote voice queue
FOnlineVoiceImpl::SerializeRemotePacket
// Process remote packets
FOnlineVoiceImpl::ProcessRemoteVoicePackets
FVoiceEngineImpl::SubmitRemoteVoiceData

Thanks Josh, very informative! Talking about push to talk:

Can you control this also via blueprint? If so, how?

Hold on people, can voice chat be accomplished in just blueprints?

I would also like to know about this. Thanks.

I too, would like to know this. I’m a bit skeptical about touching C++ by myself, even though I’m currently studying C# :stuck_out_tongue: We’ve been discussing a vital gameplay mechanic, but that would require VoIP and the ability to apply filter(s) to the voice.

Basically, the idea is to simulate radio distances - the further away you are from one another, the more distorted it gets. And it clears up as you get closer. Anyone got any ideas how difficult this would be to implement through C++? I do have some programming background, but one does not simply walk into C++ programming. :frowning:

I wouldn’t say that, for me it has always been more about the syntax than anything else, but I could still write a few of my own BP nodes comfortably.

Still nothing more on this? :

Hi, yes, it can be accomplished in just blueprints. If still needed, you should be able to find some directions here: How can I make in game voice communication? - Audio - Epic Developer Community Forums