[Ex] Synthèse vocale online (pour le fun)
Posté : mar. 31 mai 2016 21:47
Mettez le son, assurément
Edit Tlem :
Ne semble plus fonctionner fin 2017 (voir les derniers sujets)
Code : Tout sélectionner
$file = @tempdir & "\voxygen_test.mp3"
$voice = "Moussa"
$str = "Vahazi, non mais vahazi, tu es encore à traîner sur ton forum auto-hit présentement, " & _
"au lieu d'exécuter ton travail. C'est carrément totafi scandaleux. Assurément."
$text = _format($str)
_PlayText($file, $text, $voice)
Func _PlayText($file, $text, $voice)
FileDelete($file)
$url = "https://www.voxygen.fr/sites/all/modules/voxygen_voices/assets/proxy/index.php?" & _
"method=redirect&text=" & $text & "&voice=" & $voice
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("GET", $url)
$oHTTP.Send()
$sData = $oHTTP.ResponseBody()
$oHTTP = 0
FileWrite($file, $sData)
SoundPlay($file, 1)
EndFunc
Func _format($str)
Local $a[18][2] = [ _
[" ", "+"], _
["!", "%21"], _
["'", "%27"], _
[",", "%2C"], _
["-", "%2D"], _
[".", "%2E"], _
["?", "%3F"], _
["à", "%C3%A0"], _
["â", "%C3%A2"], _
["ç", "%C3%A7"], _
["è", "%C3%A8"], _
["é", "%C3%A9"], _
["ê", "%C3%AA"], _
["î", "%C3%AE"], _
["ô", "%C3%B4"], _
["ù", "%C3%B9"], _
["û", "%C3%BB"], _
["ü", "%C3%BC"]]
For $i = 0 to 17
$str = StringReplace($str, $a[$i][0], $a[$i][1])
Next
Return $str
EndFunc
Ne semble plus fonctionner fin 2017 (voir les derniers sujets)