I have audio data in format of data-uri, then I converted this data-uri into a buffer now I need this buffer data in new samplerate, currently audio data is in 44.1khz and I nee
if you are using chrome browser you can directly specify sample rate in AudioContext .
1.You can directly record sound via microphone .
var context = new AudioContext({
sampleRate: 16000,
});
2.If you already has a file or ArrayBuffer .Then you can resample it using the same audio context
const fileReader = new FileReader();
fileReader.readAsArrayBuffer(target.files[0]);
fileReader.onload = (e) => {
//e.target.result is an ArrayBuffer
context.decodeAudioData(e.target.result, async function(buffer) {
console.log(buffer)
})