🔊

Tutorial on Using Animator Play Audio State Behavior in VR Chat

Jul 17, 2024

Tutorial on Using Animator Play Audio State Behavior in VR Chat

Introduction

  • Historically, tutorials involving audio sources are avoided due to their performance intensity.
  • Over eight audio sources can drop an avatar's performance rank to "very poor."
  • There is no way to animate swapping an audio clip in an audio source.
  • Requires multiple audio sources for multiple sound effects, which is not ideal.

New Solution: Animator Play Audio State Behavior

  • Allows specified audio clip to be played from one audio source when state is transitioned.
  • Enables use of multiple audio clips without using dozens of audio sources.
  • Not compatible with Quest avatars due to audio sources being disabled on VR chat for Android.

Use Case Example: Alien Shooting Beams

  • Add an audio source to the avatar.
  • Changes settings on the audio source:
    • Set priority to 1 (not 0), to avoid canceling out other audio.
    • Set spatial blend to 1 for 3D audio effects (left or right ear based on listener's position).
    • Under 3D sound settings, set volume rolloff to linear rolloff.
    • Adjust minimum and maximum distance settings to control audibility range.
    • Add VRC spatial audio source component.
      • Set gain and far values same as min and max distance.
      • Toggle on “use audio source volume curve.”

Animator Configuration

  • Two states: beam not firing and beam firing.
  • In beam firing state:
    • Add VRC animator play audio behavior.
    • Define root path by dragging the audio source.
    • Add audio clips (example uses 10 clips).
    • Playback order settings:
      • Random: Selects a random clip each time.
      • Unique random: Ensures the same clip isn't played twice in a row.
      • Roundabout: Plays clips in order, looping back to first clip after the last.
      • Parameter: Selects clip based on an INT type Avatar parameter.
  • Set up playback order to “unique random.”

Additional Settings in Animator Play Audio

  • Apply if stopped: Applies setting unless the audio source is already playing.
  • Always apply: Setting is applied even if audio source is playing.
  • Never apply: Setting is not used.
  • Random volume and pitch: Randomized values applied to given settings within a specified range.
  • Loop: Determines if the audio source should loop when transitioning.
  • Play settings: Specify when to stop or play the audio source and set delay in seconds.

Conclusion

  • Animator play audio makes it easier to add sound to avatars.
  • Join Discord for help or subscribe for more tutorials.
  • Thanks for watching.