Library for reading audio files

I want to process audio online / live, where I constantly read sound bites from an audio file, process them (for example, apply some effect) and send the processed samples to a sound output device such as a sound card. Input files have common formats, such as wav, mp3, possibly even ogg.

Is there a library like libav / ffmpeg for audio files that simplifies reading various audio formats and provides me with a constant stream of source sound samples? Or is it the best solution to use separate libraries for each format? Libraries must be compatible with c / C ++ and cross-plattform (Mac, Win, Linux, ARM).

EDIT Thanks for all the answers. I rated all the libraries and came to the conclusion that it is best to stick with libav / ffmpeg, because most libraries require ffmpeg as a backend.

+7
source share
6 answers

Check out the Juce . This is a large library that has been used to develop VST audio plugins for music software. There are many things that you do not need, but I think you can select and select only audio parts to include in your assembly. AudioFormatReader and its related classes can read a file, and there are also classes for output to a sound card. There are also many other sound processing tools. This is a GPL cross-platform license and they require experimental Android support. I haven't used it for a project yet, but I'm waiting for inspiration!

+3
source

I can recommend RtAudio or PortAudio for cross-platform audio I / O. For audio decoding, you can look at libsndfile or libaudiodecoder .

+3
source

I would look at libSDL , it has an audio subsystem that is built to perform such actions and processes ogg, mp3, flac, wav, etc.

+2
source

LibVLC can do this. libvlc supports a wide variety of audio (and video) formats. This is a cross-platform C / C ++ library. It should also support weapon code generation.

+1
source

You can use irrKlang library. I used it for my games. This is a very simple library to use, for example, to play some file "somefile.mp3" you just need to write

engine->play2D("somefile.mp3", true); 

And this library is also cross-platform. And it works with C ++, C # and all .NET languages.

Additional functions of this library (from your site)

It has all the functions known from low-level audio libraries because there are many useful functions, such as a complex streaming engine, advanced sound reading, single and multi-stream playback modes, three-dimensional audio emulation for low-level equipment, a plug-in system, several model roll-offs and much more . All this can be obtained using an extremely simple API.

+1
source

The GAudio Library, you may be pursuing. It is simple, powerful, cross-platform and extensible.

Hello world of GAudio:

 gaudio_init("addons"); const char* filename = "..\\media\\trek12.wav"; gsource* source = gaudio_source_create_from_file(filename,FALSE); if(source == NULL) { printf("load file:%s error!\n",filename); printf("bad source.\nerror code:%d.\n",gaudio_error_get()); gaudio_deinit(); return -1; } printf("play filename:%s\n",filename); gaudio_source_play(source,FALSE); printf("\nplaying, press any key to quit.\n"); getch(); gaudio_source_stop(source); gaudio_source_destroy(source); gaudio_deinit(); 
0
source

All Articles