Reputation: 46480
I am getting married this coming Saturday (May 30 2009). We are poor. So, instead of hiring a DJ, I want my friend to kick off mp3 playlists from a laptop to be played through a PA system.
Well I had a vision for some software that would be perfect for this. Here is that vision:
I want this to be so that my friend can't screw this up and I think that if my vision were a reality then there would be no screwing up.
And now for the programming question? How can I play mp3's from .net code? I am currently experimenting with NAudio, but I don't know if I can make it fade the files in/out.
Are there any other free libraries out there that could help me? Thanks for any input. Time is of the essence.
Focus on the programming question! If I ever need to work with audio in the future, your answers could be the keys to my destiny.
Upvotes: 4
Views: 8060
Reputation: 19976
I wrapped mp3 decoder library and made it available for .net developers. You can find it here:
http://sourceforge.net/projects/mpg123net/
Included are the samples to convert mp3 file to PCM, and read ID3 tags.
You need something like waveOut wrapper, that I know it exists, and there you go!
Upvotes: 0
Reputation: 46480
As I said before,
"There are a lot of great suggestions on libraries to help with playing audio, and that's what I was really going for. I'm not really going to try to write the program. Thanks for the great responses."
Just for those who are curious: For my wedding, I used Winamp 5.whatever and saved playlists for different parts of the wedding and prefixing the filenames with 01, 02, ... so they would show up in order in the filesystem.
To normalize the audio I downloaded a plugin called RockSteady, which worked great. For fading on stop/pause/between songs, in Options -> Preferences -> Plugins -> Output -> Nullsoft DirectSound Output Configuration -> Fading Tab I set "on end of song" to 6000 ms and "on pause/stop" to 15000 ms. Then on the other tab I checked the "Logarithmic Fades" checkbox.
These settings made the audio sound nice and professional.
Upvotes: 1
Reputation: 1732
I agree with the others, make several playlists and just load/play them with windows media player.
Upvotes: 0
Reputation: 1697
What you're describing sounds like functionality programs like iTunes and Windows Media Player have had for years, and I would recommend just using one of those two programs. However, if you do want to play MP3s from .NET, a Google search found me this: http://www.codeproject.com/KB/audio-video/mp3player.aspx and this: http://www.codeproject.com/KB/audio-video/ManWMF.aspx
Also, if your wedding is in 4 days, this probably not the best idea. I wouldn't waste your time writing a media player. If you want it to be polished and idiot-proof, use iTunes. If you want to write a media player, do it after your wedding.
Upvotes: 11
Reputation: 5348
Really interesting, but in my opinion you should use an already existent solution.
However, you can check these links:
Also the Windows media player com control should be a good option.
PS: I don't know if I can include a question in an answer, but How have you made that graphic?
Upvotes: 0
Reputation: 1827
I agree with most of the others here. I think you should really try to uncomplicate things by using another already build free option like itunes, Winamp or WMP. If you really want to learn something new, do this just for fun after when you won't be under so much pressure to make it work.
If, however you REALLY want to go through with this I think http://code.google.com/p/ffmpeg-sharp/ should do what you want.
Upvotes: 0
Reputation: 147461
By far the simplest and easiest solution here is to use the Windows Media Player COM control. This page offers a good guide to getting started with this approach. Just adjusting the volume level with a timer could create a fade in/out effect.
If you want full control over playback, then there's always the DirectShow.NET option, although this is probably overkill for you're task. What is more, it's quite painful to use unless you already have some amount of experience with the unmanaged DirectShow API. However, as I said, I would try to stay away from this if possible.
Edit: I have also now realised that the Microsoft.Xna.Framework.Media
namespace could offer a nice managed solution for your task. It should certainly give more control than the WMP control (and is purely .NET rather than COM, as bonus). The only slight disadvantage is that it requires the XNA Framework 3.0 to be referenced.
Upvotes: 7
Reputation: 6947
You're reinventing the wheel. If "time is of the essence" just create the playlist files for your friend and put them all in the same directory. Label them 00 - Prelude, 01 - Processional, etc.
See this article on the M3U format for more info. You can list the files to play in this text based format. Or just use a media player such as winamp or windows media player to create the playlist files.
Upvotes: 0
Reputation: 49301
Download MediaMonkey. You have better things to do a week before your wedding than write another MP3 player. MediaMonkey even has a DJ mode that locks your system so that your guests can't change your playlists.
Upvotes: 3