Toggle navigation
Toggle navigation
This project
Loading...
Sign in
민병수
/
Voicoding
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
천현우
2021-06-06 21:39:09 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
944eecfca9c37b2ae542cd87c4b43fdd58faca2a
944eecfc
2 parents
76d2bc1f
f8501aad
Transctipt ttp
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
6 deletions
Voicoding_web/Voico_Home.html
Voicoding_web/client.js
Voicoding_web/js/ide.js
Voicoding_web/js/package-lock.json
Voicoding_web/Voico_Home.html
View file @
944eecf
...
...
@@ -13,7 +13,6 @@
<link
href=
"https://fonts.googleapis.com/css2?family=Raleway:wght@200&display=swap"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css2?family=Noto+Serif+KR&family=Raleway:wght@200&display=swap"
rel=
"stylesheet"
>
<script
defer
src=
"https://cdn.rawgit.com/mattdiamond/Recorderjs/08e7abd9/dist/recorder.js"
></script>
<script
defer
src=
"client.js"
></script>
<meta
name=
"description"
content=
"Free and open-source online code editor that allows you to write and execute code from a rich set of languages."
>
<meta
name=
"keywords"
content=
"online editor, online code editor, online ide, online compiler, online interpreter, run code online, learn programming online,
online debugger, programming in browser, online code runner, online code execution, debug online, debug C code online, debug C++ code online,
...
...
@@ -94,7 +93,7 @@
<div
class=
"output_bar"
>
<h2>
Transcription Raw Data
</h2>
</div>
<div
id=
"output"
style=
"overflow:auto
;
"
></div>
<div
id=
"output"
style=
"overflow:auto"
></div>
<i
class=
"fas fa-arrow-circle-down"
></i>
<div
class=
"output_bar"
>
<h2>
TTP
</h2>
...
...
Voicoding_web/client.js
View file @
944eecf
...
...
@@ -27,13 +27,18 @@ function transcribeText() {
audioStream
.
getAudioTracks
()[
0
].
stop
();
rec
.
exportWAV
(
uploadSoundData
);
}
let
px
=
0
;
let
input_line
=
""
function
uploadSoundData
(
blob
)
{
let
filename
=
new
Date
().
toISOString
();
let
xhr
=
new
XMLHttpRequest
();
let
formData
=
new
FormData
();
xhr
.
onload
=
function
(
e
)
{
if
(
this
.
readyState
===
4
)
{
document
.
getElementById
(
"output"
).
innerHTML
+=
`
${
cnt
++
}
:
${
JSON
.
parse
(
e
.
target
.
responseText
)}
<br><br>`
;
input_line
+=
'print("hello")'
;
sourceEditor
.
setValue
(
input_line
);
}
};
formData
.
append
(
"audio_data"
,
blob
,
filename
);
...
...
Voicoding_web/js/ide.js
View file @
944eecf
...
...
@@ -400,7 +400,7 @@ function changeEditorLanguage() {
function
insertTemplate
()
{
currentLanguageId
=
parseInt
(
71
);
sourceEditor
.
setValue
(
sources
[
currentLanguageId
]
);
//sourceEditor.setValue(sources[currentLanguageId]+'\n'+'print("hello world")'
);
changeEditorLanguage
();
}
...
...
@@ -1336,3 +1336,51 @@ var languageApiUrlTable = {
1023
:
extraApiUrl
,
1024
:
extraApiUrl
}
let
rec
=
null
;
let
audioStream
=
null
;
const
recordButton
=
document
.
getElementById
(
"recordButton"
);
const
transcribeButton
=
document
.
getElementById
(
"transcribeButton"
);
recordButton
.
addEventListener
(
"click"
,
startRecording
);
transcribeButton
.
addEventListener
(
"click"
,
transcribeText
);
let
cnt
=
1
;
function
startRecording
()
{
let
constraints
=
{
audio
:
true
,
video
:
false
}
recordButton
.
disabled
=
true
;
transcribeButton
.
disabled
=
false
;
navigator
.
mediaDevices
.
getUserMedia
(
constraints
).
then
(
function
(
stream
)
{
const
audioContext
=
new
window
.
AudioContext
();
audioStream
=
stream
;
const
input
=
audioContext
.
createMediaStreamSource
(
stream
);
rec
=
new
Recorder
(
input
,
{
numChannels
:
1
})
rec
.
record
()
}).
catch
(
function
(
err
)
{
recordButton
.
disabled
=
false
;
transcribeButton
.
disabled
=
true
;
});
}
function
transcribeText
()
{
transcribeButton
.
disabled
=
true
;
recordButton
.
disabled
=
false
;
rec
.
stop
();
audioStream
.
getAudioTracks
()[
0
].
stop
();
rec
.
exportWAV
(
uploadSoundData
);
}
let
px
=
0
;
let
input_line
=
""
function
uploadSoundData
(
blob
)
{
let
filename
=
new
Date
().
toISOString
();
let
xhr
=
new
XMLHttpRequest
();
let
formData
=
new
FormData
();
xhr
.
onload
=
function
(
e
)
{
if
(
this
.
readyState
===
4
)
{
document
.
getElementById
(
"output"
).
innerHTML
+=
`
${
cnt
++
}
:
${
JSON
.
parse
(
e
.
target
.
responseText
)}
<br><br>`
;
input_line
+=
'print("hello")\n'
;
sourceEditor
.
setValue
(
input_line
);
}
};
formData
.
append
(
"audio_data"
,
blob
,
filename
);
xhr
.
open
(
"POST"
,
"/upload_sound"
,
true
);
xhr
.
send
(
formData
);
}
\ No newline at end of file
...
...
Voicoding_web/js/package-lock.json
deleted
100644 → 0
View file @
76d2bc1
{
"lockfileVersion"
:
1
}
Please
register
or
login
to post a comment