Skip to main content

Overview

The Play Audio and Stop Audio actions manage audio playback. Use Play Audio to trigger narration, sound effects, or ambient audio. Use Stop Audio to silence audio clips or stop looping sounds. Multiple audio clips can play simultaneously, allowing you to layer narration over ambient sound or play multiple sound effects at once.

Play Audio

When to Use

  • Narration: voice-over instructions or explanations
  • Sound effects: feedback tones, alert sounds, or interaction sounds
  • Ambient audio: background music or environmental sounds
  • Audio cues: alert the learner to important information

Parameters

ParameterTypeRequiredDescription
Audio AssetstringYesSelect an audio file from your asset library.
LoopbooleanNoSet to true to loop the audio continuously. Default is false (play once).
VolumenumberNoSet the volume level from 0 to 1, where 0 is silent and 1 is full volume. Default is 1.

Key Behavior

  • Fire and forget: Play Audio actions start the audio and the action completes immediately; subsequent actions don’t wait for the audio to finish.
  • Simultaneous playback: You can add multiple Play Audio actions to the same action list, and they will all play at once.
  • Action ID tracking: Each Play Audio action is assigned an ID that you can reference in Stop Audio actions if you need to stop that specific audio.

Stop Audio

When to Use

  • Interrupt narration: stop a narration clip if the learner advances before it finishes
  • Ambient sound cleanup: stop looping ambient audio when exiting a state
  • Layered audio: stop one audio clip while another continues
  • Audio fallback: if audio is playing unexpectedly, stop it

Parameters

ParameterTypeRequiredDescription
Target Action IDstringNo(Optional) Reference the ID of a specific Play Audio action to stop only that clip. If omitted, all playing audio stops.

Key Behavior

  • Omnibus stop: If no Target Action ID is provided, Stop Audio stops all currently playing audio.
  • Selective stop: If you specify a Target Action ID, only that audio clip stops; other audio continues.
  • Safe to call on silent: Calling Stop Audio when no audio is playing has no effect.

Practical Examples

Narration with Delay

Scenario: Play a 3-second narration, then show a text prompt. The learner should not see the prompt until narration is done.
1
In a state’s onEntry action list:
  1. Play Audio: select narration_step1.mp3
  2. Delay: 3000 (milliseconds, matching narration duration)
  3. Show Prompt: display interaction instructions
2
The training plays audio, waits 3 seconds, then shows the prompt in sync.

Looping Ambient Sound

Scenario: A factory floor training state should have background machinery noise while learners work.
1
In the FactoryFloor state’s onEntry:
  • Load Scene: factory_floor_main
  • Play Audio: machinery_ambient.mp3, Loop: true, Volume: 0.3
2
In the onExit:
  • Stop Audio: (no Target Action ID — stops all audio, including the ambient loop)
3
Ambient sound plays throughout the state and is cleaned up when exiting.

Stop Interrupted Narration

Scenario: Learner clicks “skip” or advances before narration finishes.
1
In the onEntry action list, give your Play Audio action a memorable name/ID in the system (e.g., narration_main).
2
Create a transition triggered by a “skip” button:
  • Stop Audio: Target Action ID: narration_main
  • Training Navigation or transition to next state
3
The narration stops immediately, and the training moves forward.
Keep ambient sound volumes low (0.2–0.4) so they don’t drown out narration. Narration should typically be at volume 1.0.
Audio plays from the system’s default audio output. If the learner’s device is muted, no sound will be heard. Some trainings may require captions or text alternatives for accessibility.
If you Play Audio in onEntry without a corresponding Stop Audio in onExit, the audio may continue playing even after the state is exited. Always clean up looping audio or long-duration audio when leaving a state.