How to downsample audio recorded from mic realtime in javascript?
问题 I am using following javascript to record audio and send it to a websocket server: const recordAudio = () => new Promise(async resolve => { const constraints = { audio: { sampleSize: 16, channelCount: 1, sampleRate: 8000 }, video: false }; var mediaRecorder; const stream = await navigator.mediaDevices.getUserMedia(constraints); var options = { audioBitsPerSecond: 128000, mimeType: 'audio/webm;codecs=pcm' }; mediaRecorder = new MediaRecorder(stream, options); var track = stream.getAudioTracks(