Thread: Audio Library Needed!

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    47

    Audio Library Needed!

    Does anybody know of a C++ audio library that can run on Linux? The audio library needs to be able to play the songs backwards and forwards at fast rates, and the pitch needs to be able to be changed. It should run MP3s. Anyone know of anything? The library would be used for a virtual turntable program, so it should run just like a turntable.

    Thanks!
    ~Matt
    Windows XP Service Pack 2
    Borland C++ Compiler Version 5.5

  2. #2

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    47
    That's pretty much exactly what I needed, but do you know of anything that doesn't cost $6000 to use in a commercial application?
    Windows XP Service Pack 2
    Borland C++ Compiler Version 5.5

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    if not cross platform use mciSendString() (windows) winmm.lib, mmsystem.h header, and need to include windows.h as well

  5. #5
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Well, if you only want to deal with MP3s, I am sure there is plenty of open source code out there that could show you how to decode an MP3. And if I remember right once it is decoded you can just pipe it to the sound card or mixer or something.

    Also you can also hit up google.

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    630
    Search for LAME (or something like that I think).

  7. #7
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Well, I would say OpenAL. Then again OpenAL doesn't have an MP3 decoding library. But if you only wanted to make a frontend and let the library be the backend, you can use xine. Although I must stress you that MP3 has some legal issues (or so I heard). Check here for further knowledge about MP3 license.
    ERROR: Brain not found. Please insert a new brain!

    “Do nothing which is of no use.” - Miyamoto Musashi.

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    I suggest you post your question on the Linux Forum.

    You will need an MP3 decoder, and I assume that the Linux disrtos don't come with one since it does need to be licensed ($). If your Linux system can already play MP3s, then it already has a decoder. It may be difficult to find a ligitimate MP3 codec... I've looked for one for Windows, and there's not much out there. (Windows comes with a licensed decoder, but not an encoder.)

    LAME is an encoder (which you may not need for this project). LAME itself is unlicensed (distributed for "educational' purposes"), although there may be licensed programs that use the LAME source code.

    You should be able to find a library that opens & plays audio files. I'm not sure if you'll find a library that includes play-backwards or variable-speed functions. But, once you've decoded the MP3 it will be represented by a simple series of samples (an array or vector). It would be trivial to reverse the sequence, or to change the speed by altering the effective sample rate. Well, the sample rate might be a tiny bit tricky because you might have to skip-over samples and/or interpolate... But, that's pretty easy in C++!
    Last edited by DougDbug; 01-09-2007 at 02:53 PM.

  9. #9
    Registered User
    Join Date
    Jun 2006
    Posts
    47
    Hey, thanks everyone! I've found exactly what I need. :-) I'm thinking about using LAME, but just one more thing....

    On the MP3 licensing site (http://www.mp3licensing.com/royalty/)...It says that a decoder is $0.75 for a software license and $2.50-$5.00 for a codec. So, if I payed this price for example, would they provide me with code allowing the decoding of an MP3? Also, which one should I buy? And if I wanted the Linux distro to play MP3s, should I buy a hardware license?
    Windows XP Service Pack 2
    Borland C++ Compiler Version 5.5

  10. #10
    Insane Game Developer Nodtveidt's Avatar
    Join Date
    Nov 2006
    Location
    Isabela, PR
    Posts
    105
    Avoid using mp3 at all costs. It's an old, outdated, proprietary format that you have to pay royalties for. Look at ogg-vorbis instead, much more modern and royalty-free.
    Code:
    cout << "Language comparisons are dumb";
    echo("Language comparisons are dumb");
    PRINT "Language comparisons are dumb"
    alert ("Language comparisons are dumb")

  11. #11
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Perhaps you should choose an open source format so that you don't have to worry about royalties, maybe Ogg Vorbis

  12. #12
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Sorry, to post here, but better than a new thread. What is a good media library capable of playing .mid, .mp3, and mpg files other than the old mciSendString?

  13. #13
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    Wow, did you even read the thread?

  14. #14
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    umm yes, I posted somewhere towards the top... why that question? I see nothing wrong with my question, elaborate please on my error

  15. #15
    Registered User
    Join Date
    Jun 2006
    Posts
    47
    Quote Originally Posted by Wraithan
    Perhaps you should choose an open source format so that you don't have to worry about royalties, maybe Ogg Vorbis
    That is a genious idea! You know, a while back, I just thought ogg vorbis was some unkown file format, but after seeing the Vorbis.com website, the truth has been revealed. It does sound better than an MP3, like they say!

    Thanks, everyone! I am now going with Ogg Vorbis! This is why I come on this forum. There are geniuses here!
    Windows XP Service Pack 2
    Borland C++ Compiler Version 5.5

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Difficulty choosing graphics library
    By jdiperla in forum Game Programming
    Replies: 11
    Last Post: 02-27-2008, 06:35 PM
  2. Sound Input Library Needed
    By Matt3000 in forum C++ Programming
    Replies: 0
    Last Post: 07-12-2007, 12:46 PM
  3. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 07:42 AM
  4. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 04:52 AM
  5. C++ Matrix library needed
    By Sang-drax in forum C++ Programming
    Replies: 7
    Last Post: 09-03-2002, 01:48 PM