PlayAudioFromDisk (Managed Code Sample)
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The PlayAudioFromDisk sample illustrates how to play audio from files on disk. The sample plays wave (.wav) sound files containing music and a recorded prompt. The sample also plays prompts from a prompt database.
Featured Highlights
- Playing audio from .wav files
- Using a URI to reference .wav files
- Using a StatementActivity
- Using a prompt database
- Using different sources of audio in the same StatementActivity object
Running the Sample
To run the sample
In the Samples\Workflow\PlayAudioFromDisk\ directory of the Speech Server installation directory, open the sample solution file.
To start debugging, press F5.
In the Voice Response Debugging Window dialog box, click the SIP Phone tab, enter any numbers in the Called Party and Calling Party boxes, and then click Call.
The sample plays a musical introduction from a .wav file, followed by a greeting played from a prompt database. The rest of the sample alternates between .wav files and prompts from a prompt database.
Remarks
The sample uses a version of the StatementActivity class AppendAudio method, which allows for entry of alternate audio material.
If the file referenced by the URI is not available, the application plays the alternate text using the text-to-speech (TTS) engine.
This code sample is intended to demonstrate specific Speech Server features. It does not necessarily reflect best practices with respect to security and privacy. You should carefully review any code that you deploy in production for potential security risks and privacy issues.