2014-02-22 3 views
9

Web Speech API specification와 SSML를 사용하는 올바른 방법은 말한다 :웹 음성 API

텍스트 속성
이 속성은이 발언에 대해 말한 합성 할 텍스트와 를 지정합니다. 이것은 일반 텍스트이거나 형식의 완전한 형식의 SSML 문서 일 수 있습니다. 은 SSML을 지원하지 않거나 특정 태그 만 지원하기 때문에 사용자 상담원 또는 음성 엔진은 을 지원하지 않는 태그를 제거하고 텍스트를 말해야합니다.

text을 SSML 문서와 함께 사용하는 예는 제공하지 않습니다.

나는 크롬 (33)에 다음과 같은 시도 :

var msg = new SpeechSynthesisUtterance(); 
msg.text = '<?xml version="1.0"?>\r\n<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US">ABCD</speak>'; 
speechSynthesis.speak(msg); 

그것은 작동하지 않았다을 - 음성은 XML 태그를 서술하려고했습니다. 이 코드가 유효합니까?
대신 XMLDocument 개체를 제공해야합니까?

Chrome이 사양 (버그로보고해야 함)을 위반하는지 여부 또는 코드가 유효하지 않은지 여부를 파악하려고합니다.

+0

혹시이 문제를 해결 했 : 다음은 C#을 조각은 LinqPad에서 사용하기에 적합하다? SSML과 크롬에서 가장 가까운 것은 크롬 플러그인 음성 합성을위한 문서입니다. https://developer.chrome.com/extensions/tts – ElDog

+0

또한 Linux를 사용하고 있습니다. 거기에 문제가있을 수 있으므로 https://code.google.com/p/chromium/issues/detail?id=88072 – ElDog

+0

@ElDog 내가 발견 한 모든 버그는 (나는 거기에 주석을 달았습니다) - 방법은 btw Mac/Win에서도 구현되지 않은 설명을 읽었습니다. –

답변

4

Chrome 46에서 XML은 언어가 en으로 설정된 경우 Windows에서 XML 문서로 올바르게 해석됩니다. 그러나 태그가 실제로 어떤 작업을 수행하고 있다는 증거는 없습니다.

var msg = new SpeechSynthesisUtterance(); 
msg.text = '<?xml version="1.0"?>\r\n<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="en-US"><emphasis>Welcome</emphasis> to the Bird Seed Emporium. Welcome to the Bird Seed Emporium.</speak>'; 
msg.lang = 'en'; 
speechSynthesis.speak(msg); 

<phoneme> 태그도 완전히 무시, IPA가 실패 할 말을 내 시도했다 :이 SSML의 <emphasis> 및 비 <emphasis> 버전 간의 차이를 듣지 않았다.

var msg = new SpeechSynthesisUtterance(); 
msg.text='<?xml version="1.0" encoding="ISO-8859-1"?> <speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/10/synthesis http://www.w3.org/TR/speech-synthesis/synthesis.xsd" xml:lang="en-US"> Pavlova is a meringue-based dessert named after the Russian ballerina Anna Pavlova. It is a meringue cake with a crisp crust and soft, light inside, usually topped with fruit and, optionally, whipped cream. The name is pronounced <phoneme alphabet="ipa" ph="p&aelig;v&#712;lo&#650;v&#601;">...</phoneme> or <phoneme alphabet="ipa" ph="p&#593;&#720;v&#712;lo&#650;v&#601;">...</phoneme>, unlike the name of the dancer, which was <phoneme alphabet="ipa" ph="&#712;p&#593;&#720;vl&#601;v&#601;">...</phoneme> </speak>'; 
msg.lang = 'en'; 
speechSynthesis.speak(msg); 

이는 Microsoft 음성 API 가 제대로 SSML을 처리 않는다는 사실에도 불구하고.

var str = "Pavlova is a meringue-based dessert named after the Russian ballerina Anna Pavlova. It is a meringue cake with a crisp crust and soft, light inside, usually topped with fruit and, optionally, whipped cream. The name is pronounced /pævˈloʊvə/ or /pɑːvˈloʊvə/, unlike the name of the dancer, which was /ˈpɑːvləvə/."; 
var regex = new Regex("/([^/]+)/"); 
if (regex.IsMatch(str)) 
{ 
    str = regex.Replace(str, "<phoneme alphabet=\"ipa\" ph=\"$1\">word</phoneme>"); 
    str.Dump(); 
} 
SpeechSynthesizer synth = new SpeechSynthesizer(); 
PromptBuilder pb = new PromptBuilder(); 
pb.AppendSsmlMarkup(str); 
synth.Speak(pb); 
+0

같은 문제가 있습니다. – Griffork

+0

현재 Chrome 55.0에서는 XML을 인식하지 못합니다. 내 말하기 (msg)는 "questionmark ex em el 버전보다 작은 따옴표 하나의 인용문 따옴표 ..."와 같은 것을 말합니다. –

+0

SSML이 아직 지원되지 않는다고 생각합니다. ( – Shu

4

현재 Chromium에서 열어 본이 문제에 대한 버그가 있습니다.

  • 88072 : 알 수없는 태그이 버그는
9월 2016 년 기준으로 크롬에서 수정되었습니다을 제거하지 않습니다 speechSynthesis.speak() : 확장 TTS API 플랫폼 구현 SSML
  • 428902을 지원해야
  • +1

    그리고 428902 퇴행 :/아직 여기 있습니다. . – Qix