Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

mp3 player in C

  • 02-10-2012 04:21PM
    #1
    Registered Users, Registered Users 2 Posts: 3


    Ima n00b in C but i want to program a chip to read mp3 and then play it but.... i need to make the program in C so does any1 know how to make it (tutorial,source code or documentation please)

    and i REALLY has to be in C not c++ or c# or any other language (so i can make a static library)

    thx :D


Comments

  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    http://stackoverflow.com/questions/428884/how-to-play-mp3-files-in-c

    Easy way: Use a library (fmod is used in link above)
    Hard way: Write your own decoder (here be dragons etc)

    Most modern devices like smartphones etc have special hardware onboard to perform the decoding, so there would be a system call to make use of this. Doing it via CPU would use a lot more power on a phone. PC is so powerful that decoding is no big deal tho.

    Oh, you can write static libraries in C++ btw (and mix it with C). So that isn't a valid reason for choosing only C. If you are limited to C because it's an embedded platform with limited toolchain then that would be a more valid reason.


  • Registered Users, Registered Users 2 Posts: 3 yugic


    Thx alot :D

    but how do i compile static librarys in C++ O.o


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    With some kind of compiler option.... It depends what compiler you use. Here is how to do it for gcc: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html


  • Registered Users, Registered Users 2 Posts: 3 yugic


    Thx a lot :D


Advertisement