-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94a6595
commit d1582b5
Showing
21 changed files
with
746 additions
and
2,220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,7 @@ yarn-debug.log* | |
yarn-error.log* | ||
|
||
# env file | ||
.env | ||
.env | ||
|
||
# Custom | ||
skku-qr-c22c2419e905.json |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import axios from 'axios'; | ||
|
||
export default async function voiceTTS(text) { | ||
axios.defaults.headers['Access-Control-Allow-Origin'] = '*'; | ||
const response = await axios.post( | ||
`https://texttospeech.googleapis.com/v1/text:synthesize?key=${process.env.REACT_APP_GOOGLE_APPLICATION_CREDENTIALS}`, | ||
{ | ||
input: { | ||
text: text, | ||
}, | ||
voice: { | ||
languageCode: 'ko-KR', | ||
ssmlGender: 'FEMALE', | ||
}, | ||
audioConfig: { | ||
audioEncoding: 'LINEAR16', | ||
speakingRate: 1, | ||
}, | ||
}, { | ||
headers: { | ||
|
||
} | ||
} | ||
); | ||
|
||
console.log(response); | ||
// Write the binary audio content to a local file | ||
const newAudio = new Audio( | ||
'data:audio/wav;base64,' + response.data?.audioContent | ||
); | ||
|
||
newAudio.play(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.