{"id":16711463,"url":"https://github.com/realnc/sdl_audiolib","last_synced_at":"2025-03-21T20:33:18.697Z","repository":{"id":17936347,"uuid":"20912177","full_name":"realnc/SDL_audiolib","owner":"realnc","description":"An audio decoding, resampling and mixing library for SDL.","archived":false,"fork":false,"pushed_at":"2023-02-25T09:43:34.000Z","size":2643,"stargazers_count":43,"open_issues_count":6,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T04:51:54.103Z","etag":null,"topics":["audio-library","c-plus-plus","decoding","mixing-library","resampling","sdl","sdl-audiolib","sdl2"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/realnc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-17T06:08:02.000Z","updated_at":"2024-08-27T14:09:24.000Z","dependencies_parsed_at":"2024-10-28T11:33:29.729Z","dependency_job_id":"6b8fb444-548f-482f-a110-29fb9776f2ea","html_url":"https://github.com/realnc/SDL_audiolib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realnc%2FSDL_audiolib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realnc%2FSDL_audiolib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realnc%2FSDL_audiolib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/realnc%2FSDL_audiolib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/realnc","download_url":"https://codeload.github.com/realnc/SDL_audiolib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244866248,"owners_count":20523484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio-library","c-plus-plus","decoding","mixing-library","resampling","sdl","sdl-audiolib","sdl2"],"created_at":"2024-10-12T20:12:05.686Z","updated_at":"2025-03-21T20:33:18.097Z","avatar_url":"https://github.com/realnc.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"SDL_audiolib - An audio decoding, resampling and mixing library.\n\nThis is a small and simple to use C++ library for playing various audio \nformats. It is a thin (-ish) wrapper around existing resampling (like SRC or \nSoX) and decoding libraries (like libmpg123 or libvorbis.)\n\nI wrote it as my personal replacement for SDL_mixer, due to SDL_mixer's lack \nof multiple music streams, limited audio format support and poor resampling \nquality.\n\nThe API and ABI are not finalized (not sure if they'll ever be) and it's \nC++-only at the moment. You will find what looks to be the beginnings of an \nSDL_mixer drop-in replacement implementation, but it's not actually \nimplemented to any useful extent and will probably be removed in the future.\n\nAs the name implies, it uses [SDL](http://www.libsdl.org) to access the audio \nhardware.\n\nMost popular audio formats are supported:\n\n  * Vorbis (libvorbisfile or libsndfile)\n  * Opus (libopusfile or libsndfile)\n  * MP3 (built-in through bundled\n    [dr_mp3](https://github.com/mackron/dr_libs), or through external\n    libmpg123)\n  * Musepack (libmpcdec)\n  * FLAC (built-in through bundled\n    [dr_flac](https://mackron.github.io/dr_flac), or through external\n    libFLAC or libsndfile)\n  * WAV and related formats (built-in through bundled\n    [dr_wav](https://mackron.github.io/dr_wav), or through external\n    libsndfile)\n  * MIDI (FluidSynth, BASSMIDI, WildMIDI or libADLMIDI)\n  * MOD-based music formats (libopenmpt, libxmp or libmodplug)\n\nYou can also write your own decoders and resamplers by subclassing \n`Aulib::Decoder` and `Aulib::Resampler`.\n\nUsing the library is fairly simple:\n\n```c++\n#include \u003cAulib/DecoderVorbis.h\u003e\n#include \u003cAulib/ResamplerSpeex.h\u003e\n#include \u003cAulib/Stream.h\u003e\n#include \u003cSDL.h\u003e\n#include \u003ciostream\u003e\n\nint main()\n{\n    // The library uses std::chrono for durations, seeking and fading.\n    using namespace std::chrono_literals;\n\n    // Initialize the SDL_audiolib library. Set the output sample rate to\n    // 44.1kHz, the audio format to 16-bit signed, use 2 output channels\n    // (stereo), and an 8kB output buffer.\n    if (Aulib::init(44100, AUDIO_S16SYS, 2, 8192) != 0) {\n        std::cerr \u003c\u003c \"Couldn't initialize audio: \" \u003c\u003c SDL_GetError() \u003c\u003c '\\n';\n        return EXIT_FAILURE;\n    }\n\n    // Create an audio stream that will play our Vorbis file using a Vorbis\n    // decoder and a Speex resampler.\n    Aulib::Stream music(\"music.ogg\",\n                        std::make_unique\u003cAulib::DecoderVorbis\u003e(),\n                        std::make_unique\u003cAulib::ResamplerSpeex\u003e());\n\n    // Play it once with a fade-in of 700 milliseconds.\n    music.play(1, 700ms);\n\n    // Wait while the music is still playing.\n    while (music.isPlaying()) {\n        SDL_Delay(200);\n    }\n    \n    // Shut down and clean up. Calling this manually is optional, since the\n    // library will call this automatically when the program exits.\n    Aulib::quit();\n}\n```\n\nFor further details, read the \n[API reference](http://realnc.github.io/SDL_audiolib).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealnc%2Fsdl_audiolib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frealnc%2Fsdl_audiolib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frealnc%2Fsdl_audiolib/lists"}