SpeechSynthesizer.Volume Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Get or sets the output volume of the SpeechSynthesizer object.
public:
property int Volume { int get(); void set(int value); };
public int Volume { get; set; }
member this.Volume : int with get, set
Public Property Volume As Integer
Property Value
Returns the volume of the SpeechSynthesizer, from 0 through 100.
Examples
The following example sets the volume of the SpeechSynthesizer's audio output for the synthesized voice and the WAV file.
using System;
using System.Speech.Synthesis;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Configure the audio output.
synth.SetOutputToDefaultAudioDevice();
// Set the volume of the SpeechSynthesizer's ouput.
synth.Volume = 60;
// Build a prompt containing recorded audio and synthesized speech.
PromptBuilder builder = new PromptBuilder(
new System.Globalization.CultureInfo("en-US"));
builder.AppendAudio("C:\\Test\\WelcomeToContosoRadio.wav");
builder.AppendText(
"The weather forecast for today is partly cloudy with some sun breaks.");
// Speak the prompt.
synth.Speak(builder);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈