Web Audio Api HardLimiter
How do I make an web audio api hardlimiter?
Hacking a hard-limiter with the web audio api.Far away from perfect (still clips), but around 6db noticeable louder.. What is a web audio api hardlimiter? How do you make a web audio api hardlimiter? This script and codes were developed by André Michelle on 18 October 2022, Tuesday.
Web Audio Api HardLimiter - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Web Audio Api HardLimiter</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Web Audio HardLimiter</h1>
<div class="controls"> <span>Maximize</span> <input type="range" value="0" step="1" min="0" max="12" oninput="maximize(this.value);"> <span class="value" id="maximize-db">6</span> <span class="unit">dB</span> <div id="reduction"></div>
</div>
<div> <h3><a href="http://www.audiotool.com/track/never-ending_passion/" target="audiotool">Never-ending Passion</a> by The Three Pauls</h3> <audio id="audio" crossorigin controls> <source src="http://api.audiotool.com/track/never-ending_passion/play.ogg" type="audio/ogg"> <source src="http://api.audiotool.com/track/never-ending_passion/play.mp3" type="audio/mpeg"> Your browser does not support the audio tag. </audio>
</div>
<p>Does not work in Safari.</p> <script src="js/index.js"></script>
</body>
</html>
Web Audio Api HardLimiter - Script Codes CSS Codes
html, body { font-size: 12px; font-family: "Open Sans"; background: white;
}
.controls { padding: 6px 16px; border-radius: 5px; background: #424242; color: #f0f0f0; display: inline-block; width: 288px; white-space: nowrap;
}
.controls input { width: 200px;
}
.controls span, .controls input { vertical-align: middle; padding: 0; margin: 0;
}
#reduction { margin-top: 4px; margin-bottom: 2px; width: 288px; height: 2px; background: green;
}
a { text-decoration: none; color: #666;
}
p { color: #CCC;
}
audio { width: 320px;
}
Web Audio Api HardLimiter - Script Codes JS Codes
var context = new (webkitAudioContext||AudioContext)();
var audio = document.getElementById('audio');
var label = document.getElementById('maximize-db');
var reduction = document.getElementById('reduction');
var source = context.createMediaElementSource(audio);
var preGain = context.createGain();
var limiter = context.createDynamicsCompressor();
limiter.threshold.value = 0.0; // this is the pitfall, leave some headroom
limiter.knee.value = 0.0; // brute force
limiter.ratio.value = 20.0; // max compression
limiter.attack.value = 0.005; // 5ms attack
limiter.release.value = 0.050; // 50ms release
source.connect(preGain);
preGain.connect(limiter);
limiter.connect(context.destination);
var dbToGain = function(db) { return Math.exp(db*Math.log(10.0)/20.0);
}
var maximize = (function(db) { preGain.gain.value = dbToGain(db); label.textContent = db; return arguments.callee;
})(0);
var showReduction = (function() { reduction.style.width = (dbToGain(limiter.reduction.value)*288)+"px"; window.requestAnimationFrame(arguments.callee);
})();
Developer | André Michelle |
Username | andremichelle |
Uploaded | October 18, 2022 |
Rating | 3 |
Size | 2,697 Kb |
Views | 20,240 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Geolocation Api | 2,322 Kb |
Web Audio Api MultiBandCompressor | 3,553 Kb |
Animated text on bezier curve | 2,252 Kb |
Web Audio Api Equalizer | 2,606 Kb |
Fourier series | 2,989 Kb |
Loop Mixing | 2,646 Kb |
Time Displacement | 2,617 Kb |
Instable Connection | 2,828 Kb |
Noise monotone increasing | 2,174 Kb |
Calculating Pi with Virtual Darts | 2,389 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Basic jQuery Filter list | Mtedwards | 2,464 Kb |
Cartoon Bomb | Tcmulder | 4,929 Kb |
Sticky Navbar | Phantomesse | 5,106 Kb |
Getting Started | Viblast | 1,500 Kb |
Highbrow Basic HTML Lesson 8 | Kimlarocca | 2,094 Kb |
Multi-step GSAP animation | Acacheung | 2,668 Kb |
Improved Page Flipping Effect | Usaphp | 5,201 Kb |
Flip test | Madhes | 1,635 Kb |
Cut and Paste Roll Link | BottomlineInteractive | 2,546 Kb |
Random Gradients - JS | Aldlevine | 2,026 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!