581 Tutorial 5

CPSC581.581Tutorial5 History

Show minor edits - Show changes to markup

Added line 17:
Changed lines 8-11 from:

This tutorial shows you how to use the mediaElement object from WPF. In particular, it illustrates how you can play, plause, stop, seek, and adjust the volume of a song.

The code should be self-explanatory, so I won't bother explaining it. Note that the slider implementing seek tries to find a new position as you drag the slider vs. after you let go, so its jittery. This should be fixed so it seeks only after you complete the drag.

to:

This tutorial shows you how to use the mediaElement object from WPF. In particular, it illustrates how you can play, plause, stop, seek, and adjust the volume of a song.

The code should be self-explanatory, so I won't bother explaining it. Note that the slider implementing seek tries to find a new position as you drag the slider vs. after you let go, so its jittery. This should be fixed so it seeks only after you complete the drag. The slider also uses the selection range to show where in the audio we are (let it play for a bit, and you will see it).

Added line 16:

Note: you can also play sounds through the SoundPlayer class; it is even simpler, but that doesn't have as much power.

Changed lines 8-11 from:

This tutorial shows you how to use the mediaElement object from WPF. In particular, it illustrates how you can play, plause, stop, seek, and adjust the volume of a song.

The code should be self-explanatory, so I won't bother explaining it.

to:

This tutorial shows you how to use the mediaElement object from WPF. In particular, it illustrates how you can play, plause, stop, seek, and adjust the volume of a song.

The code should be self-explanatory, so I won't bother explaining it. Note that the slider implementing seek tries to find a new position as you drag the slider vs. after you let go, so its jittery. This should be fixed so it seeks only after you complete the drag.

Added lines 5-15:

Its always great to have some audio output. This tutorial includes sample code that shows you how to play an audio file, and how to synthesise speech.

Playing an audio file

This tutorial shows you how to use the mediaElement object from WPF. In particular, it illustrates how you can play, plause, stop, seek, and adjust the volume of a song.

The code should be self-explanatory, so I won't bother explaining it.

Additional information: Chapter 14 in the Windows Presentation Foundation Unleashed book.

Download: WPFPlaySong.zip project

Added lines 14-17:

The code should be self-explanatory, so I won't bother explaining it.

Additional information: Chapter 14 in the Windows Presentation Foundation Unleashed book.

Changed line 14 from:

Download WPFSpeakToMe.zip project

to:

Download: WPFSpeakToMe.zip project

Changed line 14 from:

Download WPFSpeakToMe.zip project

to:

Download WPFSpeakToMe.zip project

Added lines 1-14:

(:title 581 Tutorial 5:)

<< Back to the 581 tutorial overview page

Speech synthesis

This tutorial shows you how to use the speech synthesis facilities that can be accessed from WPF. In particular, it illustrates some very basic uses of the SpeechSynthesize and PromptBuilder class objects.

As you type, it will repeat the last sentence just after you type a punctuation mark (.?,). If you click the button, it will say the time, then it will repeat the entire text in a speeded up male voice.

Note that your computer may not have all the 'voices' installed, so if you try to change some voice parameters (e.g., gender) it may have no effect.

Caveats. If you try to generate speech on the fly (e.g., saying a letter as you type it), you will notice significant delays. That is, it takes a while for it to start speaking after you invoke the Speak method.

Download WPFSpeakToMe.zip project