How to play MP3 / Wav file using C

M

mutyala rao

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
 
V

Vladimir Oka

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>
 
R

Rajesh

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.
 
A

Andrew Poelstra

Rajesh said:
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)
 
R

ruoqingmm

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.
 
A

Andrew Poelstra

ruoqingmm said:
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)
 
A

arun

mutyala said:
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
 
B

Bob Martin

in 673725 20060426 231238 Andrew Poelstra said:
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.
 
A

Al Balmer

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" ;-)
 
D

David Wade

mutyala rao said:
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.
 
R

Richard Bos

Bob Martin said:
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
 
E

Erik de Castro Lopo

mutyala said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top