Overay-seongmin
Overay-seongmin2mo ago

How to control Voice Volume?

I have read the questions related to the Normcore volume control. According to the answers, I found the prefab with the RealtimeAvatarVoice script, which is the CustomMetaAvatar prefab (which can be created from the MetaAvatar script). According to the answer, since the RealtimeAvatarVoice creates the AudioSource at runtime, the AudioSource should be created under the Head object of the CustomMetaAvatar to which the RealtimeAvatarVoice is attached. However, when querying in runtime via the Update method, the AudioSource is not found. Since there is no AudioSource, I cannot adjust the volume. What should I do?
8 Replies
kapa.ai
kapa.ai2mo ago
Hi @Overay-seongmin. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the information in the knowledge sources, I can help you with controlling voice volume in Normcore. According to the documentation, RealtimeAvatarVoice will create an AudioSource component at runtime if one is not already present. However, if you'd like to configure the AudioSource in the editor (including volume settings), you should add your own AudioSource component to the same GameObject that has the RealtimeAvatarVoice component, and RealtimeAvatarVoice will detect and use that instance instead. From the documentation:
RealtimeAvatarVoice plays audio back using Unity's audio engine so all of the Unity audio APIs work correctly. 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.
Documentation And similarly:
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.
XR Voice Chat To solve your issue: 1. Add an AudioSource component directly to the same GameObject that has the RealtimeAvatarVoice component (likely on the Head object of your CustomMetaAvatar prefab) 2. Configure the volume and other settings on this AudioSource in the editor 3. When your application runs, RealtimeAvatarVoice should detect and use your pre-configured AudioSource instead of creating its own This way, you'll be able to control the voice volume through the AudioSource component you've added manually. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@840905813887025173> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit2mo ago
add an audiosource to the prefab, it will then use the one you created and you can change the volume and effects etc.
khoi
khoi4d ago
@Mechabit so normcore is going to set all of these every time right? for me? i can just adjust the volume right? audioSource.spatialize = true; audioSource.spatialBlend = 1f; } if (_audioClip == null) { _audioClip = AudioClip.Create("Normcore Audio Stream", 48000, 1, 48000, stream: true, delegate (float[] data) { for (int i = 0; i < data.Length; i++) { data[i] = 1f; } }); } audioSource.enabled = true; audioSource.loop = true; audioSource.clip = _audioClip; audioSource.pitch = 1f; audioSource.spatializePostEffects = true; sorry i want the volume to go higher than what it currently is -- is that possible? @kapa.ai
kapa.ai
kapa.ai4d ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- The knowledge sources do not explicitly mention a way to increase the voice chat volume beyond its current maximum in Normcore. The documentation states that the RealtimeAvatarVoice component uses Unity’s AudioSource for playback, and you can adjust the volume via the AudioSource component. However, there is no information about increasing the gain or maximum volume beyond what is provided by default. If you need higher volume than what the AudioSource allows, you may need to look into custom audio processing or modifying the source code of RealtimeAvatarVoice, which is included with Normcore and can be forked for advanced use cases. But again, the official documentation does not provide specific guidance or guarantees for increasing the voice volume above the default maximumXR Voice Chat. If this is a critical requirement, I recommend reaching out to the Normcore team or community for further assistance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4d ago
<@412870643533479936> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit4d ago
you can try linear drop off instead of exponential or set a higher min distance or just set it to 2D audio for no drop off
khoi
khoi4d ago
ok and i put it on the same gameobject where the realtimeavatarvoice component is right i assume it is logarithmic rolloff by default, which starts rolling off immediately after 1 unit, so if i'm standing kinda close to someone, it's already below 1.0 volume? so if i keep logarithmic rolloff and up the min distance, the volume will be 1.0 up until the min distance so it will sound "louder" if im standing kinda close to someone but will still trail off correctly

Did you find this page helpful?