Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. text;
Using system. Speech. synthesis;
Using system. speech;
Namespaces yincheng01@163.com
{
Public class speechspeak
{
Public speechsynthesizer synth;
Public speechspeak ()
{
Synth = new speechsynthesizer ();
}
// Public speechvoicespeakflags spflags = speechvoicespeakflags. svsflagsasync;
Public speechspeak (int m, int N)
{
// Use Synth to set the read volume. The value ranges from 0 ~ 100]
Synth. volume = m;
// Use Synth to set the read frequency. The value range is-10 ~ 10]
Synth. Rate = N;
}
Public void speakchina (string ggg)
{
// Spvoice voice = new spvoice ();
Synth. selectvoice ("Microsoft Lili ");
// Voice. Speak (ggg, spflags );
Synth. speakasync (ggg );
// String speechpeople = synth. voice;
// Use Synth to set the read volume. The value ranges from 0 ~ 100]
// Synth. volume = 80;
// Use Synth to set the read frequency. The value range is-10 ~ 10]
// Synth. Rate = 0;
// Use Synth to synthesize WAV audio files:
// Synth. setoutputtowavefile (string path );
}
Public void speakenglish (string ggg)
{
// Spvoice voice = new spvoice ();
Synth. selectvoice ("Microsoft Anna ");
Synth. Speak (ggg );
}
Public int m
{
Get
{
Return synth. volume;
}
Set
{
Synth. volume = value;
}
}
Public int n
{
Get
{
Return synth. rate;
}
Set
{
Synth. Rate = value;
}
}
Public void pause ()
{
Synth. Pause ();
}
Public void goon ()
{
Synth. Resume ();
}
Public void cancel ()
{
Synth. speakasynccancelall ();
}
}
}
If you need source code, leave an email.