TTS

    TTS 자바스크립트로 구현하기

    자바스크립트로 TTS를 구현하는 코드입니다. window 객체를 사용해야하므로 next.js로 ssr를 구현하시는 분은 추가적인 작업이 필요합니다. export const textToSpeech = (text: string, isActionHandler: (isAction: boolean) => void) => { const synthesis = window.speechSynthesis; const utterance = new SpeechSynthesisUtterance(text); utterance.lang = "ko-KR"; utterance.onend = function (event) { isActionHandler(false); }; synthesis.speak(utterance); }; 해당 함..