真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net自動(dòng)發(fā)音的簡單介紹

vb.net的一個(gè)問題

蜂鳴器編程的話,有個(gè)API函數(shù),VB中的聲明為

創(chuàng)新互聯(lián)公司是一家以重慶網(wǎng)站建設(shè)公司、網(wǎng)頁設(shè)計(jì)、品牌設(shè)計(jì)、軟件運(yùn)維、seo優(yōu)化排名、小程序App開發(fā)等移動(dòng)開發(fā)為一體互聯(lián)網(wǎng)公司。已累計(jì)為純水機(jī)等眾行業(yè)中小客戶提供優(yōu)質(zhì)的互聯(lián)網(wǎng)建站和軟件開發(fā)服務(wù)。

Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

調(diào)用方法是Beep 聲音頻率,持續(xù)時(shí)間(毫秒為單位)

比如 beep 2000,1000

如果是聲卡編程的話,也有相應(yīng)的API函數(shù),比如你可以用DirectSound(也就是DirectX的一部分),功能比較強(qiáng)大,也很專業(yè)。事實(shí)上,如果你使用的是專業(yè)級的聲卡和音響設(shè)備,它可以在一定范圍內(nèi)回放出超出人耳聽覺范圍的聲音。當(dāng)然也可以用簡單一點(diǎn)的API,以下是幾個(gè)需要的函數(shù):

Private Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long

Private Declare Function midiOutGetNumDevs Lib "winmm" () As Integer

Private Declare Function MIDIOutOpen Lib "winmm.dll" Alias "midiOutOpen" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long

Private Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long

Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long

Private Declare Function midiOutGetErrorText Lib "winmm.dll" Alias "midiOutGetErrorTextA" (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long

Private Const MAXERRORLENGTH = 128 ' max error text length (including NULL)

Private Const MIDIMAPPER = (-1)

Private Const MIDI_MAPPER = (-1)

'MIDIOUTCAPS結(jié)構(gòu)描述了Musical Instrument Digital Interface(MIDI)輸入設(shè)備的性能

Type MIDIOUTCAPS

wMid As Integer

wPid As Integer ' 產(chǎn)品 ID

vDriverVersion As Long ' 設(shè)備版本

szPname As String * 32 ' 設(shè)備 name

wTechnology As Integer ' 設(shè)備類型

wVoices As Integer

wNotes As Integer

wChannelMask As Integer

dwSupport As Long

End Type

Public Sub note_on(ch As Integer, ByVal kk As Integer, v As Integer)

' 發(fā)音主函數(shù)。參數(shù)分別為通道編號,音調(diào),速度

Call midi_outshort(H90 + ch, kk, v)

End Sub

Sub midi_outshort(b1 As Integer, b2 As Integer, b3 As Integer)

Dim midi_error As Integer

midi_error = midiOutShortMsg(hMidi, b3 * H10000 + b2 * H100 + b1)

If Not midi_error = 0 Then

Call midi_outerr(midi_error)

End If

End Sub

Sub midi_outerr(ByVal midi_error As Integer)

Dim s As String

Dim x As Integer

s = Space(MAXERRORLENGTH)

x = midiOutGetErrorText(midi_error, s, MAXERRORLENGTH)

MsgBox s

End Sub

vb.net文字轉(zhuǎn)語音

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim s As Object

s = CreateObject("sapi.spvoice")

s.speak("speak")

End Sub

VB.net中如何添加聲音?

Private Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Call mciExecute("play F:\MUSIC\WMA\guitar\強(qiáng)調(diào)樂隊(duì)-無聲的嘆息.mp3 ")

End Sub

復(fù)制可不怎么好吧,那些dll你都要有才行,vb.net做安裝程序也不麻煩,只要添加一個(gè)新項(xiàng)目--安裝向?qū)?根據(jù)提示按下去就是了

哎~~~都說得很清楚了,你還......再給個(gè)提示吧,用timeofday來提取當(dāng)前時(shí)間,和自定義時(shí)間對比

想在vb.net的程序中有一個(gè)語音提示,該怎么寫

首先添加一個(gè)系統(tǒng)的語音COM組件的引用microsoft speech object library然后在程序中聲明一個(gè)語音類dim RC As SpeechLib.SpSharedRecoContext這個(gè)類有一些事件,如果你要處理它的一些事件,可以用withevent來聲明然后在窗體LOAD事件或你需要的地方先創(chuàng)建一個(gè)實(shí)例RC = New SpeechLib.SpSharedRecoContext當(dāng)一個(gè)RC被實(shí)例化后,系統(tǒng)就會(huì)運(yùn)行語音識(shí)別程序.前提是你的系統(tǒng)已經(jīng)正確安裝這個(gè)功能.一般默認(rèn)就已經(jīng)安裝好的.其次提醒一下,WIN7的語音識(shí)別比XP的好N倍.從閱讀到偵聽都好很多.然后就可以在你需要閱讀的地方使用RC.Voice.Speak("hello 我", 11)11那里是一些枚舉,用來標(biāo)識(shí)系統(tǒng)用前臺(tái)還是后臺(tái)或其他方式來閱讀文字,簡單的來說就是閱讀的時(shí)候不會(huì)卡住你的程序.你可以選其他的枚舉來試試作用.以上為閱讀部分.如果需要程序聽你說話,則需要聲明一個(gè)偵聽類dim RG As SpeechLib.ISpeechRecoGrammar在初始化時(shí)將之與上面的RC建立關(guān)系,此時(shí)則必須要用withevent來聲明上面的RC,因?yàn)樯婕半娔X聽到你的語音后,會(huì)觸發(fā)一個(gè)事件,并將聽到的內(nèi)容傳遞到該事件.其次,要讓系統(tǒng)聽到的解析為命令,就必須準(zhǔn)備一個(gè)XML結(jié)構(gòu)的文件來保存那些固定的命令.如果電腦在XML文件中找不到那些固定命令或同時(shí)不屬于系統(tǒng)命令,電腦將會(huì)將其解釋為聽寫.RG = RC.CreateGrammar '(0)

RG.CmdLoadFromFile("聽到.xml", SpeechLib.SpeechLoadOption.SLODynamic)

RG.CmdSetRuleIdState(0, SpeechLib.SpeechRuleState.SGDSActive)然后寫一個(gè)過程來處理聽到的事件Private Sub 聽到命令(ByVal StreamNumber As Integer, ByVal StreamPosition As Object, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal 話語 As SpeechLib.ISpeechRecoResult) Handles RC.Recognition RC.Voice.Speak("我聽到了" 話語.PhraseInfo.GetText, 11)End Sub以上為偵聽部分.下面列一個(gè)XML的例文?xml version="1.0" encoding="gb2312"?

GRAMMAR LANGID="804"

RULE NAME="命令" TOPLEVEL="ACTIVE"

L

P打開播放器

P上我的QQ

P關(guān)閉你自己 /L

/RULE

/GRAMMAR要讓系統(tǒng)正確地偵聽到你說的話,前提你必須運(yùn)行語音識(shí)別程序并讓其激活到"正在聆聽"狀態(tài).并且你必須有一個(gè)能正常使用的話筒而且保證話筒已經(jīng)打開.(廢話-_-|||)以上就是用VB.NET語音識(shí)別的最基本的一些操作.希望對你有幫助.更深入的內(nèi)容有興趣的話可以和我一起研究.


網(wǎng)頁標(biāo)題:vb.net自動(dòng)發(fā)音的簡單介紹
文章網(wǎng)址:http://weahome.cn/article/doosoco.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部