Browse Source

Remove AudioBuffer use AudioData

master
guest271314 3 years ago
parent
commit
3ec8db404b
No account linked to committer's email address
1 changed files with 2 additions and 8 deletions
  1. 2
    8
      chromium_extension/AudioStream.js

+ 2
- 8
chromium_extension/AudioStream.js 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();
}

Loading…
Cancel
Save