Notice
Recent Posts
Recent Comments
Link
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Archives
Today
Total
04-25 18:24
관리 메뉴

zyint's blog

Synthesis markup 본문

예전글들

Synthesis markup

진트­ 2009. 3. 14. 10:04

Synthesis markup

SAPI 5 synthesis markup은 XML 태그를 사용하여 볼륨, 음조, 속도와 같은 음성 합성 속성 값을 변경할 수 있다. 이 기능을 사용하려면, ISpVoice::Speak 함수 호출시 텍스트안에 XML태그를 추가하여 전달하면 된다. 텍스트 스트림 포맷을 SPDFID_XML로 지정하고 ISpVoice::SpeakStream에 전달하면 된다. 기본적으로 SAPI XML 파서는 XML을 자동으로 인식한다. 잘못된 XML 구조일경우, 음성합성시에 오류를 반환하게 된다. SAPI는 XML 구조가 유효한지 검증하려는 의도로 만들어지지 않았다. 따라서 개발자가 XML의 유효성을 XML validation tool을 이용해서 처리할 책임이 있다. 더 자세한 내용은 ISpVoice에 있다.

 

SAPI 5 synthesis markup은 XML의 응용프로그램이다. 모든 XML 엘리먼트들의 시작 태그는 <Some_Tag>로 시작하고 종료하는 태그는 </Some_tag>로 종료한다. 이 태그들은 대소문자를 구분한다. 만약 엘리먼트 사이에 값이 없다면 <Some_tag></Some_tag>로 나타낼 수 있는데 <Some_tag/>와 같이 간단하게 표현할 수 있다. XML에 대한 자세한 내용은  http://www.w3.org/TR/1998/REC-xml-19980210.html에 설명되어 있다.

 

SAPI 5 XML 태그

SAPI 5 XML 태그는 다음과같이 4가지 종류로 나눌 수 있다.

1. Non-scoped

2. Scoped

3. Global

4. Scoped/Global

 

Attributes

XML 엘리먼트의 속성값을 시작 태그 부분에 넣는다. 속성값은 속성값의 이름과 등호 문자(=)와 따옴표(")로 묶인 문자열 값이 오게 된다. 주어진 속성 값은 시작 태그에 한 번만 나타나게 된다. 속성 값으로 지정될 수 있는 문자는 http://www.w3.org/TR/REC-xml#NT-AttValue에서 찾을 수 있다.

 

위 주소의 내용을 간단히 말하면, 속성 값에 작다는 뜻의 부등호(<") 문자를 포함할 수 없다. 만일 속성 값이 쌍따옴표(")로 묶여있다면 쌍따옴표를 속성값  문자를 쓸수 없고, 홑따옴표(')로 묶여있으면 속성값에 홑따옴표를 포함할 수 없다. 또한, &문자는 &amp;나  &gt; 처럼 entity를 나타낼 때만 사용할 수 있다. 문자열을 파싱할 때, 각 엔티티문자들은 원래의 문자로 치환된다. 예를들어 &gt;는 '>"로 치환된다.

 

In this specification, only the resulting replacement text needs to be defined for attribute value strings. The XML specification defines the exact file syntax details. Character references allow entity references in ASCII characters to specify replacement text which has unprintable characters such as extended Unicode characters. The entity reference "&#x0259;" specifies the single Unicode character for the International Phonetic Alphabet symbol for a mid-central unrounded vowel. See http://www.w3.org/TR/1998/REC-xml-19980210#sec-references for details.

 

<LANG>, <VOICE> XML 태그는 마이크로소프트 엔진에서 지원하는 언어와 음성의 목소리에 대한 속성 값을 지원하기 위해 제공된다.

다음 예제는 409;9가 나타내는 것과 XML 태그를 얼마나 정확하게 사용할 수 있는지를 나타내는 예제이다.

 

<LANG LANGID="409">This is the US English language</LANG>
<LANG LANGID="9">This is the English Language</LANG>
<VOICE REQUIRED="language=409">This is the required voice for the US English language</VOICE>
<VOICE REQUIRED="language=9">This is the required voice that speaks in any dialect of the English language</VOICE>

윈도우 레지스트리에서 SAPI 5 영어 목소리 엔진의 language 속성값은 409;9이다. 409는 음성이 US English임을 나타내고 9는 English 임을 나타낸다. 목소리 언어별 레이블 규칙은 엔진을 만드는 모든 개발회사에서 지키지는 않는다. 예를 들어 LH voice는 영어 목소리임을 나타내데 409를 사용한다. 반면 마이크로소프트에서는 구체적으로 US English임을 409;9로 표현하여 나타낸다.

 

예:

409;9 = US English
809;9 = British English

레지스트리로 다음 경로로 가보면 속성 정보를 볼 수 있다. MSMary 목소리의 속성 값은 다음과 같다.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens

 

ms723638.MS_Mary_Attributes(en-us,VS.85).gif

Contents

<Some_Tag> Contents </Some_Tag>

엘리먼트의 내용은 텍스트나 서브 엘리먼트들로 구성되어 있다. With these definitions, the XML specification defines the exact file syntax details.

 

HTML 웹 페이지와 SABLE과의 관계

The XML format that SAPI 5 uses is NOT placed inside web pages. Web page authors who want to mark up sections of HTML text so that it is synthesized correctly, should use the W3C Aural Cascading Style Sheets (ACSS). More information is available at: http://www.w3.org/TR/WD-acss

 

SAPI applications that are synthesizing text from a web page will "render" HTML+ACSS into SAPI's synthesis markup format. Programs apply a default ACSS file when synthesizing web pages that do not have an associated ACSS file.

 

SAPI 5 synthesis markup format is similar to the format published by the SABLE Consortium. However, this format and SABLE version 1.0 are not interoperable. At this time, it's not determined if they will become partially interoperable in the future. More information about the SABLE specification is available at: http://www.bell-labs.com/project/tts/sable.html.

 

 

참고자료

http://msdn.microsoft.com/en-us/library/ms723638(VS.85).aspx

 

이 글은 스프링노트에서 작성되었습니다.

Comments