1

I realize I asked a question similar to this before, but the planning on what I want to do has come some way, and the parameters have become a bit different.

Basically, I'm looking for the best option for decoding and outputting audio on both Mac and Windows. Ideally, there will be no differences in needed code between the two platforms. I just want to be able to pass it a file path or HTTP URL and have it play the audio with the ability to pause, seek, etc.

It must be able to decode MP3 and AAC out of the box with no dependencies on the OS (like Phonon for Qt which is entirely dependent on the OS). Any other codecs beyond that would be a very nice bonus.

I've looked at things like libavcodec, which supposedly can decode about anything, but haven't been able to figure out how to get it to work. So far it seems that libraries I've seen are also ready for Mac and Linux or Windows and Linux but not Mac and Windows.

It does not need to be open source, but if it is needs to be usable in commercial products. I'm OK with licensing something as long as it's not too expensive and easy to use.

Finally, while C/C++ would be preferred, if there's something that would work with C#/Mono, that's OK too.

Any suggestions on something that would work for this?

Community
  • 1
  • 1
Adam Haile
  • 30,705
  • 58
  • 191
  • 286

2 Answers2

2

I've created a C++ audio library for Mac and Windows named "Crosstalk".

Crosstalk is a C++ audio engine that allows you to create and route audio systems in real-time. The engine takes care of all the audio routing and gives you a simple platform for creating system components (E.g. "Mp3 Decoder" component connected to a "Low-Pass Filter" connected to an "Audio Device" and "File Recorder").

It's very easy to use. Here's an example of how to play an mp3 file (These components are provided with the engine):

XtSystem system;
XtMp3Decoder mp3Decoder;
XtAudioDevice audioDevice;

long md = system.addComponent(&mp3Decoder);
long ad = system.addComponent(&audioDevice);

system.connOutToIn(md,0,ad,0);
system.connOutToIn(md,1,ad,1);

mp3Decoder.loadFile("../05 Tchaikovski-Swan Lake-Scene.mp3");
mp3Decoder.play();

Included with Crosstalk is example Xcode and Visual Studio projects.

You can download Crosstalk and check out the API documentation and licensing details here: http://www.adaptaudio.com/Crosstalk

EDIT (01-12-2012):

Crosstalk has been replaced by an open-source project called "DSPatch". DSPatch is essentially an upgraded version of the routing engine behind Crosstalk that is no longer limited to only audio processing. DSPatch allows you to create and route almost any type of process chain imaginable, and free for personal AND proprietary use :)

  • Looks interesting. Although, I would need more than just MP3. From your site, I couldn't find anything stating it decoded files beyond MP3. – Adam Haile May 14 '12 at 18:28
0

decode MP3 and AAC out of the box

I'm not aware of any audio library that does this so easilly. The problem is the license issue regarding MP3 decoding.

I discuss some options on this post, and they are good for Windows/Mac OS X, but I'm not sure if they have C# bindings.

If you are willing to write the bindings yourself, you might be interested at libaudiodecoder:

A C++ cross platform MP3/AAC/WMA/WAV decoder.

It comes with an example that shows how to play a song on Windows/Mac through PortAudio.

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426