Lesson 4 - Time and Sound

This tutorial will cover how to add sound effects and keep track of time in a Monogame program.

Lesson 4 - Time and Sound

What to Do?

1 - Complete the tutorial on Time and Sound.


2 - Complete the Your Task programming component of the tutorial along with any challenges that you can complete.  Complete the Your Task 2 component as well.

3 - Try some of the challenges laid out in the tutorial or something of your own.

By the end of this you should know:

What to Submit:

1 - The completed programming task described in the tutorial, along with any completed challenges. 

Lesson Tutorial - Time and Sound

Here is the image file used in the tutorial:

You will also need to download the sound effects found at the bottom of this page.

Monogame Lesson 4 - Text and Time.pdf

Files

You will need explosion.wav for this tutorial, and tribble_coo.mp3 to add to Animations

Time Tracking Visual

Tips and FAQ's

Q - What is the best way for me to time events with sound effects or the end of songs?

A - You have two options listed below.  Option 1 is for long sound effects like background music, but just one at a time.  Option 2 is better suited to sound effects.

Option 1: If you are playing a longer sound like background Music, you can use the MediaPlayer and a Song object to play it.  This gives you access to all sorts of details regarding the sound file.  You can only play one sound through the media player at a time.

Here is an example program that demonstrates using the Song class and MediaPlayer:

https://github.com/AldworthClass/Monogame-Songs

Option 2: Create a SoundEffectInstance and use it to play your sound file.  You can play multiple sounds at once, and determine whether a sound effect is playing or not.

Here is a good tutorial on how to use it:

http://rbwhitaker.wikidot.com/playing-sound-effects