文本到语音 RSS 提要帮助 C# WP 8

Text to Speech RSS Feed Help C# WP 8

我正在制作一个简单的应用程序,它从网站获取 RSS 提要,然后自动大声朗读标题(文本到语音),所以我按照本教程创建了 RSS reader https://msdn.microsoft.com/library/windows/apps/hh487167(v=vs.105).aspx

现在我不知道如何将列表框中的新闻自动文本语音转换,有什么想法吗?

您可以直接从 msdn 中选择 TTS api,但请确保在 AppManifest.[=16] 中启用 ID_CAP_SPEECH_RECOGNITION =]

查看示例 here

更多:Speech recognition to text Windows Phone 8

所以我想通了, 这是代码:

 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;
            }     

我很确定有更好的解决方案,但这个解决方案有效!