PromptBuilder.AppendAudio Method
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.
Appends a specified audio file to a PromptBuilder object.
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. |
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
- Source:
- PromptBuilder.cs
Appends the specified audio file to the PromptBuilder.
public:
void AppendAudio(System::String ^ path);
public void AppendAudio (string path);
member this.AppendAudio : string -> unit
Public Sub AppendAudio (path As String)
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) |
- 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);
public void AppendAudio (Uri audioFile);
member this.AppendAudio : Uri -> unit
Public Sub AppendAudio (audioFile As Uri)
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) |
- 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, System::String ^ alternateText);
public void AppendAudio (Uri audioFile, string alternateText);
member this.AppendAudio : Uri * string -> unit
Public Sub AppendAudio (audioFile As Uri, alternateText As String)
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) |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: