Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking β€œSign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/realtime chat #5786

Merged
merged 27 commits into from
Nov 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: ts error
Dogtiti committed Nov 7, 2024
commit 88cd3ac122cfe0a93f3c87e441d9e1e59c8bfb33
4 changes: 4 additions & 0 deletions app/lib/audio.ts
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ export class AudioHandler {
const uint8Data = new Uint8Array(int16Data.buffer);
onChunk(uint8Data);
// save recordBuffer
// @ts-ignore
this.recordBuffer.push.apply(this.recordBuffer, int16Data);
}
};
@@ -95,6 +96,7 @@ export class AudioHandler {
if (!this.isPlaying) return;

const int16Data = new Int16Array(chunk.buffer);
// @ts-ignore
this.playBuffer.push.apply(this.playBuffer, int16Data); // save playBuffer

const float32Data = new Float32Array(int16Data.length);
@@ -155,6 +157,7 @@ export class AudioHandler {
return new Blob([view, data.buffer], { type: "audio/mpeg" });
}
savePlayFile() {
// @ts-ignore
return this._saveData(new Int16Array(this.playBuffer));
}
saveRecordFile(
@@ -168,6 +171,7 @@ export class AudioHandler {
? Math.floor((audioEndMillis * this.sampleRate) / 1000)
: this.recordBuffer.length;
return this._saveData(
// @ts-ignore
new Int16Array(this.recordBuffer.slice(startIndex, endIndex)),
);
}