去微软网站下载最新的Speach SDK 5.0

解决方案 »

  1.   

    没用。那只是一个程序开发包。
    必须要有中文TTS支持。微软的TTS没有中文的。
    你可以安装IBM Viavoice。
    缺点是只能读中文。读英文的时候是读字母。
      

  2.   

    agent 2.0 的初始化和1。5不一样。你必须为languageid负值。
    不然打死他都不会发声。
    你可以先用VB试几行代码就可以了。试好了再用其他的如VC
      

  3.   

    去微软网站下载最新的Speach SDK 5.0 
    你可以安装IBM Viavoice。
      

  4.   

    IMSVoiceDataPtr
    ISpTTSEnginePtr
    ISpEventSinkPtr
    ISpTTSEngineSitePtr
    IMSTTSEngineInitPtr
    ISpTokenUIPtr
    ISpDataKeyPtr
    ISpObjectTokenPtr
    ISpObjectTokenCategoryPtr
    IEnumSpObjectTokensPtr
    这些是我安装金山词霸(能读中文)后的一些接口智能指针不知道对各位有没有帮助,我不知道怎么用怎么初始化,各位给点指点吧。
      

  5.   

    AlphaGroup(ff),你还懂的真多呀!
      

  6.   

    下载speach SDK5.1,5.0是不包含中文语音库的,5.1自己带几个朗读中文的例子,快去下吧
      

  7.   

    AlphaGroup(ff):能给我你的email 或者qq还有些细节需要问你谢谢了!
      

  8.   

    VERSION 5.00
    Object = "{F5BE8BC2-7DE6-11D0-91FE-00C04FD701A5}#2.0#0"; "AGENTCTL.DLL"
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   2445
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   6465
       LinkTopic       =   "Form1"
       ScaleHeight     =   2445
       ScaleWidth      =   6465
       StartUpPosition =   3  '窗口缺省
       Begin VB.CommandButton Command1 
          Caption         =   "Show"
          Height          =   495
          Left            =   0
          TabIndex        =   7
          Top             =   0
          Width           =   2055
       End
       Begin VB.CommandButton Command2 
          Caption         =   "Announce"
          Enabled         =   0   'False
          Height          =   495
          Left            =   2160
          TabIndex        =   6
          Top             =   0
          Width           =   2055
       End
       Begin VB.CommandButton Command3 
          Caption         =   "Decline"
          Enabled         =   0   'False
          Height          =   495
          Left            =   4320
          TabIndex        =   5
          Top             =   0
          Width           =   2055
       End
       Begin VB.CommandButton Command8 
          Caption         =   "你好"
          Enabled         =   0   'False
          Height          =   495
          Left            =   2160
          TabIndex        =   4
          Top             =   1680
          Width           =   2055
       End
       Begin VB.CommandButton Command7 
          Caption         =   "Hello"
          Enabled         =   0   'False
          Height          =   495
          Left            =   0
          TabIndex        =   3
          Top             =   1680
          Width           =   2055
       End
       Begin VB.CommandButton Command6 
          Caption         =   "MoveUp"
          Enabled         =   0   'False
          Height          =   495
          Left            =   4320
          TabIndex        =   2
          Top             =   840
          Width           =   2055
       End
       Begin VB.CommandButton Command5 
          Caption         =   "GetAttention"
          Enabled         =   0   'False
          Height          =   495
          Left            =   2160
          TabIndex        =   1
          Top             =   840
          Width           =   2055
       End
       Begin VB.CommandButton Command4 
          Caption         =   "GestureLeft"
          Enabled         =   0   'False
          Height          =   495
          Left            =   0
          TabIndex        =   0
          Top             =   840
          Width           =   2055
       End
       Begin AgentObjectsCtl.Agent Agent1 
          Left            =   4560
          Top             =   1680
          _cx             =   847
          _cy             =   847
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub Command1_Click()
        If Agent1.AudioOutput.Enabled Then
            Agent1.Characters("Genie").Show
            'Agent1.Characters("Genie").Play "Greet"
            Agent1.Characters("Genie").MoveTo 600, 400
            Command2.Enabled = True
            Command3.Enabled = True
            Command4.Enabled = True
            Command5.Enabled = True
            Command6.Enabled = True
            Command7.Enabled = True
            Command8.Enabled = True
        End If
    End SubPrivate Sub Command2_Click()
        Agent1.Characters("Genie").Play "Announce"
    End SubPrivate Sub Command3_Click()
        Agent1.Characters("Genie").Play "Decline"
    End SubPrivate Sub Command4_Click()
        Agent1.Characters("Genie").Play "GestureLeft"
    End SubPrivate Sub Command5_Click()
        Agent1.Characters("Genie").Play "GetAttention"
    End SubPrivate Sub Command6_Click()
    Agent1.Characters("Genie").Play "MoveUp"
    End SubPrivate Sub Command7_Click()
        Agent1.Characters("Genie").LanguageID = &H409
        Agent1.Characters("Genie").Speak "Hello"
    End SubPrivate Sub Command8_Click()
        Agent1.Characters("Genie").LanguageID = &H804
        Agent1.Characters("Genie").Speak "你好"
    End SubPrivate Sub Form_Load()
        Agent1.Characters.Load "Genie", "c:\winnt\msagent\chars\merlin.acs"
    '   Agent1.Characters.Load "Genie", "c:\winnt\msagent\chars\genie.acs"
    '   Agent1.Characters.Load "Genie", "c:\winnt\msagent\chars\peedy.acs"
    End Sub给你个VB程序测试一下中文语音。
    以下的版权归Microsoft所有
    #ifndef STRICT
    #define STRICT
    #endif
    //==========================================================================
    //
    //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
    //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
    //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
    //  PURPOSE.
    //
    //  Copyright (C) 1997-1998 Microsoft Corporation.  All Rights Reserved.
    //
    //--------------------------------------------------------------------------
    //
    // This sample demonstrates the simplest Microsoft Agent application
    //
    //==========================================================================
    #include <windows.h>
    #include <tchar.h>
    #include "AgtSvr.h"
    #include "AgtSvr_i.c"
    static const LPWSTR kpwzCharacterOld = L"\\program files\\microsoft agent\\characters\\genie.acs";
    static const LPTSTR kpszAppTitle = _T("Microsoft Agent Samples");
    extern "C" int PASCAL WinMain(HINSTANCE hInst,
      HINSTANCE hInstPrev,
      LPSTR lpCmdLine,
      int nCmdShow) { HRESULT hRes;
    _TCHAR szError[256];
    VARIANT vPath;
    BSTR bszSpeak;
    long lCharID;
    long lRequestID;
    IAgentEx    *pAgentEx;
    IAgentCharacterEx  *pCharacterEx = NULL;

    // Initialize COM    if (FAILED(CoInitialize(NULL))) {
    MessageBox(NULL, 
       _T("There was an error initializing COM."), 
       kpszAppTitle, 
       MB_OK | MB_ICONERROR);
            return -1;
    } // Create an instance of the Agent 2.0 server. NOTE: by
    // asking for an IAgentEx interface we know we will get
    // at least Agent 2.0. The CLSID also changed between
    // 1.5 and 2.0 so we know we won't get the 1.5 server. hRes = CoCreateInstance(CLSID_AgentServer,
    NULL,
    CLSCTX_SERVER,
    IID_IAgentEx,
    (LPVOID *)&pAgentEx);
    if (FAILED(hRes)) { wsprintf(szError, _T("There was an error initializing Microsoft Agent, code = 0x%x"), hRes); MessageBox(NULL, 
       szError, 
       kpszAppTitle, 
       MB_OK | MB_ICONERROR | MB_TOPMOST);

    CoUninitialize(); return -1;
    } __try { // First try to load the default character VariantInit(&vPath);
    vPath.vt = VT_EMPTY; hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID); if (FAILED(hRes)) { // There's no default character. See if we can load the
    // character from the directory used in most version 1.5
    // applications. vPath.vt = VT_BSTR;
    vPath.bstrVal = SysAllocString(kpwzCharacterOld); if (vPath.bstrVal == NULL) {
    hRes = E_OUTOFMEMORY;
    __leave;
    } hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID); // Did we successfully load a character? if (FAILED(hRes))
    __leave;
    } // Get the IAgentCharacterEx interface hRes = pAgentEx->GetCharacterEx(lCharID, &pCharacterEx); if (FAILED(hRes))
    __leave; // Set the language of the character hRes = pCharacterEx->SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); if (FAILED(hRes))
    __leave; // Show the character.  The first parameter tells Microsoft
    // Agent to show the character by playing an animation. hRes = pCharacterEx->Show(FALSE, &lRequestID); if (FAILED(hRes))
    __leave; // Make the character speak bszSpeak = SysAllocString(L"Hello World!"); hRes = pCharacterEx->Speak(bszSpeak, NULL, &lRequestID); SysFreeString(bszSpeak); if (FAILED(hRes))
    __leave; // This is a very simplistic sample.  Sleep for 10 seconds
    // and then die.  Sleep(10000); }
    __finally { if (FAILED(hRes)) { wsprintf(szError, _T("An error occurred in Microsoft Agent, code = 0x%x"), hRes); MessageBox(NULL, 
       szError, 
       kpszAppTitle, 
       MB_OK | MB_ICONERROR | MB_TOPMOST);
    }
    } // Clean up if (pCharacterEx) { // Release the character interface pCharacterEx->Release(); // Unload the character.  NOTE:  releasing the character
    // interface does NOT make the character go away.  You must
    // call Unload. pAgentEx->Unload(lCharID);
    }

    // Release the Agent pAgentEx->Release(); VariantClear(&vPath); CoUninitialize(); return 0;
    }
      

  9.   

    2.0 后语音和Agent分的很清楚了。
    你也可以单独调用语音
      

  10.   

    to AlphaGroup(ff)
    我在vc 里这样写的:
             ::CoInitialize(NULL);
             IAgentCtlPtr pCtr("Agent.Control.2");
    pCtr->Characters->Load("Genie", "c:\winnt\msagent\chars\merlin.acs");
    pCtr->Characters->Load("Genie", "c:\winnt\msagent\chars\genie.acs");
    可是在第三行就出错了,能否给点提示!谢谢了。
      

  11.   

    第4行错了。
    第三行c:\winnt\msagent\chars\merlin.acs这个文件存在吗?
    load最好放在try...catch块里
      

  12.   

    我这有一个产品新华音霸,支持中文发音,可惜是收费的,不知道有没有D版的:-),不过可以交流一下。只是中文的问题,AGENT我没玩过,不知道是否支持。
    要中文发音:
    1。MS SPEECH API。
    2。MS TTS ENGINEER
    3。中文音库。
    一般的中文音库都有头文件给你的,我这里是清华的TTS。
      

  13.   

    install Microsoft Speech API SDK 5.0
    you will find an useful demo in the directory
      

  14.   

    来帮忙pushhttp://www.csdn.net/expert/topic/441/441154.shtm 
      

  15.   

    to:AlphaGroup(ff)
    这个文件存在,
    pCtr->Characters->Load("Genie","c:\\winnt\\msagent\\chars\\merlin.acs");出错
    晚上我把分给了,在开一贴。谢谢。
      

  16.   

    各位请到http://www.csdn.net/Expert/topic/443/443531.shtm接着讨论!