how to use Speech Synthesis Markup Language? - html

I want to create web base text to speech app.
i am using this code but nothing happen plz help me
<?xml version="1.0"?>
<!DOCTYPE speak PUBLIC "-//W3C//DTD SYNTHESIS 1.0//EN"
"http://www.w3.org/TR/speech-synthesis/synthesis.dtd">
<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">
<p>
<s>You have 4 new messages.</s>
<s>The first is from Stephanie Williams and arrived at <break/> 3:45pm.
</s>
<s>
The subject is <prosody rate="-20%">ski trip</prosody>
</s>
</p>
</speak>

Use a platform which supports SSML, such as:
FreeTTS/Java Web Start
Windows/SAPI
Windows Phone 8
iOS
An ePub3 reader
References
Speech for Windows Phone 8
Producing Speech Output
epub3: SSML Attributes
Using FreeTTS in a web application
SSML using Chrome TTS
How to slow down text to Speech with SSML - voice sounds distorted/warped/ghastly

Related

How to display styled print out of XML on website

I am using some XML and I want to display it on site, But will prefer to display some styled version. Let's say in some boostrap table or something like that but somehow i have no clue how.
Example XML:
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>W3Schools Home Page</title>
<link>http://www.w3schools.com</link>
<description>Free web building tutorials</description>
<item>
<title>RSS Tutorial</title>
<link>http://www.w3schools.com/rss</link>
<description>New RSS tutorial on W3Schools</description>
</item>
<item>
<title>XML Tutorial</title>
<link>http://www.w3schools.com/xml</link>
<description>New XML tutorial on W3Schools</description>
</item>
</channel>
</rss>
So let's say I have this XML, and i want to style it to table where will be:
Title | Link | Desc
W3Schools Home Page | http://www.w3schools.com/rss | New RSS tutorial on W3Schools
XML Tutorial | http://www.w3schools.com/xml | New XML tutorial on W3Schools
Can you give me some inditions or some can someone write example code for me to make it more clear.
I hope I don't ask for too much. Thank you all !!
Traditionally this done with an XSLT which is an instruction sheet for the browser to converts the xml into html automagically.
Checkout out:
https://greenbytes.de/tech/tc/xslt/
...for some great links to book and additional information.
There are some working examples at:
http://www.w3schools.com/xsl/xsl_examples.asp

Windows Runtime equivalent to the Silverlight PhoneSubtleBrush

In Silverlight there is the PhoneSubtleBrush which is the color used in the Mail app to display the message excerpt below the subject.
Is there something in the Windows Runtime API that has the same color as PhoneSubtleBrush?
Not sure if it's exactly the same but I've been using ListViewItemSubheaderTextBlockStyle so far.

The right way to use SSML with Web Speech API

Web Speech API specification says:
text attribute
This attribute specifies the text to be synthesized and
spoken for this utterance. This may be either plain text or a
complete, well-formed SSML document. For speech synthesis engines
that do not support SSML, or only support certain tags, the user
agent or speech engine must strip away the tags they do not support
and speak the text.
It does not provide an example of using text with an SSML document.
I tried the following in Chrome 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);
It did not work -- the voice attempted to narrate the XML tags. Is this code valid?
Do I have to provide a XMLDocument object instead?
I am trying to understand whether Chrome violates the specification (which should be reported as a bug), or whether my code is invalid.
In Chrome 46, the XML is being interpreted properly as an XML document, on Windows, when the language is set to en; however, I see no evidence that the tags are actually doing anything. I heard no difference between the <emphasis> and non-<emphasis> versions of this SSML:
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);
The <phoneme> tag was also completely ignored, which made my attempt to speak IPA fail.
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ævˈloʊvə">...</phoneme> or <phoneme alphabet="ipa" ph="pɑːvˈloʊvə">...</phoneme>, unlike the name of the dancer, which was <phoneme alphabet="ipa" ph="ˈpɑːvləvə">...</phoneme> </speak>';
msg.lang = 'en';
speechSynthesis.speak(msg);
This is despite the fact that the Microsoft speech API does handle SSML correctly. Here is a C# snippet, suitable for use in LinqPad:
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);
There are bugs for this issue currently open with Chromium.
88072: Extension TTS API platform implementations need to support SSML
428902: speechSynthesis.speak() doesn't strip unrecognized tags This bug has been fixed in Chrome as of Sept 2016.
I've tried this using Chrome 104.0.5112.101 (on Linux). Didn't work. When checking the debugging console I got the message:
speechSynthesis.speak() without user activation is deprecated and will be removed
Adding a button like mentioned in The question of whether speechSynthesis is allowed to run without user interaction does work for me. At least to speak out text, not SSML formatted text though.
I have tested this, and XML parsing seems to work properly in Windows, however it does not work properly in MacOS.

Bilingual application name on blackberry with webworks

I'm packaging an HTML5/Javascript application with WebWorks for BlackBerry.
In the config.xml file, we can set the icon and the name to be display on the phone.
The elements to use for that purpose are:
<name>App Name</name>
<icon src="images/icon.png"/>
My problem is that my app is bilingual and I have a different name in english and in French
(ex: "Billing" in english and "Facturation" in french).
I want "Billing" to appear below the icon when the phone language is set to english and "Facturation" when the phone language is set to french.
Is there a way to do that.
Thanks
The name can also be localized:
<name>Localization Example</name>
<name xml:lang="ca">Exemple de localisation</name>
<name xml:lang="fr_FR">Exemple de localisation</name>
<name xml:lang="de_DE">Localization Probe</name>
Source: https://github.com/blackberry/BB10-WebWorks-Samples/tree/master/Localization

how to play audio through earpiece only in windows phone 8 application

I have tried with AudioRoutingManager class...but i got unauthorizedaccess exception.
here is my code
AudioRoutingManager audioRouting = AudioRoutingManager.GetDefault();
public AudioRoutingEndpoint ChangeAudioRoute()
{
var currentEndPoint= audioRouting.GetAudioEndpoint();
switch (currentEndPoint)
{
case AudioRoutingEndpoint.Earpiece:
case AudioRoutingEndpoint.Default:
return AudioRoutingEndpoint.Speakerphone;
case AudioRoutingEndpoint.Speakerphone:
return AudioRoutingEndpoint.Earpiece;
default:
throw new OperationCanceledException();
}
}
public void SetAudioRoute()
{
audioRouting.SetAudioEndpoint(this.ChangeAudioRoute());
}
The APIs in the Windows.Phone.Media.Devices namespace require the ID_CAP_AUDIOROUTING and the ID_CAP_VOIP capability. (Add this to your manifest)
Also, it's only possible to change the audio routing while in a active VOIP call.
Additionally, you need to do the audio routing in your background VOIP process, and not in the foreground process.
Old question but now I know the answer.
Two things which you need to do:
Tag the audio in question as "communications"
How to do this depends on what API you're using. It could be as simple as . Or you might have to call IAudioClient2::SetClientProperties with an AudioClientProperties structure whose AudioClientProperties.eCategory = AudioCategory_Communications.
Tag your app as either a "voice over IP" app or a "voicemail" app
You should add file called WindowsPhoneReservedAppInfo.xml to your project with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<WindowsPhoneReservedAppInfo xmlns="http://schemas.microsoft.com/phone/2013/windowsphonereservedappinfo">
<SoftwareCapabilities>
<SoftwareCapability Id="ID_CAP_VOIP" />
</SoftwareCapabilities>
</WindowsPhoneReservedAppInfo>
Look for more detailed explanation here:
Playing audio to the earpiece from a Windows Phone 8.1 universal app