SDL_mixer | audio mixer that supports various file formats | Audio Utils library

 by   libsdl-org C Version: release-2.6.3 License: Zlib

kandi X-RAY | SDL_mixer Summary

kandi X-RAY | SDL_mixer Summary

SDL_mixer is a C library typically used in Audio, Audio Utils applications. SDL_mixer has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

the latest version of this library is available from: due to popular demand, here is a simple multi-channel audio mixer. it supports 8 channels of 16 bit stereo audio, plus a single channel of music. see the header file sdl_mixer.h and the examples playwave.c and playmus.c for documentation on this mixer library. the mixer can currently load microsoft wave files and creative labs voc files as audio samples, it can load flac files with libflac, it can load ogg vorbis files with ogg vorbis or tremor libraries, it can load mp3 files using mpg123 or libmad, and it can load midi files with timidity, fluidsynth, and natively on windows, mac osx, and linux, and finally it can load the following file formats via modplug or mikmod: .mod .s3m .it .xm. tremor decoding is disabled by default; you can enable it by passing --enable-music-ogg-tremor to configure, or by defining music_ogg and ogg_use_tremor. libmad decoding is disabled by default; you can enable it by passing --enable-music-mp3-mad to configure, or by defining music_mp3_mad vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv warning: the license for libmad is gpl,

            kandi-support Support

              SDL_mixer has a low active ecosystem.
              It has 256 star(s) with 105 fork(s). There are 19 watchers for this library.
              It had no major release in the last 12 months.
              There are 51 open issues and 350 have been closed. On average issues are closed in 18 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of SDL_mixer is release-2.6.3

            kandi-Quality Quality

              SDL_mixer has 0 bugs and 0 code smells.

            kandi-Security Security

              SDL_mixer has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              SDL_mixer code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              SDL_mixer is licensed under the Zlib License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              SDL_mixer releases are available to install and integrate.
              It has 40043 lines of code, 0 functions and 275 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SDL_mixer
            Get all kandi verified functions for this library.

            SDL_mixer Key Features

            No Key Features are available at this moment for SDL_mixer.

            SDL_mixer Examples and Code Snippets

            No Code Snippets are available at this moment for SDL_mixer.

            Community Discussions


            SDL2 Linking errors? Undefined reference to SDL_main
            Asked 2022-Jan-02 at 22:08

            I am trying to figure out how to use SDL2 on VSCODE. I've got basic code and windows working but when I add additional functions and files, it doesn't seem to want to compile. I'm new to this but I thought I included the necessary things in my headers and in my build.

            For the main



            Answered 2022-Jan-02 at 22:08

            You can use g++ to build your program in two ways:

            • In two stages, first by compiling the individual .cpp files as translation units to object files .o and then in another invocation of g++ to link them together into an executable

            • Or you can use a single invocation of g++ to compile and link the executable.

            You are currently trying to mix the two modes somehow. For the single-invocation build you should call g++ only once and add all .cpp files to it:



            Expand FindModule.cmake logic with a wrapper file
            Asked 2021-Dec-04 at 20:28

            There are a lot of libraries' packages which do not provide a CMake config file, and in order to find and use them with cmake, one would have to resort to using a FindPackage.cmake script. Some scripts (i.e. SDL) are available within the cmake itself, so finding a package is relatively easy.
            Though in my case, SDL-searching scripts (SDL, SDL_image, SDL_mixer) are available almost since the dawn of modern cmake (at least 3.1), they do not provide the means for the modern approach - they do not define imported cmake Targets. SDL as a target is available only since 3.19, and it does not define IMPORTED_LOCATION property.
            So, the logical thing is to define those targets and properties.
            A naive approach would possibly be to just copy the contents of FindSDL.cmake from a newer cmake bundle and paste it with modifications.
            But I would like to keep those files from a cmake bundle (or another good enough script from external source) intact and just wrap them.
            So, the main CMakeLists.txt would be like:



            Answered 2021-Nov-14 at 20:04

            The first thing that comes to mind is to delete the current path from CMAKE_MODULE_PATH before calling find_package(), and then restore it.



            Unable to import Pygame.mixer on an M1 Mac
            Asked 2021-Aug-21 at 22:18

            When running the code import pygame.mixer (or anything else that refers to pygame.mixer) on a 2021 M1 MacBook Air after running the command python3, I receive the error ModuleNotFoundError: No module named 'pygame.mixer'.

            What I've tried: reinstalling sdl_mixer, reinstalling sdl2_mixer after editing as per, reinstalling Pygame after doing that, running the installation of Python at /usr/bin/python3 and trying the command there, and removing and reinstalling sdl2_mixer normally.



            Answered 2021-Aug-21 at 22:16

            I believe the solution is to build pygame from source directly, using the latest pygame version from Github.

            See this recent pull request:

            These steps should work (drawn from

            • install homebrew if it isn't already installed
            • brew install sdl2 sdl2_gfx sdl2_image sdl2_mixer sdl2_net sdl2_ttf
            • brew install Caskroom/cask/xquartz
            • python3 -m pip install git+



            C++/SDL2 Mixer - One ternary works correctly, but a nearly-identical one doesn't?
            Asked 2021-Apr-23 at 19:59

            I'm writing some simple test audio code to make sure SDL_mixer works for my application, but in the code to change the volume when given certain characters from std::cin everything works except for subtracting 10 from the volume. Adding 10 works, subtracting 1 works, but subtracting 10 only subtracts 1 and not 10.

            In the code below, the variable sound is a struct containing 2 maps called mus and eff, indexed by strings and containing Mix_Music* and Mix_Chunk variables respectively. "Moon Patrol" is my music audio and "Pew" is my test effect audio. Also, sorry about the big if/else statement, I'm going to be using GLUT keys for input in the actual program.

            Relevant Code:



            Answered 2021-Apr-23 at 19:59

            The ternary operator works like this:

            variable = (condition) ? expressionTrue : expressionFalse;



            Why I'm getting "invalid use of incomplete type" error when I change raw pointer to unique_pointer?
            Asked 2021-Jan-29 at 09:53

            I'm making some SDL2 wrappers in C++. Like this:



            Answered 2021-Jan-28 at 18:12

            It seems that Mix_Music is an incomplete type and the correct way to free a Mix_Music object is to call the Mix_FreeMusic function. You cannot dispose of it the way you would a C++ object, namely by using delete. delete would attempt to call the destructor (which cannot be done in this context, since the type is incomplete here) and would assume that the object was allocated by new and return the memory to the same pool where new got it from. The way SDL allocates the object is an implementation detail, so you must let SDL deallocate the object itself as well, to ensure it is done properly.

            std::unique_ptr can be used for this purpose, but requires a custom deleter. The default deleter will call delete, which should not be done here. The error you are seeing is because delete p; is ill-formed (where p has type Mix_Music*) because of the incompleteness. You must ensure that the custom deleter calls Mix_FreeMusic. You can see how to use custom deleters here: How do I use a custom deleter with a std::unique_ptr member?



            Why am I getting this error while installing pygame in pycharm
            Asked 2021-Jan-25 at 10:03

            Command "python egg_info" failed with error code 1 in C:\Users\Eli Heist\AppData\Local\Temp\pip-install-fjf50xi9\pygame\

            this is the full process



            Answered 2021-Jan-25 at 09:41

            I am not sure how this problem can be solved but I will try to help.

            Try the following things:

            1. Don't install it for that specific project. Try to just go to cmd and install it for your whole python env.
            2. Make sure python is properly installed in the PATH variable.
            3. Try to use py -m pip install -U pygame --user instead. If that doesn't work, try python3 -m pip install -U pygame --user.

            If you are using python 3.8 and/or none of the above methods work, you have two options: either revert to python 3.7 or wait for pygame to get updated. Pygame is known to function improperly in python 3.8. I had faced the same issue and I solved it by switching to python 3.7 for pygame projects and the latest version for other python projects.



            Undefined refference to class::method
            Asked 2020-Dec-17 at 10:54

            I am trying to create an interface for my program using SDL2. The problem is that when I include my .h file, the compiler can't find the .cpp even tough I linked everything. None of the methods I found on the internet work and when compiling in visual studio, the code works perfectly fine. What is more strange is that when I try to make my classes inherit from others, I get the same error from the parent class. I am also using the latest version of Ubuntu. Furthermore, I installed all the libraries required for SDL2. This is the error:



            Answered 2020-Dec-17 at 10:54

            Because rendereris static, you also need to declare it in the .cpp file.

            Add it to interface.cpp, for example under #include "interface.h":



            Access Violation when using SDL2_mixer effects?
            Asked 2020-Jul-25 at 13:01

            I've been working on my own lib for 3D audio using SDL2_Mixer and DSPFilters by Vinne Falco. Currently i'm at the stage where i need to create custom DSP to filter audio, while SDL_mixer takes care of the registering of the effects, the actual DSP is proving difficult.

            SDL provides:



            Answered 2020-Jul-25 at 13:01

            I'm pretty sure len is in bytes, not in float elements. You could use len/sizeof(float). – keltar

            This was the answer provided by keltar, which fixes the access violation. (It was provided on a seperate streamlined question)



            Writing a wave generator with SDL
            Asked 2020-Jun-10 at 13:50

            I've coded a simple sequencer in C with SDL 1.2 and SDL_mixer(to play .wav file). It works well and I want to add some audio synthesis to this program. I've look up the and I found this sinewave code using SDL2(

            Here's how the sinewave is coded in the program:



            Answered 2020-Jun-09 at 21:03

            You’d replace the sin function call with call to one of the following:



            How to link SDL2 in CMake?
            Asked 2020-May-30 at 11:58

            I'm trying to use sdl on ubuntu. According to this instruction( i installed sdl2, sdl image and sdl mixer. Now I have to link them while building. Example how should I do it below.



            Answered 2020-May-18 at 09:12

            EDIT added the full CMAKE


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install SDL_mixer

            You can download it from GitHub.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone libsdl-org/SDL_mixer

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Audio Utils Libraries


            by goldfire


            by fingerprintjs


            by Tonejs


            by AudioKit


            by sonic-pi-net

            Try Top Libraries by libsdl-org


            by libsdl-orgC


            by libsdl-orgC


            by libsdl-orgC


            by libsdl-orgC


            by libsdl-orgC