How to play MP3 / Wav file using C

Discussion in 'C Programming' started by mutyala rao, Apr 26, 2006.

  1. mutyala rao

    mutyala rao Guest

    Hi ,

    Can we play MP3 file using C ? I know that for that we need to access
    the audio device thru our code. I have also come across some terms
    like sampling rate whixh i dint understand. Can anyone help me out in
    that?

    Regards ,
    Mutyala Rao
     
    mutyala rao, Apr 26, 2006
    #1
    1. Advertising

  2. mutyala rao

    Vladimir Oka Guest

    mutyala rao opined:

    > Can we play MP3 file using C ? I know that for that we need to
    > access the audio device thru our code. I have also come across some
    > terms like sampling rate whixh i dint understand. Can anyone help me
    > out in that?


    For how to access hardware to play sounds, you'll have to ask in a
    group where your particular hardware/software environment is topical.

    For how to decode audio data, ask in comp.programming or a group more
    specialised for audio processing.

    If, in the process, you come across a question or a problem with
    standard C language (the topic of this group), feel free to come back.

    --
    Running Windows on a Pentium is like having a brand new Porsche but
    only be able to drive backwards with the handbrake on.
    (Unknown source)

    <http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>
     
    Vladimir Oka, Apr 26, 2006
    #2
    1. Advertising

  3. mutyala rao

    Rajesh Guest

    I guess you require some sort of algorithms to decode the mp3 plugins
    MP3 is a copyright issue. you might get less support. so why not try
    first with .wav . Try opening wav files . for that you might look at
    the files of xmms. you can view the files from the repository of XMMS.
    right.
     
    Rajesh, Apr 26, 2006
    #3
  4. Rajesh wrote:
    > I guess you require some sort of algorithms to decode the mp3 plugins
    > MP3 is a copyright issue. you might get less support. so why not try
    > first with .wav . Try opening wav files . for that you might look at
    > the files of xmms. you can view the files from the repository of XMMS.
    > right.
    >


    You need to quote context; no one knows what you're saying (yes, I'm
    aware that Googlers can see). Click 'More Options' and 'Add Reply'.

    Also, learn the following concepts:
    1) Capital letters
    2) Spaces after, /not before/ periods
    3) Consistently capitalizing (or not, just be consistent) of acronyms.

    Also, the following subjects are not topical to c.l.c:
    1) Algorithms
    2) Copyright issues
    3) XMMS (this is hardly even related to programming)

    --
    Every prime number in a series as a joke
    Made all the patterns clear when I took that final toke
    A whole lot of funny scribbles define our universe
    And yet the numbers still make me oh so high
    -- Numbers (Sunken Complexity)
     
    Andrew Poelstra, Apr 26, 2006
    #4
  5. mutyala rao

    ruoqingmm Guest

    There are quite a lot free mpg3 decoders written in C, for example,
    mpg123. It's very fast and even can run on ARM architecture with good
    performance.
     
    ruoqingmm, Apr 27, 2006
    #5
  6. ruoqingmm wrote:
    > There are quite a lot free mpg3 decoders written in C, for example,
    > mpg123. It's very fast and even can run on ARM architecture with good
    > performance.
    >

    Please, quote your context.

    --
    Andrew Poelstra <http://www.wpsoftware.net/blog>

    Every prime number in a series as a joke
    Made all the patterns clear when I took that final toke
    -- Numbers (Sunken Complexity)
     
    Andrew Poelstra, Apr 27, 2006
    #6
  7. mutyala rao

    arun Guest

    mutyala rao wrote:
    > Hi ,
    >
    > Can we play MP3 file using C ? I know that for that we need to access
    > the audio device thru our code. I have also come across some terms
    > like sampling rate whixh i dint understand. Can anyone help me out in
    > that?
    >
    > Regards ,
    > Mutyala Rao


    Playing mp3 requires the decoding algorithms. I dont have much details
    about it. If you are interested in playing wav files, it is somewhat
    easier. You can refer to the following linux gazette article and the
    references given in the article.

    http://linuxgazette.net/109/john.html

    Regards,
    arun
     
    arun, Apr 27, 2006
    #7
  8. mutyala rao

    Bob Martin Guest

    in 673725 20060426 231238 Andrew Poelstra <> wrote:

    >Also, learn the following concepts:
    >1) Capital letters
    >2) Spaces after, /not before/ periods
    >3) Consistently capitalizing (or not, just be consistent) of acronyms.


    This is comp.lang.c not alt.usage.english

    He is only writing his post the way most C programmers write code.

    And please consider trimming your sig lines.
     
    Bob Martin, Apr 27, 2006
    #8
  9. mutyala rao

    Al Balmer Guest

    On Thu, 27 Apr 2006 06:38:33 GMT, Bob Martin <>
    wrote:

    >in 673725 20060426 231238 Andrew Poelstra <> wrote:
    >
    >>Also, learn the following concepts:
    >>1) Capital letters
    >>2) Spaces after, /not before/ periods
    >>3) Consistently capitalizing (or not, just be consistent) of acronyms.

    >
    >This is comp.lang.c not alt.usage.english
    >
    >He is only writing his post the way most C programmers write code.


    Speak for yourself, not for "most C programmers" ;-)
    >
    >And please consider trimming your sig lines.


    --
    Al Balmer
    Sun City, AZ
     
    Al Balmer, Apr 27, 2006
    #9
  10. mutyala rao

    David Wade Guest

    "mutyala rao" <> wrote in message
    news:...
    > Hi ,
    >
    > Can we play MP3 file using C ? I know that for that we need to access
    > the audio device thru our code. I have also come across some terms
    > like sampling rate whixh i dint understand. Can anyone help me out in
    > that?
    >
    > Regards ,
    > Mutyala Rao
    >


    #include<stdlib.h>

    main(){

    system("cmd /c \"C:\\Program Files\\Windows Media Player\\wmplayer.exe
    myfile.mp3\"\n");

    }

    But of course thats off-topic here as "shell" is not a standard system
    call....

    I guess what I am trying to say is you have not provided enough info ...

    Dave.
     
    David Wade, Apr 27, 2006
    #10
  11. mutyala rao

    Richard Bos Guest

    Bob Martin <> wrote:

    > in 673725 20060426 231238 Andrew Poelstra <> wrote:
    >
    > >Also, learn the following concepts:
    > >1) Capital letters
    > >2) Spaces after, /not before/ periods
    > >3) Consistently capitalizing (or not, just be consistent) of acronyms.

    >
    > This is comp.lang.c not alt.usage.english


    All the more reason why exact communication is important.

    > He is only writing his post the way most C programmers write code.


    If most programmers wrote code which was inconsistent in capitalisation
    and punctuation, most programmers could not get their code to compile.

    Richard
     
    Richard Bos, Apr 28, 2006
    #11
  12. mutyala rao wrote:
    >
    > Hi ,
    >
    > Can we play MP3 file using C ? I know that for that we need to access
    > the audio device thru our code. I have also come across some terms
    > like sampling rate whixh i dint understand. Can anyone help me out in
    > that?


    Have a look at libsndfile:

    http://www.mega-nerd.com/libsndfile/

    It can read and write WAV and a bunch of other file formats.
    MP3 however is not supported because of patent/licensing issues.

    http://www.mp3licensing.com/royalty/software.html

    Included in the libsndfile source code tarball is a player which
    can play files on Linux, MacOSX and Win32.


    Erik
    --
    +-----------------------------------------------------------+
    Erik de Castro Lopo
    +-----------------------------------------------------------+
    "Arguing that Java is better than C++ is like arguing that grasshoppers
    taste better than tree bark." -- Thant Tessman
     
    Erik de Castro Lopo, Apr 28, 2006
    #12
  13. mutyala rao

    ruoqingmm Guest

    I remember, lots of decoders are free while most of the encoders are
    not.
     
    ruoqingmm, Apr 29, 2006
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Domingo
    Replies:
    1
    Views:
    532
    Andrew Thompson
    Jul 17, 2004
  2. Gezzed
    Replies:
    8
    Views:
    997
    Mark Parnell
    Aug 25, 2004
  3. Asle Frantzen

    Mp3-player - how to play an mp3?

    Asle Frantzen, Jul 8, 2003, in forum: C++
    Replies:
    5
    Views:
    704
    Kelsey Bjarnason
    Jul 22, 2003
  4. el chupacabra
    Replies:
    1
    Views:
    386
    Lucas Raab
    Aug 27, 2005
  5. '2+
    Replies:
    2
    Views:
    524
Loading...

Share This Page