Writing an audio player in C#

2019-02-07 12:22发布

问题:

I have a pretty cool idea for a very special media player. I like to think about this project as a mini-startup, since I don't yet know if my idea is practical.

Anyways, before implementing my idea, I first need to be able to implement a simple audio player. My preferred language for this project is C#, simply because it's so easy to use, but any other object oriented language would be fine too I guess.

I started out with no knowledge whatsoever about audio. My main goals right now are:

  • Being able to play audio files - as many formats as possible (sort of a VLC type player, but only audio for now).
  • Being able to analyze audio files - as in, reading frequency, amplitude, volume, and other information about the audio. I think maybe a good idea here is to be able to analyze one file format (PCM?), and then temporarily converting any file I want to analyze to that format. This is in order to later implement a mechanism that compares songs and identifies similar songs to recommend to the user (this feature isn't part of my idea, but I figured since it exists in many players nowadays, I need to have it too if I want be able to compete with them). BTW - I currently don't have any knowledge about audio/wavelengths/frequencies and such, so I'd appreciate it if someone could point me in the right direction about this analyzation feature.
  • Maybe in the future I'd expand to playing video files as well, but for now I'm concentrating on audio.

After searching the Internet for a while, I've come across LAME. Problem is, it's not C#, and I'm not sure how to use it. I know there is something called "Interoperability", that is supposed to let me work with native DLL files through C#. Any information about that would be helpful as well.

Any help would be much appreciated.

Thanks, Malki :)

回答1:

Bass audio library | Alvas.Audio | Naudio have C# API.