Audio events are ideal for triggering shorter sounds in response to user interactions or to complement character animations. Whilst longer form audio — such as background music and voice overs — can also be triggered with audio events, they lack a level of control to manipulate volume, panning, and more over time.For use cases requiring greater control over volume and playback, consider using Scripting. Check out AudioSound and AudioSource for more information.
Working with Audio Assets
Audio events use sounds from the Assets panel. See Importing Assets to import MP3, WAV, and FLAC files, or see Audio Assets to browse Soundly sounds, create clips, and adjust asset volume.Creating an audio event
The simplest way to create an audio event is to drag your audio asset or clip directly from the assets panel onto the stage. In doing so, an event is created with the preassigned asset. Alternatively, create a regular event by activating the event tool (SHIFT + E) and clicking on the stage. Once created, set the type setting in the inspector to Audio. Additional options to assign an asset and browse the Soundly library will be presented for audio events.
Triggering an audio event
Like regular events, audio events can be triggered in a selection of different ways:- Timeline: Whilst in animate mode, with a timeline selected, the event inspector will surface a button to key the event. Keying an event causes it to be reported. In the context of an audio event, reporting it will start the playback of the assigned audio asset.
- Transitions: Select a transition node within a State Machine and add an event via the inspector. You can choose whether the event should be reported at the start or at the end of the transition.
- Listeners: Select a listener within a State Machine and add a ‘report event’ action via the inspector. The pointer option will determine when the audio will play. For example, a pointer down listener with an assigned audio event targeting a shape will start playback when the user clicks on the shape.