PulseSync Audio Alternator
script>
document.getElementById('uploadForm').addEventListener('submit', async (e) => {
e.preventDefault();
const formData = new FormData(e.target);
try {
const response = await fetch('/process-audio', {
method: 'POST',
body: formData
});
if (response.ok) {
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'output.mp3';
a.textContent = 'Download Processed Audio';
document.getElementById('result').appendChild(a);
} else {
document.getElementById('result').textContent = 'Error processing audio.';
}
} catch (error) {
document.getElementById('result').textContent = 'An error occurred: ' + error.message;
}
});