XSound
XSound copied to clipboard
Question: Download processed audio without playing track
Sorry if this is a silly question, but I'm trying to download the output from an audio module after applying effects without having to play the whole track. With the recorder module, it seems like I'm only able to record while the track is playing. Is there any way to process the whole track and get a AudioBuffer or something like that with the effects applied?
Also, do have an estimate on when #18 will be implemented?
Super cool library you've made. Currently working on a new tool on devina.io. Would you like me to plug any of your socials etc when it's done?
@bragle
Thank you for your nice question.
Sorry ... current version cannot record audio without playback.
https://user-images.githubusercontent.com/4006693/176880020-11f8c6da-32bd-4480-aed1-63098c94b6fa.mp4
Maybe, OfflineAudioContext makes it possible (I have this idea (https://github.com/Korilakkuma/XSound/issues/35), but not decide when to implement it ...).
Also, I do not decide when to implement https://github.com/Korilakkuma/XSound/issues/18.
Thanks !
Alrighty. I'm gonna try to implement OfflineAudioContext myself, then. If you wouldn't mind pinging me or just referencing this issue/question if you end up implementing either one of those, that would be sweet 😸
i did discovered this library today and its looks much awesome than tuna, i have no idea how to connect it to audio context so i did open an issue, anyway while scrolling on issues i saw your question i have no idea if i got it right what youre trying to achieve but i have a small code which i did merge from many other tiny codes to make it working what will record a sound from audio context with effects or without, anything comes from the source will be recorded maybe you will find it useful,
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<audio id="HTMLAudioElement" crossOrigin="anonymous" autoplay controls preload="none" src="track.mp3"></audio>
<script src="./recorder.js"></script>
<div id="controls">
<button id="recordButton">Record</button>
<button id="pauseButton" disabled>Pause</button>
<button id="stopButton" disabled>Stop</button>
</div>
<h3>Recordings</h3>
<ol id="RecordingsList"></ol>
<script>
/// DEFINE HTML AUDIO ELEMENT SELECTOR.
let HTMLAudioElement = document.getElementById("HTMLAudioElement");
/// ***** NONE RELATED FUNCTION *****
HTMLAudioElement.oncanplay = function(){
/// new audio context
var anAudioContextObject = new AudioContext();
/// SOURCE
var SourceVariable = anAudioContextObject.createMediaElementSource(HTMLAudioElement);
/// ================================> SIMILAR TO REVERBS (CREATE GAIN).
var gainNode = anAudioContextObject.createGain();
/// CREATE CONNECTION TO WHATEVER THE OBJECT
SourceVariable.connect(gainNode);
gainNode.connect(anAudioContextObject.destination);
///
/// ===============================================================================================
gainNode.gain.value = 0.5;
var rec;
rec = new Recorder(gainNode, {
numChannels: 1
})
rec.record();
setTimeout(function(){
gainNode.gain.value = 0.5;
}, 200);
setTimeout(function(){
rec.stop()
rec.exportWAV(createDownloadLink);
function createDownloadLink(blob) {
var url = URL.createObjectURL(blob);
var li = document.createElement('li');
var link = document.createElement('a');
link.href = url;
link.download = new Date().toISOString() + '.wav';
link.innerHTML = link.download;
RecordingsList.appendChild(li);
}
}, 3000);
};
</script>
</body>
</html>
here is the library to include: https://github.com/mattdiamond/Recorderjs
dont forget to run this code on a real server otherwise it will not run this code is a test, of course change it accordingly, try to combine it with xsound it looks really awesome