Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:28:53+00:00 2026-06-16T00:28:53+00:00

I use SoundPlayer to play sound effects in the WPF program. However, I find

  • 0

I use SoundPlayer to play sound effects in the WPF program. However, I find that when two sounds effects are played at the same time, the new one will replace the old one (i.e. the new will terminate the old and play itself), but what I want is to keep playing the old one even when the new one is played.

SoundPlayer wowSound = new SoundPlayer("soundEffect/Wow.wav");

SoundPlayer countingSound = new SoundPlayer("soundEffect/funny.wav");

wowSound.Play(); // play like background music

countingSound.Play();  // from click to generate the sound effect
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:28:53+00:00Added an answer on June 16, 2026 at 12:28 am

    You may use SoundPlayer.PlaySync() which plays the .wav file using the User Interface thread so that wowSound would be played first. Then, countingSound will be played after wowSound has finished playing

    Example

    SoundPlayer wowSound = new SoundPlayer(@"soundEffect/Wow.wav"); //Initialize a new SoundPlayer of name wowSound
    SoundPlayer countingSound = new SoundPlayer(@"soundEffect/funny.wav"); //Initialize a new SoundPlayer of name wowSound
    wowSound.PlaySync(); //Play soundEffect/Wow.wav synchronously
    countingSound.PlaySync();  //Play soundEffect/funny.wav synchronously 
    

    NOTICE: You can not play more than ONE sound at the same time using SoundPlayer as it does not support playing simultaneous sounds. If you would like to play TWO or more sounds at once, System.Windows.Media.MediaPlayer would be a better option

    Example

    MediaPlayer wowSound = new MediaPlayer(); //Initialize a new instance of MediaPlayer of name wowSound
    wowSound.Open(new Uri(@"soundEffect/Wow.wav")); //Open the file for a media playback
    wowSound.Play(); //Play the media
    
    MediaPlayer countingSound = new MediaPlayer(); //Initialize a new instance of MediaPlayer of name countingSound
    countingSound.Open(new Uri(@"soundEffect/funny.wav")); //Open the file for a media playback
    countingSound.Play(); //Play the media
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize that you can use SoundPlayer to play a sound in C#; however,
I want to play sound when the window form loaded, SoundPlayer sound = new
I'm using the SoundPlayer class to play WAV files in my WPF application. The
Use case: I find a piece of code that I do not understand at
i use a sound player in my winform application. Is there a way to
use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; use Test::Exception;
In a C# program I'd like to allow users to specify a sound file
Use Elixir and have two entities -- Voter and Candidate -- with many to
use warnings; use Test::More; use File::Find::Rule; use Test::File::Find::Rule; my $rule = File::Find::Rule->file->name('*.pl')->not_grep(qr/^\s*use\s+strict;/m, sub {
use strict; use Time::HiRes qw[gettimeofday tv_interval]; my $start_index = int(rand(50))+100;#this value is arbitrary for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.