PromptBuilder.AppendAudio Method

Definition

Appends a specified audio file to a PromptBuilder object.

Overloads

AppendAudio(String)

Appends the specified audio file to the PromptBuilder.

AppendAudio(Uri)

Appends the audio file at the specified URI to the PromptBuilder.

AppendAudio(Uri, String)

Appends the specified audio file and alternate text to the PromptBuilder.

AppendAudio(String)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Appends the specified audio file to the PromptBuilder.

public void AppendAudio (string path);

Parameters

path
String

A fully qualified path to the audio file.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.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)

AppendAudio(Uri)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Appends the audio file at the specified URI to the PromptBuilder.

public void AppendAudio (Uri audioFile);

Parameters

audioFile
Uri

URI for the audio file.

Examples

The following example initializes a new instance of the PromptBuilder class and then adds text to it, followed by an audio file.

using System.Speech.PromptBuilder;  

public void SimpleConcatenation()  
{  
    // Add a prompt fragment from a .wav file.  
    PromptBuilder builder = new PromptBuilder ();  
    builder.AppendText("How are you today?");  
    builder.AppendAudio(new Uri ("http://www.speech.microsoft.com/ding.wav"));  
}  

The following markup shows the equivalent SSML markup.

<speak xmlns="http://www.w3.org/2001/10/synthesis"  
       xmlns:ms="http://www.microsoft.com/speech/synthesis" xml:lang="en">  

  How are you today?  
  <audio src="http://www.speech.microsoft.com/ding.wav" />  

</speak>  

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.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)

AppendAudio(Uri, String)

Source:
PromptBuilder.cs
Source:
PromptBuilder.cs
Source:
PromptBuilder.cs

Appends the specified audio file and alternate text to the PromptBuilder.

public void AppendAudio (Uri audioFile, string alternateText);

Parameters

audioFile
Uri

URI for the audio file.

alternateText
String

A string containing alternate text representing the audio.

Examples

The following examples adds an audio file to a PromptBuilder instance and specifies text to speak if the audio file cannot be played.

using System.Speech.PromptBuilder;  

public void SimpleConcatenation()  
{  

    // Concatenate a prompt fragment from a .wav file.  
    PromptBuilder builder = new PromptBuilder ();  
    builder.AppendAudio(new Uri ("C:\\OnHold.wav"), "Your call will be answered in the order it was received");  
}  

The following markup shows the equivalent SSML markup.

<speak xmlns="http://www.w3.org/2001/10/synthesis"  
       xmlns:ms="http://www.microsoft.com/speech/synthesis" xml:lang="en">  

  <audio src="C:\OnHold.wav"> Your call will be answered in the order it was received. </audio>  

</speak>  

Remarks

The speech synthesis engine will speak the alternate text if the audio file cannot be played.

Applies to

.NET 9 (package-provided) e altre versioni
Prodotto Versioni
.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)