Forum Discussion
Background noise suppression - Storyline 360
I am not sure if this is possible in software, but I have been asked to try and find a solution.
We need the ability to turn off background noise (particularly music) in the videos in our courses.
Option 1 - Two different videos - switch between (filesize)
Option 2 - Background music on slide - switch off (buffering mistiming?)
Either of these could work, but have drawbacks.
Option 3 - Could I use JavaScript to noise supress successfully?
This is what I have so far (Copilot) but it sort of equally take from both sides and I have tried adjusting settings to no avail.
var player = GetPlayer(); // Ensure this function is defined
var audioContext = new (window.AudioContext || window.webkitAudioContext)();
var video = document.querySelector('video'); // Target the video element
if (video) {
var source = audioContext.createMediaElementSource(video);
var gainNode = audioContext.createGain();
// Create a high-pass filter to remove low-frequency music elements
var highPassFilter = audioContext.createBiquadFilter();
highPassFilter.type = 'highpass';
highPassFilter.frequency.value = 300; // Adjust frequency to target lower background noise
// Create a low-pass filter to remove high-frequency music elements
var lowPassFilter = audioContext.createBiquadFilter();
lowPassFilter.type = 'lowpass';
lowPassFilter.frequency.value = 3000; // Adjust frequency to target higher background noise
// Create notch filters to target specific music frequencies
var notchFilter1 = audioContext.createBiquadFilter();
notchFilter1.type = 'notch';
notchFilter1.frequency.value = 500; // Example frequency
notchFilter1.Q.value = 10; // Quality factor to adjust the bandwidth
var notchFilter2 = audioContext.createBiquadFilter();
notchFilter2.type = 'notch';
notchFilter2.frequency.value = 1000; // Example frequency
notchFilter2.Q.value = 10; // Quality factor to adjust the bandwidth
var notchFilter3 = audioContext.createBiquadFilter();
notchFilter3.type = 'notch';
notchFilter3.frequency.value = 2000; // Example frequency
notchFilter3.Q.value = 10; // Quality factor to adjust the bandwidth
// Connect the filters in series
source.connect(highPassFilter);
highPassFilter.connect(notchFilter1);
notchFilter1.connect(notchFilter2);
notchFilter2.connect(notchFilter3);
notchFilter3.connect(lowPassFilter);
lowPassFilter.connect(gainNode);
gainNode.connect(audioContext.destination);
gainNode.gain.value = 1.0; // Adjust gain to maintain overall balance
} else {
console.error('Video element not found or does not have an audio track.');
}
Any advice on isolating music only would be gratefully received or if there is another way to do this I am all ears.
Thanks for your time.
1 Reply
- PhilMayorSuper Hero
If you add the background noise as a playlist, you have a variable for volume so you could set that to 0, would work on background music only