Audio in Lens Studio

Lens Studio allows you to import and add audio to your lenses. Adding audio to your lenses enhances the nature of the lenses by enabling the viewer more interaction. It can be added in behavior scripts as a response and even in animations.

Behavior scripts in lens studio enable you to make interactions in your lenses by defining a trigger type and a response for that trigger.

In this article, you will learn how to add audio as a response to the behavior script. Later on, you will learn how to add audio effects and preview them on your Snapchat.

Let’s get going!

Importing audio

It’s essential to use a compressed format of audio in Lens Studio to save space in your lenses. MP3 versions are considered best for optimization purposes. To import your audio, open Lens Studio. First, download and install Lens Studio if you haven’t installed it yet. Open Lens Studio and drag the audio to the resources panel.

Adding audio

After importing audio, the next step is to add the audio component. To do this, create an empty object that will hold the audio. Go to the Objects panel, add a new empty object. Then, in the Inspector panel, add a new component and select audio as the component. Select the audio you imported as the audio track.

In the audio section in the inspector panel, the autoplay button when selected enables the audio to play in a loop in your lens. You can mute the audio whenever you don’t want the sound to play by unchecking the audio button. This is shown in the image below.

Audio in behavior scripts

Let’s say you want to play an audio piece when a certain behavior is triggered, for instance, when the user opens their mouth. This is done by adding a behavior script. Behavior scripts let you add interactivity to your lenses. It has a trigger element that lets you choose when a behavior should be activated and the response type element that shows what happens when the trigger is activated. In this case, let’s use the mouth opening as the trigger and the response type as playing a sound.

To do this, let’s add a behavior script. Go to the Resources panel and hover on Helper scripts and select behavior. Then add an empty object in the Object panel to hold the behavior script. The Response type will be set as play sound and the response action as play. The audio track represents the audio piece that you imported and the audio component is set as audio. The illustration below shows this process.

Add another behavior script that will stop the audio playing when the user closes the mouth. To do this, make a copy of the first behavior script. A few changes will be made to disable the audio from playing when the mouth is closed. Therefore, the event type will be mouth closed, and the response action will change from play to stop.

Audio effects

Audio effects are applied after the user records a snap. To add audio effect, go to the objects panel, click the + button, and select the audio effect. This opens an audio component in the inspector panel.

Alternatively, create an empty object in the objects panel as a scene object, select it, and then head over to the inspector panel and click on the add component button, then select the audio effect option. This opens an audio effect component.

The effect preset lets you try different audio effects on your recorded snap.

The audio sample attribute has a dropdown of different voices that lets you hear the original voice in the original track attribute and voice with the applied effect in the with effect attribute.

Note that the audio effects work one at a time when you record a snap. To try another audio effect you need to record another snap.

Preview lenses in Snapchat

To preview your lenses in Snapchat, pair your Snapchat with Lens Studio. Check this guide on Lens Studio on how to pair and preview lenses. This allows you to test the audio and audio effects on your Snapchat. In the case where you make changes in the lenses, send the lenses to your Snapchat and record a snap to see the changes.

Conclusion

You have seen how to add sound and sound effects to your lenses and how to try them on your device. Adding sound and sound effects to lenses gives the user a more engaging and amusing experience. Include them in your lenses and have fun while doing so.

Happy creating!

Fritz

Our team has been at the forefront of Artificial Intelligence and Machine Learning research for more than 15 years and we're using our collective intelligence to help others learn, understand and grow using these new technologies in ethical and sustainable ways.

Comments 0 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

wix banner square