PromptStyle Constructors

Definition

Initializes a new instance of the PromptStyle class.

Overloads

PromptStyle()

Initializes a new instance of the PromptStyle class.

PromptStyle(PromptEmphasis)

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

PromptStyle(PromptRate)

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

PromptStyle(PromptVolume)

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

PromptStyle()

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

Initializes a new instance of the PromptStyle class.

C#
public PromptStyle();

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

PromptStyle(PromptEmphasis)

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

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

C#
public PromptStyle(System.Speech.Synthesis.PromptEmphasis emphasis);

Parameters

emphasis
PromptEmphasis

The setting for the emphasis of the style.

Remarks

The speech synthesis engines in Windows do not support variations in the emphasis of speech output at this time. Setting values for emphasis using a member of the PromptEmphasis enumeration will produce no audible change in the synthesized speech output.

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

PromptStyle(PromptRate)

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

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

C#
public PromptStyle(System.Speech.Synthesis.PromptRate rate);

Parameters

rate
PromptRate

The setting for the speaking rate of the style.

Examples

The following example creates a PromptBuilder object and appends text strings. The example uses the PromptStyle constructor as an argument to the StartStyle method to specify a slow speaking rate for the string being added, which enumerates the contents of an order.

C#
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();  

        // Create a PromptBuilder object and add content.  
        PromptBuilder style = new PromptBuilder();  
        style.AppendText("Your order for");  
        style.StartStyle(new PromptStyle(PromptRate.Slow));  
        style.AppendText("one kitchen sink and one faucet");  
        style.EndStyle();  
        style.AppendText("has been confirmed.");  

        // Speak the contents of the SSML prompt.  
        synth.Speak(style);  
      }  

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

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)

PromptStyle(PromptVolume)

Source:
PromptStyle.cs
Source:
PromptStyle.cs
Source:
PromptStyle.cs

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

C#
public PromptStyle(System.Speech.Synthesis.PromptVolume volume);

Parameters

volume
PromptVolume

The setting for the volume (loudness) of the style.

Examples

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

C#
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();  

        // 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();  
    }  
  }  
}  

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.

See also

Applies to

.NET 9 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)