Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
2a813431
Unverified
Commit
2a813431
authored
Jun 02, 2022
by
Wolle
Committed by
GitHub
Jun 02, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #323 from ojaksch/master
New TTS provider MaryTTS
parents
c33c4c01
1bb0ff7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
src/Audio.cpp
src/Audio.cpp
+53
-0
src/Audio.h
src/Audio.h
+1
-0
No files found.
src/Audio.cpp
View file @
2a813431
...
@@ -787,6 +787,59 @@ bool Audio::connecttospeech(const char* speech, const char* lang){
...
@@ -787,6 +787,59 @@ bool Audio::connecttospeech(const char* speech, const char* lang){
return
true
;
return
true
;
}
}
//---------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------
bool
Audio
::
connecttomarytts
(
const
char
*
speech
,
const
char
*
lang
,
const
char
*
voice
){
setDefaults
();
char
host
[]
=
"mary.dfki.de"
;
char
path
[]
=
"/process"
;
int
port
=
59125
;
uint16_t
speechLen
=
strlen
(
speech
);
uint16_t
speechBuffLen
=
speechLen
+
300
;
memcpy
(
m_lastHost
,
speech
,
256
);
char
*
speechBuff
=
(
char
*
)
malloc
(
speechBuffLen
);
if
(
!
speechBuff
)
{
log_e
(
"out of memory"
);
return
false
;}
memcpy
(
speechBuff
,
speech
,
speechLen
);
speechBuff
[
speechLen
]
=
'\0'
;
urlencode
(
speechBuff
,
speechBuffLen
);
char
resp
[
strlen
(
speechBuff
)
+
200
]
=
""
;
strcat
(
resp
,
"GET "
);
strcat
(
resp
,
path
);
strcat
(
resp
,
"?INPUT_TEXT="
);
strcat
(
resp
,
speechBuff
);
strcat
(
resp
,
"&INPUT_TYPE=TEXT"
);
strcat
(
resp
,
"&OUTPUT_TYPE=AUDIO"
);
strcat
(
resp
,
"&AUDIO=WAVE_FILE"
);
strcat
(
resp
,
"&LOCALE="
);
strcat
(
resp
,
lang
);
strcat
(
resp
,
"&VOICE="
);
strcat
(
resp
,
voice
);
strcat
(
resp
,
" HTTP/1.1
\r\n
"
);
strcat
(
resp
,
"Host: "
);
strcat
(
resp
,
host
);
strcat
(
resp
,
"
\r\n
"
);
strcat
(
resp
,
"User-Agent: Mozilla/5.0
\r\n
"
);
strcat
(
resp
,
"Accept-Encoding: identity
\r\n
"
);
strcat
(
resp
,
"Accept: text/html
\r\n
"
);
strcat
(
resp
,
"Connection: close
\r\n\r\n
"
);
free
(
speechBuff
);
_client
=
static_cast
<
WiFiClient
*>
(
&
client
);
if
(
!
_client
->
connect
(
host
,
port
))
{
log_e
(
"Connection failed"
);
return
false
;
}
_client
->
print
(
resp
);
m_f_webstream
=
true
;
m_f_running
=
true
;
m_f_ssl
=
false
;
m_f_tts
=
true
;
setDatamode
(
AUDIO_HEADER
);
return
true
;
}
//---------------------------------------------------------------------------------------------------------------------
void
Audio
::
urlencode
(
char
*
buff
,
uint16_t
buffLen
,
bool
spacesOnly
)
{
void
Audio
::
urlencode
(
char
*
buff
,
uint16_t
buffLen
,
bool
spacesOnly
)
{
uint16_t
len
=
strlen
(
buff
);
uint16_t
len
=
strlen
(
buff
);
...
...
src/Audio.h
View file @
2a813431
...
@@ -160,6 +160,7 @@ public:
...
@@ -160,6 +160,7 @@ public:
void
setBufsize
(
int
rambuf_sz
,
int
psrambuf_sz
);
void
setBufsize
(
int
rambuf_sz
,
int
psrambuf_sz
);
bool
connecttohost
(
const
char
*
host
,
const
char
*
user
=
""
,
const
char
*
pwd
=
""
);
bool
connecttohost
(
const
char
*
host
,
const
char
*
user
=
""
,
const
char
*
pwd
=
""
);
bool
connecttospeech
(
const
char
*
speech
,
const
char
*
lang
);
bool
connecttospeech
(
const
char
*
speech
,
const
char
*
lang
);
bool
connecttomarytts
(
const
char
*
speech
,
const
char
*
lang
,
const
char
*
voice
);
bool
connecttoFS
(
fs
::
FS
&
fs
,
const
char
*
path
,
uint32_t
resumeFilePos
=
0
);
bool
connecttoFS
(
fs
::
FS
&
fs
,
const
char
*
path
,
uint32_t
resumeFilePos
=
0
);
bool
connecttoSD
(
const
char
*
path
,
uint32_t
resumeFilePos
=
0
);
bool
connecttoSD
(
const
char
*
path
,
uint32_t
resumeFilePos
=
0
);
bool
setFileLoop
(
bool
input
);
//TEST loop
bool
setFileLoop
(
bool
input
);
//TEST loop
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment