如何将微软sapi产生的文本语音保存为wav文件。来者有分。 ( 积分: 70 )

  • 主题发起人 主题发起人 skyjacker
  • 开始时间 开始时间
S

skyjacker

Unregistered / Unconfirmed
GUEST, unregistred user!
本人使用微软语音包的SpVoice控件朗读中文语音,如何生成wav文件?谢谢!
需要什么控件或函数?
 
本人使用微软语音包的SpVoice控件朗读中文语音,如何生成wav文件?谢谢!
需要什么控件或函数?
 
来接分,能介绍一下怎么使用SpVoice控件吗?
 
出现错误提示:Incompatible types: 'ISpeechWaveFormatEx' and 'TSpWaveFormatEx'
怎么解决?
 
http://www.ysza.com 原创作品里中英文混读
 
'ISpeechWaveFormatEx' and 'TSpWaveFormatEx'
帮助上有VB的例子:
Option Explicit

Dim F As SpeechLib.SpAudioFormat
Dim W As SpeechLib.SpWaveFormatEx

Private Sub Command1_Click()

'Create an empty SpAudioFormat object
'Set it to the default format
'Get its format in an SpWaveFormatEx object
Set F = New SpAudioFormat
F.Type = SAFT22kHz16BitStereo
Set W = F.GetWaveFormatEx

Debug.Print
Debug.Print "Default SpAudioFormat and SpWaveFormatEx"
Debug.Print "Format: SAFT22kHz16BitStereo"
Debug.Print "Format code: "
&
F.Type
Debug.Print "AvgBytesPerSec "
&
W.AvgBytesPerSec
Debug.Print "BitsPerSample "
&
W.BitsPerSample
Debug.Print "BlockAlign "
&
W.BlockAlign
Debug.Print "Channels "
&
W.Channels
Debug.Print "ExtraData "
&
W.ExtraData
Debug.Print "FormatTag "
&
W.FormatTag
Debug.Print "SamplesPerSec "
&
W.SamplesPerSec

'Give the SpAudioFormat object an audio type
'Get its format in an SpWaveFormatEx object
F.Type = SAFT11kHz16BitMono
Set W = F.GetWaveFormatEx

Debug.Print
Debug.Print "Changing SpAudioFormat changes SpWaveFormatEx"
Debug.Print "Format: SAFT11kHz16BitMono"
Debug.Print "Format code: "
&
F.Type
Debug.Print "AvgBytesPerSec "
&
W.AvgBytesPerSec
Debug.Print "BitsPerSample "
&
W.BitsPerSample
Debug.Print "BlockAlign "
&
W.BlockAlign
Debug.Print "Channels "
&
W.Channels
Debug.Print "ExtraData "
&
W.ExtraData
Debug.Print "FormatTag "
&
W.FormatTag
Debug.Print "SamplesPerSec "
&
W.SamplesPerSec

End Sub

Private Sub Command2_Click()

'Create an empty SpAudioFormat object
'Set it to the default format
'Get its format in an SpWaveFormatEx object

Set F = New SpAudioFormat
F.Type = SAFT22kHz16BitStereo
Set W = F.GetWaveFormatEx

Debug.Print
Debug.Print "Default SpAudioFormat and SpWaveFormatEx:"
Debug.Print "Format: SAFT22kHz16BitStereo"
Debug.Print "Format code: "
&
F.Type
Debug.Print "AvgBytesPerSec "
&
W.AvgBytesPerSec
Debug.Print "BitsPerSample "
&
W.BitsPerSample
Debug.Print "BlockAlign "
&
W.BlockAlign
Debug.Print "Channels "
&
W.Channels
Debug.Print "ExtraData "
&
W.ExtraData
Debug.Print "FormatTag "
&
W.FormatTag
Debug.Print "SamplesPerSec "
&
W.SamplesPerSec

'Set SpWaveFormatEx properties as in SAFT11kHz16BitMono format;
'this will reset the SpAudioFormat Type.

Debug.Print
Debug.Print "Changing SpWaveFormatEx properties changes SpAudioFormat:"
W.AvgBytesPerSec = 22050
W.BitsPerSample = 16
W.BlockAlign = 2
W.Channels = 1
W.SamplesPerSec = 11025

Call F.SetWaveFormatEx(W)
Debug.Print "Format code: "
&
F.Type

End Sub
 
多人接受答案了。
 
自由界面和报表的完美解决方案
http://www.anylib.com
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
I
回复
0
查看
719
import
I
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部