Adding background music to your eLearning courses can significantly enhance learner engagement. However, abrupt audio transitions can feel unprofessional and distracting.

Click Preview to watch the video tutorial on adding background music in Storyline 360 using JavaScript.

Preview

In this guide, you’ll learn how to add smooth background music in Articulate Storyline 360 using JavaScript, including fade-in and fade-out effects, volume control and seamless playback across slides.

This method is perfect for eLearning designers who want polished, professional audio experiences in their courses.

Why Smooth Background Music Matters in eLearning

Poor audio transitions can disrupt learning. Smooth background music:

1. Enhances learner focus and engagement
2. Creates immersive learning environments
3. Improves course professionalism
4. Supports storytelling and retention

That’s why implementing fade-in and fade-out effects to control volume is a best practice in custom eLearning development.

Looking to enhance your Storyline courses?
Partner with Swift eLearning services for custom eLearning development, Storyline 360 expertise and advanced interactivity solutions.

Learn More

Step-by-Step guide: Add Smooth Background Music Using JavaScript

Step 1: Add Background Audio in Storyline 360

Open your course in Articulate Storyline 360
Go to the Insert tab
Click Audio → Background Audio
Select Create Playlist
Add your audio file and click OK

Preview your course — the audio will play continuously across slides.

Step 2: Create a Volume Control Variable

Create a number variable:
Name: Bg_Control_Volume
Default Value: 100

This variable will control the background music volume dynamically.

Step 3: Configure Slide Master for Global Control

Go to View → Slide Master
Select the main Master Slide

Now add the following triggers:

Trigger 1: Set Initial Volume
Action: Adjust background audio volume
Set to: 0%
When: Timeline starts

Trigger 2: Sync Volume with Variable
Action: Adjust background audio volume
Set to: Bg_Control_Volume
When: Variable changes

Trigger 3: Stop Music
Action: Stop background audio
When: Variable changes
Condition: Bg_Control_Volume = 0

Trigger 4: Play Music
Action: Play background audio
When: Variable changes
Condition: Bg_Control_Volume = 1

Step 4: Add Fade-In Effect Using JavaScript

Create a new trigger:
Action: Execute JavaScript

var player = GetPlayer();
var duration = 1000; // 5 seconds
var interval = 10;   // update every 50ms
var steps = duration / interval;

var targetVolume = 100; // increase up to 50%
var currentVolume = player.GetVar(“Bg_Control_Volume”);

// If starting from 0, ensure it’s initialized
if (currentVolume < 0) currentVolume = 0;

var increment = (targetVolume – currentVolume) / steps;

var fade = setInterval(function() {
currentVolume += increment;

if (currentVolume >= targetVolume) {
currentVolume = targetVolume;
clearInterval(fade);
}

player.SetVar(“Bg_Control_Volume”, Math.round(currentVolume));
}, interval);

When: Timeline starts

Add a fade-in script to gradually increase the volume over one second (or adjust the duration based on your course requirements), then click OK.

This ensures your background music starts smoothly instead of abruptly.

Step 5: Add Fade-Out Effect Using JavaScript

Next, create another trigger:

Action: Execute JavaScript

var player = GetPlayer();

// Clear any existing fade (IMPORTANT)
if (window.bgFadeInterval) {
clearInterval(window.bgFadeInterval);
}

// Settings
var duration = 5000; // 5 seconds
var interval = 50;
var steps = duration / interval;

var currentVolume = player.GetVar(“Bg_Control_Volume”);
var targetVolume = 0;

// Smaller step = smoother fade
var decrement = (currentVolume – targetVolume) / steps;

// Store interval globally so we can clear it later
window.bgFadeInterval = setInterval(function() {

currentVolume -= decrement;

if (currentVolume <= targetVolume) {
currentVolume = targetVolume;
clearInterval(window.bgFadeInterval);
}

player.SetVar(“Bg_Control_Volume”, Math.round(currentVolume));

}, interval);

When: Timeline reaches 5 seconds before the end

Add a fade-out script to gradually decrease the volume over five seconds, then click OK.

This prevents sudden audio cuts during slide transitions.

Step 6: Apply Across Slide Master

To maintain consistency:
Repeat the same steps on other slides within the Slide Master
Adjust the trigger timing as needed (e.g., 20 seconds before the end)
Apply a fade-out script that matches the selected duration

This ensures consistent audio behavior across your entire course.

Step 7: Preview and Test

Preview your course
Confirm that the background music:

    • Fades in smoothly at the start
    • Fades out naturally before the slide ends

Want more advanced Storyline tips and techniques?

Explore free Storyline 360 tutorials, including JavaScript hacks and eLearning solutions designed to elevate your course design.

Explore Free Tutorials

When Should You Use This Technique?

This method is ideal for:
1. Corporate training courses
2. Compliance training (WHMIS, safety, onboarding)
3. Scenario-based learning
4. Gamified eLearning modules

At Swift eLearning services, we apply this approach to ensure engaging and distraction-free learning environments.

Best Practices for Smooth Audio in Storyline 360

  • Keep background music subtle (20–40% volume recommended)
  • Avoid looping short tracks excessively
  • Use fade-in/out on every slide transition
  • Test across devices (desktop, mobile, LMS)
  • Ensure audio doesn’t interfere with narration

Summary

Smooth background music can transform your eLearning course from basic to professional. With the power of JavaScript in Storyline 360, you can create seamless audio transitions that enhance learner engagement and retention.

Explore eLearning Samples

See how our custom-designed courses deliver engaging, results-driven learning experiences.

View Our Work

Frequently Asked Questions (FAQs)

To add background music, go to Insert → Audio → Background Audio, select Create Playlist, upload your audio file and click OK. The music will play continuously across slides.

Yes. While Storyline 360 does not support this natively, you can use JavaScript triggers to gradually increase or decrease the volume for smooth fade effects.

Yes, Storyline 360 supports JavaScript triggers, allowing developers to implement advanced functionality like audio control, animations and custom interactions.

You can sync music by adjusting slide duration, using timeline triggers and applying fade-in/out effects so the audio aligns naturally with slide transitions.

JavaScript provides advanced control over audio behavior, including smooth transitions, dynamic volume adjustment and improved user experience.

Ready to transform your training with AI-optimized eLearning?

Partner with Swift eLearning services for custom development, advanced interactivity and next-gen digital training solutions.

Contact us