jeremy
jeremy3mo ago

Is there a way to change the volume of other people's voices when using normcore voice chat?

I am using normcore with the xr interaction toolkit to create a vr app in unity. I am creating a settings menu where the user can change the volume of the background music and the sfx of my game but I also want the users to be able to turn up/down the volume of other peoples voices in the same room. Is there a way to do this?
9 Replies
kapa.ai
kapa.ai3mo ago
Hi @jeremy. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, you can adjust the volume of other people's voices in Normcore's voice chat. The RealtimeAvatarVoice component includes a voiceVolume property. This is a read-only value between 0-1 that reflects the audio level the last time it was sampled for playback. However, this property is read-only and is used for animating the mouth of an avatar to match a player's speech, not for adjusting the volume of the voice chat. If you want to adjust the volume of the voice chat, you might need to manually control the volume of the AudioSource component that is used for playback. The RealtimeAvatarVoice component creates an AudioSource component by default, but you can also create an AudioSource manually and RealtimeAvatarVoice will detect and use this instance instead. Here is the relevant excerpt from the documentation (https://normcore.io/documentation/realtime/xr/voicechat):
By default RealtimeAvatarVoice will create an AudioSource component, however, if you would like to set custom spatialization settings, create an AudioSource manually. RealtimeAvatarVoice will detect and use this instance instead.
So, you could create a custom AudioSource and control its volume directly to adjust the volume of the voice chat. However, please note that this might affect the spatialization of the voice chat, so you should test it thoroughly to ensure it works as expected in your VR app. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@951169354777632798> kapa.ai is still learning and improving, please let us know how it did by reacting below
jeremy
jeremy3mo ago
@Normcore Assistant When I play test my app and I look at the game object that contains the RealtimeAvatarVoice component I don't see an audio source so I tried adding one to the prefab under Normal>Examples>VR Player>Resources>Normcore Avatar Controller but it still wouldn't show, where would I find this audio source or add my own?
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The RealtimeAvatarVoice component creates an AudioSource at runtime if one is not present. This means that you won't see the AudioSource in the Unity editor, but it will be there when you run your application. If you want to add your own AudioSource to the prefab, you can do so in the Unity editor. RealtimeAvatarVoice will detect this AudioSource and use it instead of creating a new one. Here's how you can do it: 1. Open your prefab in the Unity editor. 2. Add an AudioSource component to the game object that has the RealtimeAvatarVoice component. 3. Configure the AudioSource as needed. 4. Save the prefab. When you run your application, RealtimeAvatarVoice should now use your AudioSource instead of creating a new one. You can then control the volume of this AudioSource to adjust the volume of the voice chat. Here is the relevant excerpt from the documentation (https://normcore.io/documentation/realtime/common-questions#how-do-i-spatialize-voice-chat):
At runtime, RealtimeAvatarVoice will create an AudioSource if one is not present, but if you’d like to configure it in the editor, add your own AudioSource component and RealtimeAvatarVoice will detect and use that instance.
---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@951169354777632798> kapa.ai is still learning and improving, please let us know how it did by reacting below
jeremy
jeremy3mo ago
@Normcore Assistant Which prefab do I need to add it to? I already tried adding it to the one in the examples folder, I'm not sure which prefab it is instantiating at runtime
kapa.ai
kapa.ai3mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The prefab you need to modify is the one that is being instantiated at runtime by your application. This is typically done using the Realtime.Instantiate() method. The prefab that is instantiated should have a RealtimeView component on the root of the game object, as per the documentation (https://normcore.io/documentation/realtime#prefabs). If you're using the "Realtime + Cube Player" prefab from the examples, as mentioned in the Getting Started guide (https://normcore.io/documentation/essentials/getting-started), then that's the prefab you should modify. However, if you're using a different prefab, you'll need to find out which one it is. You can do this by looking at the code where the Realtime.Instantiate() method is called. The first argument to this method is the name of the prefab to instantiate. Here's an example from the documentation (https://normcore.io/documentation/reference/classes/Normal.Realtime.RealtimePrefabMetadata):
Realtime.Instantiate(prefabName);
Realtime.Instantiate(prefabName);
In this example, prefabName is the name of the prefab to instantiate. You should replace this with the name of your prefab. Once you've identified the correct prefab, you can add an AudioSource component to it in the Unity editor, as I described in my previous message. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@951169354777632798> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit3mo ago
it's the one referenced in your avatar manager, click on it and it will highlight the prefab in the project folder