paradox
paradox3d ago

Mirroring a player's voice onto a separate Audio Source?

I am currently trying to create an "intercom" like mechanic where a player presses a button and while they hold said button their voice is transmitted across a separate audio source entity. The issue I'm running into is the lack of an audio source to fetch the audio clip from. I have tried to also subscribe to the voiceData event in RealtimeAvatarVoice.cs file but that doesn't seem to ever fire, at least locally. Any ideas?
7 Replies
kapa.ai
kapa.ai3d ago
Hi @paradox. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources do not contain explicit information about mirroring a player's voice onto a separate AudioSource for an "intercom" mechanic, or about accessing the raw microphone audio stream from RealtimeAvatarVoice for local playback or routing. What is documented is that the RealtimeAvatarVoice component handles microphone input and creates an AudioSource for playback on remote clients. If you want to customize spatialization or audio settings, you can add your own AudioSource to the prefab, and RealtimeAvatarVoice will use it. However, there is no mention of an event or API for accessing the local microphone audio stream before it is sent over the network, nor is there documentation about a voiceData event being available for this purpose. The documentation also notes that RealtimeAvatarVoice creates an AudioSource only for playback, not for local monitoring or routing to other in-scene objects Voice Chat. If you need to mirror the local player's voice to another AudioSource in the same scene (for example, for an intercom), you may need to modify the RealtimeAvatarVoice source code or implement your own microphone capture and routing logic. The documentation does mention that the source code for RealtimeAvatarVoice is included and can be forked for custom use cases Voice Chat. In summary:
- There is no built-in event or API in RealtimeAvatarVoice for mirroring the local microphone stream to another AudioSource. - Customization would likely require modifying the provided source code or implementing your own microphone capture logic. If you need more advanced access to the audio stream, you may want to explore Unity's Microphone API directly, but this is outside the scope of the provided Normcore documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3d ago
<@219230512298852352> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
maxweisel
maxweisel3d ago
hmm, I believe it should fire. @NormalMark will you take a look? in the meantime, source code is included. might make sense to fork RealtimeAvatarVoice and grab audio samples out of it
paradox
paradoxOP3d ago
Might take a look into that, thank you!
maxweisel
maxweisel3d ago
sure thing!
Mechabit
Mechabit3d ago
You can add an audio source to the voice object and it will use that instead of creating one
maxweisel
maxweisel3d ago
I don’t think that works for the local player. the audio source isn’t used for your own audio locally

Did you find this page helpful?