Remove AudioBuffer use AudioData

This commit is contained in:
guest271314
2021-07-24 21:44:46 -07:00
committed by GitHub
parent b148a7ad1f
commit 3ec8db404b
+2 -8
View File
@@ -221,21 +221,15 @@ class AudioStream {
int >= 0x8000 ? -(0x10000 - int) / 0x8000 : int / 0x7fff;
floats[i] = float;
}
const buffer = new AudioBuffer({
numberOfChannels: this.numberOfChannels,
length: floats.length,
sampleRate: this.sampleRate,
});
buffer.getChannelData(0).set(floats);
this.duration += buffer.duration;
const frame = new AudioData({
format: 'FLTP',
sampleRate: 22050,
numberOfChannels: 1,
numberOfFrames: 220,
timestamp,
data: buffer.getChannelData(0),
data: floats,
});
this.duration += (frame.duration / 10**6);
if (this.recorder && this.recorder.state === 'inactive') {
this.recorder.start();
}