2013-01-01 61 views
3

我已經爲SAPI5 Eliska22k安裝了捷克語音。它適用於Windows 7的罰款現在我的Windows 8和調用Speak方法,它給了我Attempted to read or write protected memory. This is often an indication that other memory is corrupt.使用其他語音時的文本到語音SAPI5 AccessViolationException

而且我試着從.NET System.Speech使用SpeechSynthesizer。它也可以看到語音Eliska22k安裝(在W7上它只能與SAPI5一起使用),但它不會寫入任何異常,它只是不會啓動。在SelectVoice("Eliska22k")方法程序剛剛退出。

默認語音在SAPI5中的默認語音中也能正常工作。

我已經安裝SpeechPad,並將其與語音Eliska22k精品工程。我找不到問題所在。

SpeechSynthesizer voice = new SpeechSynthesizer(); 

voice.SelectVoice("Eliska22k");// here program just exit without any exeption 
voice.Rate = 2; 

voice.SpeakAsync("Ahoj, jak se máš?"); 

SAPI5

SpVoice voice = new SpVoice(); 

voice.Voice = voice.GetVoices().Item(6);// index of eliska voice 
voice.Rate = 2; 

voice.Speak("Ahoj, jak se máš?", SpeechVoiceSpeakFlags.SVSFlagsAsync);//here occurs exeption 

感謝您的想法。

+2

+1 Ahoj,JAK本身MAS? –

+0

看到與標準文本語音包相同的問題 – swinefeaster

+0

在msdn上添加了此線程的簡單repro http://social.msdn.microsoft.com/Forums/windowsapps/en-US/b575f661-aa78-4db4-b145-b328ecfbde63 /問題,暫停和 - 重啓 - 文字轉語音?論壇= winappswithcsharp – swinefeaster

回答

0

至於我可以告訴這個軟件還沒有與Windows 8

兼容Xtranormal開發這些語音包與自己的文字去動畫軟件作爲補充上。

檢查了這個軟件從PC World評論暗示其2.5 beta測試版的規格是針對Windows XP和Windows Vista。那這次調查是PCWorld審查在2010年Windows 7的支持下進行的

注意本次審查後整合。

注意到Windows 7發佈背後的滯後,這個軟件的到Windows 7的兼容性升級也加強了我的說法,這還不是Windows 8的準備。 (Windows 7的發佈後5個月的PC世界回顧這個軟件,這是不兼容Windows 7,Windows 8中還沒有出過那麼久,軟件升級需要一定的時間;))

檢查出來their own website他們的技術細節建議最遲使用Windows 7的推薦設置。

這對我來說意味着他們尚未將其更新到Windows 8

(作爲一個額外的註腳,而不是在這個軟件與Windows 8的YouTube的一個教程,但很多與其他操作系統的,人做關於這些日子的任何教程和這個操作系統缺乏的教程(儘管應用程序在兩年內越來越受歡迎,這意味着再一次,沒有Windows 8;)

關於腳註的說明,Software Informer是幾乎所有可用軟件都經過審查的網站,與早期版本提交的260個版本相比,舊版本已經收到2-3個評論,因此已知的流行度增加 )

腳註2;我專注於軟件的原因是因爲聲音是最初爲該軟件設計的。因此,如果聲音是收到升級,軟件,他們意欲它被用於第一很可能是先升級)

你認爲他們會在其網站上只是說某個地方,他們支持什麼樣的操作系統的:/

0

不知道這是否是答案,但是當我試圖重複使用相同的媒體元素反覆播放不同的流(例如,用戶是按鈕混搭)時,我遇到了相同的確切錯誤。解決方案是使用顯式的GC.Collect()。雖然有5個媒體元素還不錯,因爲它似乎可以加速停止和重新啓動音頻。

using System; 
using System.Collections.Generic; 
using System.IO; 
using System.Linq; 
using System.Runtime.InteropServices.WindowsRuntime; 
using System.Threading.Tasks; 
using Windows.Foundation; 
using Windows.Foundation.Collections; 
using Windows.Media.SpeechSynthesis; 
using Windows.UI.Xaml; 
using Windows.UI.Xaml.Controls; 
using Windows.UI.Xaml.Controls.Primitives; 
using Windows.UI.Xaml.Data; 
using Windows.UI.Xaml.Input; 
using Windows.UI.Xaml.Media; 
using Windows.UI.Xaml.Navigation; 

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 

namespace SpeechMark 
{ 
    /// <summary> 
    /// An empty page that can be used on its own or navigated to within a Frame. 
    /// </summary> 
    public sealed partial class BlankPage1 : Page 
    { 
    public BlankPage1() 
    { 
     this.InitializeComponent(); 

     m_button.Click += m_button_Click; 

     m_audioPlayerPool = new MediaElement[5]; 
     for(int index = 0; index < m_audioPlayerPool.Length; index++) 
     { 
     var audioPlayer = new MediaElement(); 
     audioPlayer.AutoPlay = true; 
     m_audioPlayerPool[index] = audioPlayer; 
     m_grid.Children.Add(audioPlayer); 
     } 

     m_textToSpeech = new SpeechSynthesizer(); 
    } 

    async void m_button_Click(object sender, RoutedEventArgs e) 
    { 
     m_button.IsEnabled = false; 
     if (m_audioPlayer != null) 
     { 
     m_audioPlayer.Stop(); 
     } 

     if (m_stream != null) 
     { 
     m_stream.Dispose(); 
     m_stream = null; 
     } 

     GC.Collect(); 

     m_audioPlayer = m_audioPlayerPool[m_nextAudioPlayerToUse]; 
     m_nextAudioPlayerToUse = (m_nextAudioPlayerToUse + 1) % m_audioPlayerPool.Length; 

     string ssml = "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\" xml:lang=\"en\"><voice gender=\"female\" xml:lang=\"en\"><prosody rate=\"1\">how are you doing</prosody><mark name=\"utteranceComplete\"/></voice></speak>"; 
     m_stream = await m_textToSpeech.SynthesizeSsmlToStreamAsync(ssml); 
     m_audioPlayer.SetSource(m_stream, m_stream.ContentType); 

     m_button.IsEnabled = true; 
    } 

    private MediaElement m_audioPlayer; 
    private MediaElement[] m_audioPlayerPool; 
    private int m_nextAudioPlayerToUse = 0; 
    private SpeechSynthesizer m_textToSpeech; 
    public SpeechSynthesisStream m_stream { get; set; } 
    } 
} 

XAML:

<Page 
    x:Class="SpeechMark.BlankPage1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:SpeechMark" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 

    <Grid x:Name="m_grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 
    <Button x:Name="m_button" Height="128" Margin="446,303,0,337" Width="256"/> 
    </Grid> 
</Page>