Home > Windows Application > Play sounds

Play sounds

We can play sounds in  Window application by using Systems.Media namespace

SoundPlayer class is used to load sounds from a location.

To play a sound use Play() method for continuous play use PlayLooping() method.

Here a sample code snippet.

SoundPlayer alrmTone = new SoundPlayer(@"c:\Windows\Media\Windows XP Startup.wav");
alrmTone.PlayLooping();
alrmTone.Stop();
  1. No comments yet.
  1. No trackbacks yet.

Thanks for your comment keep visit for new contents.