Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bluejoyq
/
searchGuide
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
윤창신
2019-12-03 19:09:36 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c76d00d2e5e2719819f126952a8e79427637ea01
c76d00d2
1 parent
e39f8402
complete STT.js
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
api/STT.js
api/STT.js
View file @
c76d00d
...
...
@@ -4,6 +4,15 @@ const isBase64 = require('is-base64');
const
fs
=
require
(
"fs"
);
//const Mp32Wav = require('mp3-to-wav')
/**
* @param {Object} clientData 클라이언트에서 보낸 데이터
* @param {String} clientData.audio base64로 인코딩된 음성 데이터 16hz로 샘플링 되야함
* @returns {text:String} 음성을 인식한 결과
* @description 음성 인식을 요청해 결과를 내놓는 함수이다.
*/
const
apiReq
=
async
(
clientData
)
=>
{
fs
.
writeFileSync
(
'./audio/audio_input.mp3'
,
Buffer
.
from
(
clientData
.
audio
.
replace
(
'data:audio/mp3; codecs=opus;base64,'
,
''
),
'base64'
));
const
mp32Wav
=
new
Mp32Wav
(
'./audio/audio_input.mp3'
)
...
...
@@ -23,6 +32,11 @@ const apiReq = async ( clientData ) => {
return
{
"text"
:
getSTT
.
return_object
.
recognized
};
}
/**
* @param req request
* @param req.bdoy.data req.body.data.audio에 요청하는 데이터가 들어있어야한다
* @description 오디로를 텍스트로 바꿔준다.
*/
const
STT
=
async
(
req
,
res
)
=>
{
let
clientData
,
voiceTemp
;
...
...
Please
register
or
login
to post a comment