I have written the code but it does not work.
Also, I don't know if the code is wrong or how to receive the audio file after resampling.
I would appreciate any advice you could give me.
`
<script>
var audioData = [test.mp3]; //audio file in my local
var bufferSize =1024;
var context = new AudioContext();
var oldSampleRate = context.sampleRate, newSampleRate = 16000;
processor.onaudioprocess = function(e){
var inputData = e.inputBuffer.getChannelData(0);
var ResampleData = interpolateArray(inputData, inputData.length * (newSampleRate/oldSampleRate) );
bufferSize = inputData.length * (newSampleRate/oldSampleRate);
var bufferData = new Float32Array(bufferSize);
for (var i = 0; i < bufferSize; i++) {
bufferData[i] = ResampleData[i];
}
audioData.push(bufferData);
};
//How do I receive the finished data?
var newaudio = "???"
</script>`
Top comments (0)