Transcript for:
Tutorial on Using Animator Play Audio State Behavior in VR Chat

how's it going everyone so historically I've avoided making any tutorials involving audio sources the reason is that they're pretty performance intensive having over eight audio sources on one Avatar will immediately drop your Avatar's performance rank to very poor and being that there's no way to animate swapping an audio clip in an audio Source if you wanted multiple variations of one sound effect You' need an audio source for each audio clip not ideal thank y this is now easily avoidable thanks to the new animator play audio State Behavior this behavior when applied to a state in one of your avatar animators will play a specified audio clip from an audio Source once that state is transitioned to this means you can easily use multiple audio clips without using dozens of audio sources so today I'll show you how to utilize this new component by allowing this alien to shoot beams out of his head oh and by the way this unfortunately won't work for Quest avatars as audio sources are completely disabled on VR chat for Android sorry Quest users actually I'm not sorry you here we have our Avatar I've already created the beam effect but it's lacking sound effects let's fix that first We'll add an audio Source I'm just going to apply it to the root of the Avatar we're going to want to change some settings on this audio Source first we'll set the priority to one do not set it to zero as this will make your audio Source the number one priority potentially cancel in out other people's audio as well as World audio next set the spatial blend to one this will spatialize the audio in 3D causing it to play through the left or right ear depending on the listener's position under 3D sound settings set volume rollof to linear rolloff the minimum and maximum distance settings determine how close or far your sound will be audible from this audio Source you can set this to your preference but I recommend using small values to avoid blasting off audio throughout the entire instance next add a component called VRC spatial audio Source set the gain and far to the same values as the Min and max distance and toggle on use audio Source volume curve although not required having this component will significantly improve audio clarity now let's move on to the animator here I have two states one when the beam is not being fired and one where it is we'll select the beam fire State click add behavior and select VRC animator play audio first we'll need to Define the root path of the audio Source we can easily do that by just dragging and dropping it here then we can add our audio clips I have exactly 10 Clips I want to use so I'll put 10 here and drag my audio clips into each [Music] slot the playback order setting determines which audio clip is played when transitioning to this state by by default it is set to random which selects a random clip each time if set to Unique random it chooses a random clip ensuring that the same clip isn't played twice in a [Music] row roundabout plays the Clips in order looping back to the first clip after the last one [Music] parameter selects a clip based on an INT type Avatar parameter for example if the parameter is zero the first clip is [Music] chosen in this case I'll be using unique random and that's all that's needed for this particular setup though let's go over some more settings included in animator play audio you may notice that some settings have a common additional property by default it's set to apply if stopped which applies the setting to the audio Source unless it's already playing a clip if set to always apply the setting is applied to the audio Source even if it's currently playing an audio clip never apply mostly speaks for itself the setting goes completely unused both random volume and random pitch applies a randomized value to the given settings when transitioning to this state with a specified range for example here's the effect with pitch minimum set to zero and Max set to two Loop determines whether or not the audio source's looping should be set enabled or disabled when transitioning to this state [Music] finally under play settings you can specify specifically when to stop or play the audio source as well as set a delay in [Music] seconds and that's all you need to know about playing audio on VR chat avatars thanks to animator play audio it's never been easier to add sound to avatars but if you're struggling and you need some assistance feel free to join our Discord down below and create a help thread if you want to be the first to check out new Avatar tutorials for epic features make sure to subscribe that's all for now thanks for watching [Music]