Tech Off Thread

11 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

A managed MP3 player

Back to Forum: Tech Off
  • User profile image
    raptor3676

    HI,

    I've developed mainly Image processing programs and a Neural network simulator in C# and I've been able to achive C++ speed.  Mainly by using pointer arithmetic and avoiding every posible overhead, say casts, boxing/unboxing, etc.  I even was able to code a .net version of a Java Image processing app, and bring it from 30seconds (Java) to 0.018 seconds (C#). (BTW take that Java zealots)

    So this makes me wonder, Is it possible to code a managed MP3 Player using the .NET framework without such player hogging the main CPU? 5-10% of a Pentium 4 @2GHz is too much to ask?


    What do you guys think? I am nuts?

  • User profile image
    nightski

    Go for it!  BTW - I would be interested in heping you out.  I also have done quite a bit of image processing & machine learning code in C#.  I am using IL generation for expressions to generate really lean matrix code.  Its pretty cool.

    The hardest part of this that I can see is interacting with the hardware.  I suppose one could try the Managed DirectX impelementation which is very fast.

    Anyways, let me know how it works out.

  • User profile image
    W3bbo

    I understand you can get better performance overall and reduce HDD "wear and tear" by loading the entire file into memory before playing.

  • User profile image
    Minh

    Yeah, definitely, you'd need DirectSound at the end to actually play the decoded sound. Essentially, you set up a small (64K?) circular buffer & decode your MP3 file piece by piece. There are examples in the SDK.

    I'm pretty sure that you'd need to a license to do an MP3 encoder, probably the same for a decoder. But if you're not going to sell your software, I think you'd be safe.  (not to be construe as legal advice. All rights reserved.)

    Edit: Oh wait. MS has already license the MP3 decoder, hasn't they? Then all you have to do is use DirectShow to play your MP3. Although, writing your own is the point, I guess.

  • User profile image
    raptor3676

    nightski wrote:

    Go for it!  BTW - I would be interested in heping you out.  I also have done quite a bit of image processing & machine learning code in C#.  I am using IL generation for expressions to generate really lean matrix code.  Its pretty cool.

    The hardest part of this that I can see is interacting with the hardware.  I suppose one could try the Managed DirectX impelementation which is very fast.

    Anyways, let me know how it works out.



    Jesus man!!! Thanks for your trust, but I don't think I have what it takes to do it... for a start: Where do I get the MP3 file format especification?

    Besides that IL generation is something I definitely want to learn, I found an article about it on ww.codeproject.com. But just as the MP3 stuff, days only have 24hours and I still have a work and a live to do!

    Anyway I'd like to hear more about .Net having what it takes to do an MP3 Player.

    Raptor

    PS: What the hell!!!! Anyone knows Where do I get the MP3 file format especification?

  • User profile image
    Maurits

    Must be possible because here's one

  • User profile image
    raptor3676

    Maurits wrote:
    Must be possible because here's one


    I'm not sure if it a full .Net implementation.

    I download it and try to open the main dll, with the, always handy, Lutz Roeder's .NET Reflector, And I found that the main dll uses the services of yet another dll that this programs doesn't recognizes as an .NET Assembly (it doesn't have a CLI header).

    Not to mention that such dll is loaded by using the Win32 LoadProcessA function.

    Of course there is the possibility that the dll has been obfuscated, but the LoadProcessA function used to load it is very suspicious.

    Raptor

  • User profile image
    nightski

    Yeah, its not.  After a little research I came across this - http://www.underbit.com/products/mad/

    That is an open source mp3 decoder (mp3->PCM) that is used in all the major open source media players (rythmbox, gstreamer, etc...)

    It is fully compliant with MPEG-1, MPEG-2, and MPEG-3.  Very cool.

    I'm looking at the source now to see how hard this might be to convert to .NET Smiley

    I'll let ya know.

    EDIT: I checked it out and a port of this library could be done.  It wouldn't be too hard, just time consuming.  Remember this is just for the decoding of the MP3 audio stream.  For header information check out -

    http://www.codeproject.com/audio/MPEGAudioInfo.asp

    Also, once you have the PCM stream you can then output directly to DirectX.

  • User profile image
    geek2max

    W3bbo wrote:
    I understand you can get better performance overall and reduce HDD "wear and tear" by loading the entire file into memory before playing.

    It could be bad for large DJsets Big Smile

  • User profile image
    Maurits

    geek2max wrote:
    W3bbo wrote:I understand you can get better performance overall and reduce HDD "wear and tear" by loading the entire file into memory before playing.

    It could be bad for large DJsets


    s/the entire file/as much music as will fit into available memory/ Smiley

  • User profile image
    W3bbo

    geek2max wrote:
    W3bbo wrote:I understand you can get better performance overall and reduce HDD "wear and tear" by loading the entire file into memory before playing.

    It could be bad for large DJsets


    Speaking of popular music, is it any co-incidence you look like Limp Bizkit's drummer?

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.