Add

Lorem ipsum

Lorem ipsum

A
A
A
Easter egg

4 views

3 min

How to Play a Level-Up Sound at the End of an Article in Webflow

Learn how to play a level-up sound when a visitor finishes reading a Webflow article with the Web Audio API.

In this tutorial, Sandro, cofounder of Gemeos Webflow agency, shows you how to play a level-up sound when a visitor finishes reading a Webflow article, using the Web Audio API.

Example

🎮

Level-up sound

Do Mi Sol Do — Web Audio API

Do 523Hz Mi 659Hz Sol 784Hz Do 1047Hz

Click to test

NoteFrequencyTiming
Do523 Hz0ms
Mi659 Hz120ms
Sol784 Hz240ms
Do (high)1047 Hz360ms, held 300ms

Understanding the melody

The Do-Mi-Sol-Do melody is the chord progression most universally recognized as a "victory" sound in gaming culture. It uses the Web Audio API's square oscillator for a retro 8-bit feel. No audio file is needed: everything is generated synthetically.

1. Add a level-up badge (optional)

Create a Div with the ID levelup-badge, set it to Fixed position, center it, and keep it hidden by default with display none. Add a message like "⬆ Level Up ! Article complete" in your own style.

2. Add the script in Footer code

(function() {
var fired = false;

function playLevelUp() {
var AudioCtx = window.AudioContext || window.webkitAudioContext;
if (!AudioCtx) return;
var ctx = new AudioCtx();

// Level-up melody: do-mi-sol-do (upper octave)
var notes = [
{ freq: 523, start: 0, dur: 0.1 }, // Do
{ freq: 659, start: 0.12, dur: 0.1 }, // Mi
{ freq: 784, start: 0.24, dur: 0.1 }, // Sol
{ freq: 1047, start: 0.36, dur: 0.3 }, // Do (high)
];

notes.forEach(function(note) {
var osc = ctx.createOscillator();
var gain = ctx.createGain();
osc.connect(gain);
gain.connect(ctx.destination);
osc.type = 'square';
osc.frequency.setValueAtTime(note.freq, ctx.currentTime + note.start);
gain.gain.setValueAtTime(0.15, ctx.currentTime + note.start);
gain.gain.exponentialRampToValueAtTime(0.001, ctx.currentTime + note.start + note.dur);
osc.start(ctx.currentTime + note.start);
osc.stop(ctx.currentTime + note.start + note.dur + 0.01);
});
}

window.addEventListener('scroll', function() {
if (fired) return;
var scrolled = window.scrollY + window.innerHeight;
var total = document.documentElement.scrollHeight;
if (scrolled >= total - 100) {
fired = true;
playLevelUp();
var el = document.getElementById('levelup-badge');
if (el) {
el.style.display = 'flex';
setTimeout(function() {
el.style.opacity = '0';
el.style.transition = 'opacity 0.5s';
setTimeout(function() { el.style.display = 'none'; }, 500);
}, 3000);
}
}
}, { passive: true });
})();

3. Combine it with confetti

For a complete experience, load canvas-confetti in the head and add this inside the triggerEnd function:

if (typeof confetti === 'function') {
confetti({ particleCount: 80, angle: 60, spread: 55, origin: { x: 0, y: 0.8 } });
confetti({ particleCount: 80, angle: 120, spread: 55, origin: { x: 1, y: 0.8 } });
}

good to know

The Web Audio API requires a prior user interaction to work (autoplay policy). Scrolling counts as an interaction: a user who scrolls to the end of the article will have interacted with the page, so the sound will play. Never trigger this sound when the page loads without prior interaction.

Conclusion

A level-up sound creates a memorable moment and reinforces the feeling of accomplishment. Use cases:

  • Long technical articles that reward finishing the read
  • Tutorials with gamification
  • Academies and training platforms

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...