0

I am making a simple application that gets RSS feed from a website then automatically reads the Headlines out loud (text to speech), so I followed this Tutorial to create the RSS reader https://msdn.microsoft.com/library/windows/apps/hh487167(v=vs.105).aspx

Now I have no idea how to automatically text to speech the news in the list box, any ideas?

2 Answers2

0

You could simply go for the TTS api from msdn but make sure that you enable the ID_CAP_SPEECH_RECOGNITION in your AppManifest.

Have a look at the sample here.

For more : Speech recognition to text Windows Phone 8

Community
  • 1
  • 1
Kulasangar
  • 9,046
  • 5
  • 51
  • 82
0

So I figured it out, here is the code:

 private void UpdateFeedList(string feedXML)
    {
        // Load the feed into a SyndicationFeed instance.
        StringReader stringReader = new StringReader(feedXML);
        XmlReader xmlReader = XmlReader.Create(stringReader);
        SyndicationFeed feed = SyndicationFeed.Load(xmlReader);

        Deployment.Current.Dispatcher.BeginInvoke(() =>
        {
            // Bind the list of SyndicationItems to our ListBox.
            feedListBox.ItemsSource = feed.Items;

            loadFeedButton.Content = "Refresh Feed";
            feedListBox.SelectionMode = SelectionMode.Multiple;
            feedListBox.SelectAll();
        });
    }


    // The SelectionChanged handler for the feed items 


    private void feedListBox_SelectionChanged(object sender, RoutedEventArgs e)
    {
        ListBox listBox = sender as ListBox;

        if (listBox != null && listBox.SelectedItem != null)
        {
            // Get  the SyndicationItem that was tapped.
            SyndicationItem sItem = (SyndicationItem)listBox.SelectedItem;
            synth.SpeakTextAsync(sItem.Title.Text);
            if (feedListBox.SelectedIndex < feedListBox.Items.Count - 1)
            {
                feedListBox.SelectedIndex = feedListBox.SelectedIndex + 1;
            }     

I am pretty sure that there is a better solution, but this worked !