Skip to content
Open
Changes from all commits
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
8 changes: 5 additions & 3 deletions src/google-tts-effect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { tmpDir, wait } from "./utils";
import voices from "./voices";
import ng from "angular";
import { v4 as uuid } from "uuid";
import * as fs from "fs";
import * as path from "path";

interface EffectScope extends ng.IScope {
/** `true` when the voice is guaranteed to utilize a Chirp voice model; `false` when a variable
Expand Down Expand Up @@ -45,7 +47,7 @@ export function buildGoogleTtsEffectType(
settings: FirebotSettings,
getApiKey: () => string
) {
const { eventManager, frontendCommunicator, fs, httpServer, path, resourceTokenManager } = modules;
const { eventManager, frontendCommunicator, httpServer, resourceTokenManager } = modules;

const googleTtsEffectType: EffectType<EffectModel, never, SynthesisResult> = {
definition: {
Expand Down Expand Up @@ -385,7 +387,7 @@ export function buildGoogleTtsEffectType(
}
if (!audioContent) {
return effectResult(false);
}
}

// save audio content to file
const filePath = path.join(tmpDir, `tts${uuid()}.mp3`);
Expand All @@ -397,7 +399,7 @@ export function buildGoogleTtsEffectType(
let soundDuration: number = undefined;
try {
soundDuration = await frontendCommunicator.fireEventAsync<number>(
"getSoundDuration", {
"getSoundDuration", {
format: "mp3",
path: filePath
}
Expand Down