Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pédagogies Multimodales
PhonoDrop
Commits
8fe01163
Commit
8fe01163
authored
Nov 06, 2022
by
Sylvain Coulange
🌼
Browse files
màj synthesevocale js
parent
7cebaf71
Changes
2
Hide whitespace changes
Inline
Side-by-side
public/scripts/phonodrop_v2.js
View file @
8fe01163
// https://jqueryui.com/draggable/#snap-to
// http://jsfiddle.net/fhamidi/PjmJe/1/
let
thisAppli
=
"
phonodrop
"
let
stress1ponderator
=
2
let
stress2ponderator
=
1.5
...
...
public/scripts/syntheseVocale.js
View file @
8fe01163
...
...
@@ -49,6 +49,50 @@ async function playIpa(line="") {
if
(
repphon
!=
"
espace
"
&&
repphon
!=
"
phon_inconnu
"
)
{
ipa
+=
phon2api
[
repphon
]
}
}
if
(
ipa
.
length
>
0
&&
ipa
!=
currentIpa
)
{
synth
=
true
}
}
else
if
(
thisAppli
==
"
phonodrop
"
)
{
// Si quelque chose est écrit...
if
(
group
.
length
>
1
)
{
group
=
sortGroup
(
group
)
// on récupère tous les éléments classe "carte-v2" et on récupère leur classe phon_*
var
ipa
=
""
;
for
(
e
=
0
;
e
<
group
.
length
;
e
++
){
// on parse les classe c de l'élement e
let
newcontent
=
''
;
for
(
c
=
0
;
c
<
group
[
e
].
classList
.
length
;
c
++
){
// si la classe match "phon_.*"" alors on récupère l'équivalent api
if
(
group
[
e
].
classList
[
c
].
match
(
/phon_.*/
)){
newcontent
+=
phon2api
[
group
[
e
].
classList
[
c
]];
}
if
(
group
[
e
].
classList
[
c
].
match
(
/pause/
))
{
// si la classe match "pause" on insert une espace (qui sera convertie en <break> dans text2speech.py)
newcontent
+=
'
'
;
}
if
(
group
[
e
].
classList
[
c
].
match
(
/stress1/
))
newcontent
=
'
ˈ
'
+
newcontent
if
(
group
[
e
].
classList
[
c
].
match
(
/stress2/
))
newcontent
=
'
ˌ
'
+
newcontent
}
ipa
+=
newcontent
}
ipa
=
ipa
.
trim
();
// suppression des espaces en début ou en fin
ipa
=
ipa
.
replace
(
/undefined/g
,
''
)
if
(
ipa
!=
currentIpa
)
{
synth
=
true
}
}
else
if
(
group
.
length
==
1
)
{
// lire phon kinéphones
var
thisPhon
=
""
for
(
c
=
0
;
c
<
group
[
0
].
classList
.
length
;
c
++
){
// si la classe match "phon_.*"" alors on récupère l'équivalent api
if
(
group
[
0
].
classList
[
c
].
match
(
/phon_.*/
)){
thisPhon
=
group
[
0
].
classList
[
c
]
}
}
console
.
log
(
'
Lecture Kinephones
'
,
thisPhon
,
phon2api
[
thisPhon
])
var
audio
=
new
Audio
(
"
audio/
"
+
lang
+
"
_
"
+
thisPhon
+
"
-f.mp3
"
)
audio
.
play
()
}
}
if
(
synth
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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