标签: sapi

如何将参数传递给BackGroundWorker

Imports SpeechLib

Public Class Form1
    Public vox = CreateObject("sapi.spvoice")

    Private Sub cmdSpeak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSpeak.Click
        Dim text2 As String = "Hello , This is a Text. Hello , This is a Text."
        BackgroundWorker1.RunWorkerAsync()
    End Sub

    Private Sub cmdPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPause.Click
        vox.pause()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim SVEPhoneme As Integer = 64
        vox.EventInterests = SVEPhoneme
        vox.AlertBoundary = SVEPhoneme …
Run Code Online (Sandbox Code Playgroud)

vb.net sapi backgroundworker

3
推荐指数
1
解决办法
2万
查看次数

帮助SAPI v5.1 SpeechRecognitionEngine始终使用C#提供相同的错误结果

我正在玩这个SAPI v5.1库.所以我正在测试我的样本WAV文件.(从这里下载).无论如何,该文件中的声音清晰简单.它只包含一个单词,即第三个单词.现在,当我运行以下代码时,我得到数字8或"8".如果我删除它,我得到7.如果我尝试随机化列表我得到不同的结果,依此类推.我真的很困惑,开始认为SAPI库中的SpeachRecognition根本不起作用......

无论如何这里是我正在做的,

    private void button1_Click(object sender, EventArgs e)
    {
        //Add choices to grammar.
        Choices mychoices = new Choices();
        mychoices.Add("one");
        mychoices.Add("two");
        mychoices.Add("three");
        mychoices.Add("four");
        mychoices.Add("five");
        mychoices.Add("six");
        mychoices.Add("seven");
        mychoices.Add("eight");
        mychoices.Add("nine");
        mychoices.Add("zero");
        mychoices.Add("1");
        mychoices.Add("2");
        mychoices.Add("3");
        mychoices.Add("4");
        mychoices.Add("5");
        mychoices.Add("6");
        mychoices.Add("7");
        mychoices.Add("8");
        mychoices.Add("9");
        mychoices.Add("0");

        Grammar myGrammar = new Grammar(new GrammarBuilder(mychoices));

        //Create the engine.
        SpeechRecognitionEngine reco = new SpeechRecognitionEngine();

        //Read audio stream from wav file.
        reco.SetInputToWaveFile("3.wav");
        reco.LoadGrammar(myGrammar);

        //Get the recognized value.
        reco.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(reco_SpeechRecognized);

        reco.RecognizeAsync(RecognizeMode.Multiple);
    }

    void reco_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
        MessageBox.Show(e.Result.Text); …
Run Code Online (Sandbox Code Playgroud)

c# speech-recognition sapi

3
推荐指数
1
解决办法
2526
查看次数

SAPI:语音到文本示例

我是SAPI的新手,如果你们中的任何人能够在SAPI中发表文本Hello World示例,我将非常感谢.我知道MS有一些例子,如"听写"等,但我想从一个非常小的开始.很高兴,如果你能提供帮助.

windows speech-recognition sapi visual-studio-2010 speech-to-text

3
推荐指数
1
解决办法
1万
查看次数

使用SAPI转换语音转文本

无论如何还是有人知道如何使用微软的Windows表格应用语音识别API进行STT?

c# speech-recognition sapi speech-to-text

3
推荐指数
1
解决办法
6282
查看次数

如何在 VBScript 中将 SAPI 文本保存为语音文件?

我有以下用于文本到语音转换的 VBScript 代码:

Set objVoice = CreateObject("SAPI.SpVoice")
objVoice.Speak Inputbox("Enter Text")
Run Code Online (Sandbox Code Playgroud)

我想将演讲保存到音频文件中。我怎样才能做到这一点?

vbscript sapi text-to-speech

3
推荐指数
1
解决办法
7019
查看次数

80040154未注册类(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG))

Microsoft.Speech.dll中发生未处理的"System.Runtime.InteropServices.COMException"类型异常

附加信息:由于以下错误,检索具有CLSID {49428A60-C997-4D0E-9808-9E326C178D58}的组件的COM类工厂失败:80040154未注册类(HRESULT异常:0x80040154(REGDB_E_CLASSNOTREG)).

我正在关注Microsoft Speech Platform SDK 11的MSDN示例:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Microsoft.Speech;
using Microsoft.Speech.Recognition;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US"));                        ======>>**ERROR** 
            sre.SetInputToWaveFile(@"c:\Test\Colors.wav");
            Choices colors = new Choices();
            colors.Add(new string[] { "red", "green", …
Run Code Online (Sandbox Code Playgroud)

c# speech-recognition speech sapi

3
推荐指数
1
解决办法
2万
查看次数

中文 TTS 抛出 SAPI ERROR E_FAIL

这是我的中文 TTS 代码,尽管中文 TTS 引擎安装成功,但说话功能失败

\n\n
using Microsoft.Speech.Synthesis;\nusing System.Globalization;\n\nnamespace TTS3\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n                //CultureInfo=new CultureInfo("zh-CN");\n            SpeechSynthesizer synth = new SpeechSynthesizer();\n\n// Output information about all of the installed voices. \n            foreach (InstalledVoice voice in synth.GetInstalledVoices(new CultureInfo("zh-CN")))\n                {\n                    synth.SelectVoice(voice.VoiceInfo.Name);\n                    //Console.WriteLine(synth.Voice.Description);\n                    synth.SetOutputToWaveFile("C:\\\\Users\\\\surabhi\\\\Desktop\\\\yes.wav");\n                    synth.Speak("\xe4\xbd\xa0\xe5\xa5\xbd\xe4\xb8\x96\xe7\x95\x8c");\n                    break;\n}\n            Console.WriteLine();\n            Console.WriteLine("Press any key to exit...");\n            Console.ReadKey();\n        }\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

代码抛出的异常是

\n\n
Unhandled Exception: System.InvalidOperationException: Speak error \'80004005\'. -\n--> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been r\neturned from a call to a COM component.\n   at …
Run Code Online (Sandbox Code Playgroud)

sapi text-to-speech

3
推荐指数
1
解决办法
1970
查看次数

SAPI和Windows 7问题

我试图用Windows 7识别语音,但它总是将语音识别为命令或只是说"那是什么?".

我怎么能得到所有的演讲?

码:

SpeechRecognizer _speechRecognizer;

    public Window1()
    {
        InitializeComponent();

        // set up the recognizer
        _speechRecognizer = new SpeechRecognizer();
        _speechRecognizer.Enabled = false;
        _speechRecognizer.SpeechRecognized +=
      new EventHandler<SpeechRecognizedEventArgs>(_speechRecognizer_SpeechRecognized); }
Run Code Online (Sandbox Code Playgroud)

speech-recognition sapi speech-to-text windows-7

2
推荐指数
1
解决办法
5661
查看次数

我是否必须在CComPtr对象上调用Release()方法?

我正在使用SAPI5 API来处理文本到语音.如果我简化我的代码看起来像这样(我删除了错误检查,以尽可能简化它):

int main() {
    CoInitialize(NULL);
    CComPtr<ISpVoice> spVoice;
    spVoice.CoCreateInstance(CLSID_SpVoice);
    ...
    CoUninitialize();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

出于某种奇怪的原因,如果我不调用spVoice.Release(),我的代码会崩溃.所以上面的代码崩溃了,但是这段代码很好用:

int main() {
    CoInitialize(NULL);
    CComPtr<ISpVoice> spVoice;
    spVoice.CoCreateInstance(CLSID_SpVoice);
    ...
    spVoice.Release();
    CoUninitialize();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

CComPtr它超出范围时不会自动释放底层对象吗?

我查看了CComPtr它的实现,它确实调用Release了析构函数本身.

所以我想知道可能出现什么问题,为什么如果我打电话给Release自己,我的代码不会崩溃.但如果我不打电话,Release它会崩溃.

windows com atl smart-pointers sapi

2
推荐指数
1
解决办法
5224
查看次数

我在哪里可以下载Microsoft Speech SDK 5.4

我需要开发一个简单的64位C++文本到语音(TTS)程序,以便在Windows 7和Vista上运行.我的第一步是尝试从SAPI 5.4教程编译程序.但我在Windows 7机器上找不到所需的SAPI 5.4软件包.我搜索了互联网,只有SAPI 5.1适用于Windows XP.
Microsoft Speech Technology页面声称"用于编程Windows 7中包含的语音引擎的本机代码API" .SAPI 5.4教程具有以下指令:

Step 1. Setting up the Project:  
…  
Code Listing 1  
Next add the paths to SAPI.h and SAPI.lib files. The paths shown are for a 
standard SAPI SDK install. If the compiler is unable to locate either file, 
or if a nonstandard install was performed, use the new path to the files. 
Change the project settings to reflect the paths. Using the Project->Settings. 
menu item, …
Run Code Online (Sandbox Code Playgroud)

c++ windows sapi text-to-speech

2
推荐指数
1
解决办法
1万
查看次数