Help with using sound in C# - Extensions cannot find SoundPlayer

I have tried various methods to use SoundPlayer or other ways of playing sound, but each of them fails and throw up an error. - C#
Repl link:
Related Code

using System.Windows.Extensions;

class Program 
  public static void Main (string[] args) 
    SoundPlayer player = new SoundPlayer(@"Underwaterbeats - Delete!.mp3");

The above code gave this error:
‘error CS0234: The type or namespace name ‘Extensions’ does not exist in the namespace ‘System.Windows’’

I have also attempted to use namespace instead of using, but that threw up this error:
‘CSC : error CS1555: Could not find ‘Program’ specified for Main method
error CS0246: The type or namespace name ‘SoundPlayer’ could not be found’

I also attempted to use SystemSounds instead but that also didn’t work:
‘error CS0103: The name ‘SystemSounds’ does not exist in the current context’

Thank you so much for any help you can give!

Replit runs on Linux, not Windows, so that’s likely your issue there.

Also, sound is generally unreliable on Replit.

1 Like