2011-05-10 101 views
1

我知道你可以使用Microsoft Speech Object Library for asp.net网站。但是,这取决于客户端,还是来自服务器?我想知道客户端是否像Mac或Linux一样使用它?微软语音对象库 - 客户端还是服务器?

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 
using SpeechLib; 
using System.Threading; 

namespace ARIES.Web.Controllers 
{ 
    public class HomeController : Controller 
    { 
     public static SpVoice speach; 

     public ActionResult Index() 
     { 
      ViewBag.Message = "Welcome to ASP.NET MVC!"; 

      speach = new SpVoice(); 
      //speach.Speak("This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test ", SpeechVoiceSpeakFlags.SVSFDefault); 
      speach.Speak("This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test This is a test", SpeechVoiceSpeakFlags.SVSFlagsAsync); 
      //speach.WaitUntilDone(Timeout.Infinite); 

      return View(); 
     } 

     public void Stop() 
     { 
      speach.Pause(); 
      speach = new SpVoice(); 
      speach.Speak("Stopped", SpeechVoiceSpeakFlags.SVSFlagsAsync); 
     } 
    } 
} 

回答

1

您是在服务器端代码中使用对象还是通过客户端上的javascript?

如果您只在服务器上使用它,则不需要在客户端计算机上存在,但声音将在服务器上播放,而不是在客户端上播放。

如果您通过JavaScript使用它,它是在客户端上需要,你也可能只限于Internet Explorer。

+0

我在服务器上调用页面加载和ajax调用。 ajax调用“停止”方法并停止正在播放的声音。我听到了这个声音,但是我想知道是否因为我正在当地运行项目。这在Firefox中工作。 – 2011-05-10 22:01:40

+0

是的,您正在听到声音,因为您正在本地运行该站点,以便在您的计算机上调用语音对象。远程呼叫者不会听到任何声音。 – Venr 2011-05-10 22:03:48

+0

有没有,我想它周围没有。 – 2011-05-10 22:22:25

相关问题