Add new voices for Windows Phone (WinRT) speech synthesizer - windows-runtime

Using the speech-to-text WinRT API:
private async Task SynthesizeSpeech(string text)
{
var synthesizer = new SpeechSynthesizer();
var media = new MediaElement();
var stream = await m_Synthesizer.SynthesizeTextToStreamAsync(text);
m_Media.SetSource(stream, stream.ContentType);
m_Media.Play();
}
You can set the synthesizer's voice by choosing from the available ones on the device:
var voice = SpeechSynthesizer.AllVoices
.FirstOrDefault(voice => voice.Language.StartsWith("es"));
My Windows Phone (8.1) includes a voices: an English, Japanese, and Chinese, male and female.
My question is: is there any way to install new voices onto the device (or better yet, include them with my app)?

Settings -> Speech lets you install new speech voices onto the phone. (I still don't know how to install it from a resource in my app, or at least provide a link to the user of my app to install it.)

Related

Adobe Air URLRequest to Local File Works Windows 7, Not 10

I developed an Adobe Air App for a small intranet. All computers have been running Windows 7, but now are beginning to be replaced with Windows 10 systems. I can access the mapped drive "I" and the local "C" drive using the file class on Windows 7 machines, but only the mapped drive "I" on Windows 10.
Edit: Capabilities.localFileReadDisable returns false on both Windows 7 and Windows 10 systems.
****I could bypass the need for the local file if Air could get any specific information about the machine it is running on, serial number, mac address, computer name, etc. It really makes no difference what information I get, it just has to be unique to that computer. And using cookies isn't an option because they are volatile****
The following code accomplishes two things.
First, it displays the running version of the Air file and looks for a file on a mapped drive with the latest version available. If they are the same, the computer is running the latest version. If they aren't the same, the new version is displayed to the user, indicating the app should be updated.
Second, it grabs the name of the specific computer from a text file residing on the local drive. That name is used on reports to indicate which computer was being used. There is probably a far superior way to accomplish this, but on Windows 7, it works perfectly for me. Unfortunately, Windows 10 throws an error when trying to access the file on the local drive.
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C:/machineName.txt
Any help would be greatly appreciated.
var appXML:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXML.namespace();
version_txt.text = "V"+appXML.ns::versionNumber;
// Define path to the version number
var updatePath:URLRequest = new URLRequest("file:///I:/air/update.txt");
// Define path to name of specific pc
var machineName:URLRequest = new URLRequest("file:///C:/machineName.txt");
// Define the URLLoaders
var updateLoader:URLLoader = new URLLoader();
function checkUpdate():void{
updateLoader.load(updatePath);
}
var nameLoader:URLLoader = new URLLoader();
function checkName():void{
nameLoader.load(machineName);
}
// Listen for when the file has finished loading.
updateLoader.addEventListener(Event.COMPLETE, loaderComplete);
function loaderComplete(e:Event):void
{
// The output of the text file is available via the data property
// of URLLoader.
if(Number(appXML.ns::versionNumber)<Number(updateLoader.data)){
update_txt.text = "UPDATE TO V"+updateLoader.data;
}
}
nameLoader.addEventListener(Event.COMPLETE, nameComplete);
var name_txt:String = new String;
function nameComplete(e:Event):void{
name_txt = nameLoader.data;
var holder:String = version_txt.text;
version_txt.text = name_txt+" ** "+holder;
}

How to store user data in window phone 8 app?

Please help me how to store user data in window phone 8 application?
I have a plan to develop an application on windows phone 8 which allow user create xml file to store their private data. The question is how to store user data on window 8.1 phone. After search solution, i know that
+ Isolated Storage can store data but it just small data for application
+ Store data on SD card is read only.
So, is there any other way to store data?
Thank and sorry about my english skill!
ApplicationData (LocalFolder on WP8 or LocalFolder and RoamingFolder on WP8.1) is designed for what you are trying to do. The ApplicationSettings themselves are better for small pieces of data, but apps can save files of any size which the phone has room for in the LocalFolder.
See Accessing app data with the Windows Runtime on MSDN for details. While the docs target Windows Runtime apps, the ApplicationData and StorageFile API are available to Silverlight apps on Windows Phone 8 and later.
Additional Usings:
using System.Xml.Serialization;
using Windows.Storage;
using System.IO;
Code:
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
StorageFile saveFile = await localFolder.CreateFileAsync("data.xml", CreationCollisionOption.ReplaceExisting);
using (var ras = await saveFile.OpenAsync(FileAccessMode.ReadWrite))
{
Stream stream = ras.GetOutputStreamAt(0).AsStreamForWrite();
XmlSerializer serializer = new XmlSerializer(typeof(List<Book>));
serializer.Serialize(stream, data);
}
If you need more structured data than XML then you can store a SQLite database in the local folder. If you need more space than is reasonable for an app to store on the device then you'll need to move it to a web service. Azure Mobile Services is a good place to do that. You can call such a service from a Windows Phone Silverlight app, but the wizards will generate Universal apps.

how to debug wp8 app downloaded from store?

I've made a game using marmalade sdk and AppEasy engine and it works when I test it on the device but after submitting to store and downloading it only shows splash screen and then terminates.
Is there a way to debug it? Android and ios both have tools to trace the console output, is there such a tool for wp8? I only found how to do that for apps deployed to the device locally but no way to debug downloaded apps :(
For my other game made in same framework (with same issue) there is a crash report on the dev center dashboard with error saying 'STACK_OVERFLOW_DATA' but that doesn't help much
also tried this (solution found in some other question):
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
string result = "nothing :(";
IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
if (store.FileExists("iwtrace.txt"))
{
using (var stream = new IsolatedStorageFileStream("iwtrace.txt", FileMode.Open, store))
{
using (var fileReader = new StreamReader(stream))
{
result = fileReader.ReadToEnd();
}
}
}
EmailComposeTask task = new EmailComposeTask();
task.To = "";
task.Subject = "crash log " + e.ExceptionObject.Message;
task.Body = result;
task.Show();
}
but it never get's to showing the email form
There's no way yet to debug retail version of WP8 apps especially which are made in Marmalade.
You can read more about that in the article explaining how to test the retail version.
According to the article you need to test the retail version via Visual Studio in case of Native C# app. I suppose even native XAML apps can't be debugged after downloading from store.
I've asked almost similar question on Marmalade forums last year. The only way at that time was to use Windows Power tool or Visual Studio.
To test the function, run your code from Visual Studio in release mode and see if it crashes or not. That's the only thing you can do in this case as far as I know.

Unauthorized Access Exception when Creating an instance of SpeechSynthesizer in WP8.1 Emulator

I was trying to recreate the simle Text to Speech example used on the MSDN website. However whenever the code came to create the instance of the SpeechSynthesizer class it failed with a Unauthorised Acception error when running on the WP8.1 emulator. I currently do not have an actual device to test on to see if this makes a difference.
My code was simply:
private async void TTS()
{
// The media object for controlling and playing audio.
MediaElement mediaElement = new MediaElement();
// The object for controlling the speech synthesis engine (voice).
var synth = new Windows.Media.SpeechSynthesis.SpeechSynthesizer();
// Generate the audio stream from plain text.
SpeechSynthesisStream stream = await synth.SynthesizeTextToStreamAsync("Hello World");
// Send the stream to the media object.
mediaElement.SetSource(stream, stream.ContentType);
mediaElement.Play();
}
I know there was an issue with the SpeechSynthesizer in Windows 8.1, and I found solutions to this when looking to fix the problem, but found little about the problem with WP8.1 SpeechSynthesizer. Has anybody else came across this problem and found a fix?
You should add one DeviceCapability in Package.appxmanifest file:
In DeviceCapability Tab, check the microphone, because it will provides access to the microphone’s audio feed, which allows the app to record audio from connected microphones.
Look at this library: App capability declarations (Windows Runtime apps)

How to create a photo album folder in Windows Phone 8 Programmatically

I have seen many questions about this topic. All answers are saying it is not possible and all questions are answered like that only.
Here is one Programmatically create a photo album in Windows Phone 8
But after installing the latest WhatsApp update it is creating a folder in my phone photo album. After searching the internet I got this URL: http://thegeekybeng.com/2013/12/18/whatsapp-for-windows-phone-get-a-much-needed-update/
.. What's more! Now it's easier to search for the videos and photos you
Saved from whatsapp as a new folder simply named “Whatsapp” will be
Created in the photo album for you to store all the videos and photos
Saved from Whatsapp!...
How is this possible?
"How is this possible." This is only possible if you have access to API's/other means that are not publicly available, look at this news report from Nokia for example, it states
The developers were working with Nokia to produce a version that is
properly optimised for the latest Windows Phone platform experience.
This means that the WhatsApp developers had access to some of the internal goodies that we "unworthy" developers do not.
This is the only explanation I can think of. So, is it possible? Yes, but only for the elite.
EDIT:
In WP8.1 you could do this:
IReadOnlyList<StorageFolder> storageFolderList = await KnownFolders.PicturesLibrary.GetFoldersAsync();
if (storageFolderList.Where(x => x.Name == "FolderName").Count() == 0)
{
StorageFolder folderCreationResult = await KnownFolders.PicturesLibrary.CreateFolderAsync("FolderName", CreationCollisionOption.ReplaceExisting);
var messageDialog = new MessageDialog("FolderName has been created", "Folder Created");
await messageDialog.ShowAsync();
}
else
{
var messageDialog = new MessageDialog("FolderName already exists.", "Folder Exists");
await messageDialog.ShowAsync();
}
This has been now provided to all developers finally through Windows 8.1 update and Visual Studio 2013 Update 2.
KnownFolders.PicturesLibrary.CreateFolderAsync("My Album Name", CreationCollisionOption.ReplaceExisting);