0

I'm a beginner in C# programming and programming in general and I wanted to make a program that runs audio and runs text together.

I've tried putting the code everywhere and it either plays before the text or after it.

Here's the audio code:

using (SoundPlayer player = new SoundPlayer("C:\\Users\\Owner\\Downloads\\Undertale Sound Effect Sans.wav"))
{
    player.PlaySync();
}

and here's the writing code:

Console.WriteLine("text");
Console.ReadLine();

Also I am using the System.Media; thing.

I want the code to play the audio and writing in sync.

  • 1
    Possible duplicate of [How to use System.Media.SoundPlayer to asynchronously play a sound file?](https://stackoverflow.com/questions/1161229/how-to-use-system-media-soundplayer-to-asynchronously-play-a-sound-file) – rs232 May 20 '19 at 13:20
  • This may help you: https://stackoverflow.com/questions/4429513/play-wav-file-async-multiple-times-with-net Since you are new to C#, you will have play run the code async which means that the program doesn't stop when you run a line of code. Think of it like a background process. – Haley Mueller May 20 '19 at 13:22

0 Answers0