LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-21-2004, 04:02 PM   #1
k_wjss
LQ Newbie
 
Registered: Sep 2004
Posts: 12

Rep: Reputation: 0
Playing mp3 in a c program


I would lik to create a simple c program that takes in simple user input and plays an mp3 file according to the user input. The mp3 files will be stored in a designated directory (eg. \music) and this program will be running on linux platform.

Is there any sound or player library that i can make use of? Or is there anyway i can interface with any already present Linux mp3 player?

How do i actually go about doing so?
 
Old 09-21-2004, 06:42 PM   #2
Feminista
Member
 
Registered: Sep 2004
Distribution: Gentoo, OS X
Posts: 37

Rep: Reputation: 15
You could look into mpg123 or mpg321. mpg123 is what XMMS uses, and it's in pretty wide use for such things, but its license is restricted. mpg321 is a essentially the same type of thing, but with a completely free license so you can use the code in your own things, which looks like what you need. As for specific libraries, mpg321 uses MAD MPEG, but I don't know much more than that.

Last edited by Feminista; 09-21-2004 at 06:44 PM.
 
Old 09-21-2004, 07:59 PM   #3
k_wjss
LQ Newbie
 
Registered: Sep 2004
Posts: 12

Original Poster
Rep: Reputation: 0
thks!
i went to [URL=http://sourceforge.net/project/showfiles.php?group_id=36274] and found 4 files there for this player but how do i actually go about installing this player? I am new to linux and dont really know where to save or run the various files.

do i require any other files to play mp3 because i am using fedora and they do not allow me to play mp3.

by the way, this mpg321 can actually allow me play locally stored mp3 files with it. however if i want to play audio streams from an external source (eg. another computer serving as an mp3 jukebox), can it be done using this program as well?
 
Old 09-25-2004, 04:11 PM   #4
Paxmaster
Member
 
Registered: Jun 2004
Location: unknown place in NYC
Distribution: Ubuntu
Posts: 377

Rep: Reputation: 30
hello I am also looking for mp3 player so if u made the software please send it to me.
 
Old 09-25-2004, 10:38 PM   #5
tonyfreeman
Member
 
Registered: Sep 2003
Location: Fort worth, TX
Distribution: Debian testing 64bit at home, EL5 32/64bit at work.
Posts: 196

Rep: Reputation: 30
sdllib or smpeg library

You can use the "Simple DirectMedia Library (SDL)" to access low level audio for your sound card and to play music from your CDROM.

http://www.libsdl.org/

SDL does not natively support MP3, but this is easily corrected by simply installing the smpeg library (which was written specifically for SDL and therefore requires SDL to compile).

http://icculus.org/smpeg/

While you're at it ... you can THEN install libvorbis in order to decode and play ogg files.

http://www.vorbis.com/

THEN install SDL_mixer which provides the API that allows you to call up both mp3 and ogg files (among others) from the same function calls.

http://www.libsdl.org/projects/SDL_mixer/

Here is a link to a tutorial for SDL_mixer:
http://www.kekkai.org/roger/sdl/mixer/index.html

-- Tony
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
playing mp3 sycamorex Linux - Newbie 11 11-20-2005 11:34 AM
playing mp3 in RH 9 sharathg786 Red Hat 1 09-25-2005 07:52 AM
amarok playing mp3 TranceDude Linux - Software 3 08-27-2005 10:04 AM
samba playing mp3 h2gofast Linux - Networking 5 04-08-2005 10:27 PM
mp3 playing fast GM Myrdin Slackware 6 06-11-2004 03:29 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration