There may be differences between your version of AR Studio and this tutorial because the product is currently in beta and we update it regularly.
In previous tutorials you learned how to use 2D and 3D objects to build more advanced visual effects. In this tutorial we'll explain how to incorporate audio files.
You'll learn which file formats AR Studio supports and how to insert and edit both ambient and scripted sounds.
AR Studio allows you to do some sound mixing, but for the most part, audio clips should be digitally mastered before you import them. This helps to ensure that none of the imported sounds dominate the experience. For this effect, we've given you sample assets to use.
Please download the sample content to follow along.
If you open the finished version in the sample content folder, you'll hear that the finished effect has an audio file that plays all the time. We'll talk more about that later.
AR Studio supports mono M4A files. We recommend using files with a 44.1kHz sample rate and 16-bit-depth resolution in order to constrain the size of an effect and preserve its audio quality. For this project, we've given you an audio file that we've prepared for you.
To start, open AR Studio, click Open Existing Project and then open the unfinished version in the sample content folder. You should see a 3D flower crown and glasses in the Viewport and Simulator, and the objects in the Scene tab. To make this effect complete, you'll need to add the audio file.
To make it easier to focus on what you're doing, you can minimize the other objects in the Scene tab by clicking the arrow next to the face tracker.
There are two components to audio effects: an audio source and an audio clip. First, you'll need to insert an audio source. To do this, click Insert, select Audio Source and then click Insert. You should now see your audio source in the Scene tab. In its default state, the audio source won't render any sound in your effect, but you can configure it to represent supported audio effects.
The audio source is now in place, but you'll need to import a clip and apply it. First, make sure the audio source is selected in the Scene tab and go to the Inspector panel. Then, click the arrows next to Sound and select Add Audio Clip. Open summercrown.m4a from the sample content folder.
Once you've inserted an audio source and attached an audio clip, you can decide which type of sound you'd like to have in your scene.
Ambient sounds are looping audio files that run constantly through the lifetime of an effect, whereas scripted sounds allow you to control when your audio plays. You can include both types in the same effect.
For this effect however, we want an ambient sound. You should see a box labeled Ambient. Check this box to make the audio file play continuously. You should now hear music in the scene.o make the audio file play continuously. You should now hear music in the scene.
To produce a scripted sound, you would go to the bottom of the Assets panel and double-click script.js to open the script file in your default script editor. Triggered audio can be started using the play method of the Audio Module.
If you want to test your scripted sound in the future, click Run in the Toolbar. The Console will appear below the Viewport and you can use it to debug your script
By default, the audio source is set to play in both camera views, front and back. To change which camera view the audio plays in, select the audio source in the Scene tab and go to Enable For in the Inspector panel. Unchecking either Front Camera or Back Camera will remove the audio from that camera view.
For this effect though, we'll keep the audio enabled for both camera views.
Congratulations, your effect now has audio!
To recap, in this tutorial you learned which file formats AR Studio supports and how to insert and edit both ambient and scripted sounds.