Skip to content

Commit

Permalink
chore: 메세지 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hmmhmmhm committed Apr 10, 2023
1 parent d030fbd commit 46d52e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/evangelist/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import fs from "fs";
import { userRequest } from "../input.js";
import { logger } from "../utils/logger.js";
import { doTechEvangelistWork } from "./work.js";
import fs from "fs";
import { speak } from "../utils/speak.js";

export const doTechEvangelist = async () => {
logger("테크 에반젤리스트에 의한 기획서 보충이 진행 중입니다...");
await speak("테크 에반젤리스트에 의한 기획서 보충이 진행 중입니다...");

const resultFolderPath = "./result";
const resultFiles = await fs.promises.readdir(resultFolderPath);
Expand All @@ -30,4 +32,5 @@ export const doTechEvangelist = async () => {
`----USER REQUEST\n${userRequest}\n${evangelist}`
);
logger("테크 에반젤리스트에 의한 기획서 보충이 완료되었습니다.");
await speak("테크 에반젤리스트에 의한 기획서 보충이 완료되었습니다.");
};
12 changes: 4 additions & 8 deletions src/utils/speak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ import sound from "sound-play";

export const speak = async (text: string) => {
try {
await new Promise<void>((resolve, reject) => {
await new Promise<void>((resolve) => {
const audioFile = "./dist/_.wav";
// This example requires environment variables named "SPEECH_KEY" and "SPEECH_REGION"
const speechConfig = sdk.SpeechConfig.fromSubscription(
process.env.AZURE_SPEECH_KEY,
process.env.AZURE_SPEECH_REGION
);
const audioConfig = sdk.AudioConfig.fromAudioFileOutput(audioFile);

// The language of the voice that speaks.
speechConfig.speechSynthesisVoiceName = process.env.AZURE_SPEECH_VOICE;

// Create the speech synthesizer.
var synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);
let synthesizer = new sdk.SpeechSynthesizer(speechConfig, audioConfig);

synthesizer.speakTextAsync(
text,
Expand All @@ -29,15 +25,15 @@ export const speak = async (text: string) => {
const absoultePath = fs.realpathSync(audioFile);
await sound.play(absoultePath, 1);
} else {
console.error(
throw new Error(
"Speech synthesis canceled, " +
result.errorDetails +
"\nDid you set the speech resource key and region values?"
);
}
resolve();
},
function (err) {
(err) => {
console.trace("err - " + err);
synthesizer.close();
synthesizer = null;
Expand Down

0 comments on commit 46d52e8

Please sign in to comment.