简体   繁体   中英

What are my options/resources for playing audio in C#?

I'm aware of how to play sound in C#, for example:

System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"c:\local_file.wav");
player.Play();

However, I wanted to know if C# contained some sort of sound library, like files that are built in to the system that I can use, or something that generates sound (eg text to speech.) Basically, I just want to know what my options are for playing sound in my program, and/or whether I have any "resources" other than my own downloaded files.

C# is a progamming language. It runs on many different platforms, each of which support many different libraries.

The SoundPlayer class in the .Net System.media namespace is one very good choice for Windows. Similarly NAudio or IRKlang might be good choices for doing audio in C# on Linux.

There isn't necessarily any "single best, one size fits all" choice. You have many different options, depending on your platform, your requirements, and your personal preferences.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM