Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mayarajan3 committed Jan 5, 2025
1 parent 6c60bef commit f36cf51
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions extensions/src/doodlebot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ writeString(view: DataView, offset: number, text: string) {
}


async sendAudioFileToChatEndpoint(file) {
const url = "https://doodlebot.media.mit.edu/chat";
async sendAudioFileToChatEndpoint() {
const url = "http://doodlebot.media.mit.edu/chat";
// const response = await fetch("https://www.wavsource.com/snds_2020-10-01_3728627494378403/people/comedians/allen_arrogh.wav",
// {
// mode: 'no-cors'
Expand Down Expand Up @@ -711,16 +711,16 @@ writeString(view: DataView, offset: number, text: string) {
return true;
}

async processAndSendAudio(buffer) {
async processAndSendAudio() {
try {
const wavBlob = await this.saveAudioBufferToWav(buffer);
console.log(wavBlob);
const wavFile = new File([wavBlob], "output.wav", { type: "audio/wav" });
// const wavBlob = await this.saveAudioBufferToWav(buffer);
// console.log(wavBlob);
// const wavFile = new File([wavBlob], "output.wav", { type: "audio/wav" });
// const isValid = await this.isValidWavFile(wavFile);
// if (!isValid) {
// throw new Error("Generated file is not a valid WAV file");
// }
await this.sendAudioFileToChatEndpoint(wavFile);
await this.sendAudioFileToChatEndpoint();
} catch (error) {
console.error("Error processing and sending audio:", error);
}
Expand All @@ -733,8 +733,8 @@ writeString(view: DataView, offset: number, text: string) {
arg: { type: "number" }
})
async recordAndPlay(seconds: number) {
const { context, buffer } = await this.doodlebot?.recordAudio(seconds);
await this.processAndSendAudio(buffer);
//const { context, buffer } = await this.doodlebot?.recordAudio(seconds);
await this.processAndSendAudio();
}

@block({
Expand Down

0 comments on commit f36cf51

Please sign in to comment.