Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

PromptStyle Constructor (PromptVolume)

Initializes a new instance of the PromptStyle class and specifies the setting for the speaking volume of the style.

Namespace:  Microsoft.Speech.Synthesis
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

'Declaration
Public Sub New ( _
    volume As PromptVolume _
)
'Usage
Dim volume As PromptVolume

Dim instance As New PromptStyle(volume)
public PromptStyle(
    PromptVolume volume
)

Parameters

Remarks

The Default setting for PromptVolume is full volume, which is the same as ExtraLoud. The other settings decrease the volume of speech output relative to full volume.

You can also set volume levels on the SpeechSynthesizer object. See TtsVolume and Volume.

Examples

The following example uses the PromptStyle(PromptVolume) constructor to specify volume settings that the SpeechSynthesizer should apply to speech output.

using System;
using Microsoft.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();

        // Build a prompt that applies different volume settings.
        PromptBuilder builder = new PromptBuilder();
        builder.StartStyle(new PromptStyle(PromptVolume.Default));
        builder.AppendText("This is the default speaking volume.");
        builder.EndStyle();
        builder.AppendBreak();
        builder.StartStyle(new PromptStyle(PromptVolume.ExtraLoud));
        builder.AppendText("This is the extra-loud speaking volume.");
        builder.EndStyle();
        builder.AppendBreak();
        builder.StartStyle(new PromptStyle(PromptVolume.Medium));
        builder.AppendText("This is the medium speaking volume.");
        builder.EndStyle();

        // Speak the prompt.
        synth.Speak(builder);
      }

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}

See Also

Reference

PromptStyle Class

PromptStyle Members

PromptStyle Overload

Microsoft.Speech.Synthesis Namespace