A C library for reading and writing sound files containing sampled audio data.

Overview

libsndfile

C/C++ CI

libsndfile is a C library for reading and writing files containing sampled audio data.

Authors

The libsndfile project was originally developed and maintained by Erik de Castro Lopo [email protected] aka @erikd. The project was developed on Github at https://github.com/erikd/libsndfile.

After the release of version 1.0.30, @erikd transferred the project to the libsndfile team, see AUTHORS for details.

Hacking

The canonical source code repository for libsndfile is at http://libsndfile.github.io/libsndfile/.

You can grab the source code using:

git clone https://github.com/libsndfile/libsndfile.git

For building for Android see BuildingForAndroid.

There are currently two build systems: the traditional GNU autotool based one and modern CMake based build system. Use of the CMake build system is documented below.

Setting up a build environment for libsndfile on Debian or Ubuntu is as simple as:

sudo apt install autoconf autogen automake build-essential libasound2-dev \
  libflac-dev libogg-dev libtool libvorbis-dev libopus-dev pkg-config python

For other Linux distributions or any of the *BSDs, the setup should be similar although the package install tools and package names may be slightly different.

Similarly on Mac OS X, assuming brew is already installed:

brew install autoconf autogen automake flac libogg libtool libvorbis opus pkg-config

Once the build environment has been set up, building and testing libsndfile is as simple as:

./autogen.sh
./configure --enable-werror
make
make check

The CMake build system

Although Autotools is the primary and recommended build toolchain, CMake meta build generator is also available. The build process with CMake takes place in two stages. First, standard build files are created from configuration scripts. Then the platform's native build tools are used for the actual building. CMake can produce Microsoft Visual Studio project and solution files, Unix Makefiles, Xcode projects and many more.

Some IDE support CMake natively or with plugins, check you IDE documentation for details.

Requirements

  1. C99-compliant compiler toolchain (tested with GCC, Clang and Visual Studio 2015)
  2. CMake 3.1.3 or newer

There are some recommended packages to enable all features of libsndfile:

  1. Ogg, Vorbis and FLAC libraries and headers to enable these formats support
  2. ALSA development package under Linux to build sndfile-play utility
  3. Sndio development package under BSD to build sndfile-play utility

Building from command line

CMake can handle out-of-place builds, enabling several builds from the same source tree, and cross-compilation. The ability to build a directory tree outside the source tree is a key feature, ensuring that if a build directory is removed, the source files remain unaffected.

mkdir CMakeBuild
cd CMakeBuild

Then run cmake command with directory where CMakeLists.txt script is located as argument (relative paths are supported):

cmake ..

This command will configure and write build script or solution to CMakeBuild directory. CMake is smart enough to create Unix makefiles under Linux or Visual Studio solution if you have Visual Studio installed, but you can configure generator with -G command line parameter:

cmake .. -G"Unix Makefiles"

The build procedure depends on the selected generator. With "Unix Makefiles" you can type:

make & make install

With "Visual Studio" and some other generators you can open solution or project from CMakeBuild directory and build using IDE.

Finally, you can use unified command:

cmake --build .

CMake also provides Qt-based cross platform GUI, cmake-gui. Using it is trivial and does not require detailed explanations.

Configuring CMake

You can pass additional options with /D<parameter>=<value> when you run cmake command. Some useful system options:

  • CMAKE_C_FLAGS - additional C compiler flags
  • CMAKE_BUILD_TYPE - configuration type, DEBUG, RELEASE, RELWITHDEBINFO or MINSIZEREL. DEBUG is default
  • CMAKE_INSTALL_PREFIX - build install location, the same as --prefix option of configure script

Useful libsndfile options:

  • BUILD_SHARED_LIBS - build shared library (DLL under Windows) when ON, build static library othervise. This option is OFF by default.

  • BUILD_PROGRAMS - build libsndfile's utilities from programs/ directory, ON by default.

  • BUILD_EXAMPLES - build examples, ON by default.

  • BUILD_TESTING - build tests. Then you can run tests with ctest command, ON by default. Setting BUILD_SHARED_LIBS to ON disables this option.

  • ENABLE_EXTERNAL_LIBS - enable Ogg, Vorbis, FLAC and Opus support. This option is available and set to ON if all dependency libraries were found.

  • ENABLE_CPU_CLIP - enable tricky cpu specific clipper. Enabled and set to ON when CPU clips negative\positive. Don't touch it if you are not sure

  • ENABLE_BOW_DOCS - enable black-on-white documentation theme, OFF by default.

  • ENABLE_EXPERIMENTAL - enable experimental code. Don't use it if you are not sure. This option is OFF by default.

  • ENABLE_CPACK - enable CPack support. This option is ON by default.

  • ENABLE_PACKAGE_CONFIG - generate and install package config file.

  • INSTALL_PKGCONFIG_MODULE - generate and install pkg-config module.

  • INSTALL_MANPAGES - install man pages for programs. This option is ON by default

  • ENABLE_STATIC_RUNTIME - enable static runtime on Windows platform (MSVC and MinGW), OFF by default.

    Note: For MSVC compiler this option is deprecated for CMake >= 3.15, see policy CMP0091. Use CMAKE_MSVC_RUNTIME_LIBRARY option instead.

    Note: For MinGW toolchain this option is experimental. If you enabled it and then disabled again, you need to clear CMake cache (delete CMakeCache.txt).

  • ENABLE_COMPATIBLE_LIBSNDFILE_NAME - set DLL name to libsndfile-1.dll (canonical name) on Windows platform, sndfile.dll otherwise, OFF by default. Library name can be different depending on platform. The well known DLL name on Windows platform is libsndfile-1.dll, because the only way to build Windows library before was MinGW toolchain with Autotools. This name is native for MinGW ecosystem, Autotools constructs it using MinGW platform rules from sndfile target. But when you build with CMake using native Windows compiler, the name is sndfile.dll. This is name for native Windows platform, because Windows has no library naming rules. It is preffered because you can search library using package manager or CMake's find_library command on any platform using the same sndfile name.

  • ENABLE_SSE2 - add compiler flag to enable SSE2 if required, ON by default.

    This option is for X86 and GCC compatible compilers configurations only.

    If you compile for other SIMD set, e.g. AVX2, you may want to set ENABLE_SSE2 to OFF.

    Note: This option is not active for X64 configuration, because SSE2 is always available in this mode and all optimizations are enabled by default.

Deprecated options:

  • DISABLE_EXTERNAL_LIBS - disable Ogg, Vorbis and FLAC support. Replaced by ENABLE_EXTERNAL_LIBS
  • DISABLE_CPU_CLIP - disable tricky cpu specific clipper. Replaced by ENABLE_CPU_CLIP
  • BUILD_STATIC_LIBS - build static library. Use BUILD_SHARED_LIBS instead

Linking from CMake projects

First you need to add FindOgg.cmake, FindVorbis.cmake, FindFLAC.cmake and FindOpus.cmake files to some directory inside your CMake project (usually cmake) and add it to CMAKE_MODULE_PATH:

project(SomeApplication)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Now you can search libsndfile library from your CMakeLists.txt with this command:

find_package(SndFile)

SndFile_FOUND is set to ON when library is found.

If libsndfile dependency is critical, you can add REQUIRED to find_package:

find_package(SndFile REQUIRED)

With with option find_package will terminate configuration process if libsndfile is not found.

You can also add version check:

find_package(SndFile 1.0.29)

find_package will report error, if libsndfile version is < 1.0.29.

You can combine REQUIRED and version if you need.

To link libsndfile library use:

target_link_libraries(my_application PRIVATE SndFile::sndfile)

Notes for Windows users

System CRT library

First advice about Visual Studio system CRT libraries, it is system code linked as static or dynamic library to every C application.

You can find related option in Visual Studio project properties:

C/C++ -> Code Generation -> Runtime Library

Dynamic version of system CRT library is defaut and it means that end user needs to have the same runtime library installed on his system. Most likely it is so, but if it is not, the user will see this error message using libsndfile DLL:

"The program can't start because <crt-dll-name>.dll is missing from your computer. Try reinstalling the program to fix this problem. "

To avoid this, you may want to enable static CRT library linking. In this case the size of your DLL will increase slightly the size will increase slightly, but you can redistribute the libsndfile DLL without having to install the correct version of the system CRT library.

CMake project will use dynamic system CRT libraries by default, just like Visual Studio does. But you can change it using ENABLE_STATIC_RUNTIME or CMAKE_MSVC_RUNTIME_LIBRARY options.

Note: You cannot use both options at the same time, it will lead to a configuration error.

If you have CMake >= 3.15 you should use CMAKE_MSVC_RUNTIME_LIBRARY option.

This will enable static linking:

cmake .. -D"MultiThreaded$<$<CONFIG:Debug>:Debug>"

You can use libsndfile ENABLE_STATIC_RUNTIME option to to control CRT library linking for CMake project: OFF or unset (default) for dynamic, and ON for static linking:

cmake .. -DENABLE_STATIC_RUNTIME=ON

Note: This option is deprecated and may be removed in far future because we have standard option CMAKE_MSVC_RUNTIME_LIBRARY now.

Using Vcpkg package manager

Second advice is about Ogg, Vorbis FLAC and Opus support. Searching external libraries under Windows is a little bit tricky. The best way is to use Vcpkg. You need to install static libogg, libvorbis, libflac and libopus libraries:

vcpkg install libogg:x64-windows-static libvorbis:x64-windows-static
libflac:x64-windows-static opus:x64-windows-static libogg:x86-windows-static
libvorbis:x86-windows-static libflac:x86-windows-static opus:x86-windows-static

Then and add this parameter to cmake command line:

-DCMAKE_TOOLCHAIN_FILE=<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake

You also need to set VCPKG_TARGET_TRIPLET because you use static libraries:

-DVCPKG_TARGET_TRIPLET=x64-windows-static

Note: Use must use the same CRT library for external libraries and the libsndfile library itself. For *-static triplets Vcpkg uses static CRT.

Submitting Patches

See CONTRIBUTING.md for details.

Comments
  • MPEG Encode/Decode Support

    MPEG Encode/Decode Support

    MPEG Encode/Decode Support

    Uses libmpg123 for decode, liblame for encode. Encoding and decoding support is independent of each other and is split into separate files. MPEG support is generalized as subformats, SF_FORMAT_MPEG_LAYER(I,II,III) so that it might be used by other containers (MPEG1WAVEFORMAT for example), but also contains a major format SF_FORMAT_MP3 for 'mp3 files.'

    Introduces the command SFC_GET_BITRATE_MODE/SFC_SET_BITRATE_MODE.

    Encoding Status

    • Layer III encoding
    • ID3v1 writing
    • ID3v2 writing
    • Lame/Xing Tag writing
    • Bitrate selection command
    • VBR or CBR

    Decoding Status

    • Layers I/II/III decoding
    • ID3v1 reading
    • ID3v2 reading
    • Seeking

    Decoding Todo

    • ~~mpg123 global init race~~
    • ~~specific error codes~~
    • ~~better decoder corruption handling~~

    Future Possible Todos

    • Add WAV support (WAVE_FORMAT_MPEG1 and WAVE_FORMAT_MPEGLAYER3)
    • Add Layer II encoding by twolame
    enhancement 
    opened by arthurt 126
  • Add MP3 support

    Add MP3 support

    The MP3 patents have now fully expired so libsndfile can now add support.

    The best bet would be https://www.mpg123.de which is LGPL and has updates as recently as this year.

    I (@erikd) don't have sufficient time and motivation to do this, but would be happy to guide someone else.

    Wishlist help wanted 
    opened by erikd 69
  • 1.0.29 release plan?

    1.0.29 release plan?

    I stumbled upon bug #309 which already had a fix committed from PR #316 in September 2017. There has not been a release in over two years now. The 1.0.29 milestone still has two open issues but neither of those have had any activity since 2018. When will 1.0.29 be released?

    question 
    opened by Be-ing 64
  • Adding Opus audio in libsndfile ?

    Adding Opus audio in libsndfile ?

    Hello.

    Could it be possible to integrate Opus audio in libsndfile ? https://github.com/xiph/opus

    Huh, in https://github.com/xiph/opus/blob/master/COPYING, it seems that Erik de Castro Lopo has a idea what Opus files are. ;)

    Thanks.

    Fre;D

    Wishlist help wanted enhancement 
    opened by fredvs 50
  • Version 1.0.28 dll crash on sf_close

    Version 1.0.28 dll crash on sf_close

    Previously working program crashes inside libsndfile-1.dll on sf_close, when changing from 1.0.27 to 1.0.28.

    Call Stack:

    libsndfile-1.dll!6f917a25()	Unknown
    libsndfile-1.dll!6f917530()	Unknown
    libsndfile-1.dll!6f913337()	Unknown
    libsndfile-1.dll!6f870d9b()	Unknown
    kernel32.dll!74cf14ad()	Unknown
    libsndfile-1.dll!6f861510()	Unknown
    

    msvcr110.dll!remove(const char * path) Line 57 C DgApi.dll!741296af() Unknown DgApi.dll!7412b1b2() Unknown DgApi.dll!741be196() Unknown DgApi.dll!741a4cc6() Unknown KernelBase.dll!753da353() Unknown KernelBase.dll!753dab95() Unknown msvcr110.dll!_getptd_noexit() Line 312 C msvcr110.dll!malloc(unsigned int size=3038976) Line 91 C msvcr110.dll!operator new(unsigned int size=25) Line 59 C++ 034d7c20() Unknown SpecWeb.exe!wrapped_main(int argc, char * * argv) Line 10070 C++

    Here is an example file that my program was closing:

    C:\Users\gnewell>"C:\Program Files (x86)\Mega-Nerd\libsndfile\bin\sndfile-info" "C:\Users\gnewell\Desktop\16864-mch-out.rf64"

    File : C:\Users\gnewell\Desktop\16864-mch-out.rf64 Length : 273928136 RF64 WAVE ds64 : 28 Riff size : 273928128 Data size : 273928032 Frames : 11413668 Table length : 0 fmt : 40 Format : 0xFFFE => WAVE_FORMAT_EXTENSIBLE Channels : 6 Sample Rate : 44100 Block Align : 24 Bit Width : 32 Bytes/sec : 1058400 Valid Bits : 32 Channel Mask : 0x3F (L, R, C, LFE, Ls, Rs) Subformat esf_field1 : 0x3 esf_field2 : 0x0 esf_field3 : 0x10 esf_field4 : 0x80 0x0 0x0 0xAA 0x0 0x38 0x9B 0x71 format : IEEE float data : 0xFFFFFFFF End


    Sample Rate : 44100 Frames : 11413668 Channels : 6 Format : 0x00220006 Sections : 1 Seekable : TRUE Duration : 00:04:18.813 Signal Max : 0.543173 (-5.30 dB)

    windows 7 32bit libsndfile on 64 bit OS i7-4600U 16GB RAM

    downloaded version of libsndfile (vs. compiled)

    opened by dts350z 32
  • Opus Support

    Opus Support

    For consideration and review, Opus codec support. ~~This is currently experimental, has no tests, and only builds when experimental support is enabled.~~

    Supports encoding and decoding, metadata (tags), bisection seek support.

    Additional functionality was added to the Ogg container code, making it available for other codecs, although using such functionality in these codecs is not a part of this pull request. Introduces ogg_vcomment for parsing and writing Vorbis Comment style tags. This is the tag format used by most Ogg encapsulated streams; OggVorbis, Speex, Opus, OggPCM and OggFLAC. Currently only consumed by Opus.

    Introduces SF_CODEC_OPUS subtype, ~~but hides support for it unless experimental code is enabled.~~

    enhancement 
    opened by arthurt 25
  • Build for Android

    Build for Android

    Hello all,

    one question for compilation for Android, anyone has succeed? I try to follow the instruction: < export ANDROID_TOOLCHAIN_HOME=/path/to/android/toolchain ./Scripts/android-configure.sh make

    BUT I got error:

    /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am CC libsndfile_la-sndfile.lo In file included from sndfile.c:26:0: sndfile.h:340:10: warning: type defaults to 'int' in declaration of 'sf_count_t' typedef sf_count_t ; ^ sndfile.c: In function 'psf_open_file': sndfile.c:2968:34: error: expected expression before ';' token psf->filelength = SF_COUNT_MAX ; ^ sndfile.c:3001:37: error: expected expression before ')' token if (psf->filelength == SF_COUNT_MAX) ^ make[2]: *** [libsndfile_la-sndfile.lo] Error 1 make[1]: *** [all] Error 2 make: *** [all-recursive] Error 1

    Thank you for your response!!

    Best Allen

    opened by RuolunWeng 24
  • configure.ac: trigger error & stop if not all Xiph libs available

    configure.ac: trigger error & stop if not all Xiph libs available

    The context here is that I sent a patch to Yocto, to update the library from 1.0.28 to 1.0.31 and move to the new URLs for libsndfile.

    However, in the meantime, libsndfile also supports libopus and does not allow support for libvorbis, libflac and libogg to be included if either of these libs (and libopus) does not exist.

    That's fine, but it allows for weird/silent failures that can slip through when you're a package maintainer.

    Which is what happened here: https://lists.openembedded.org/g/openembedded-core/message/162558?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3Acreated%2C0%2Clibsndfile1%2C20%2C2%2C0%2C89367260

    So, the idea is to propose that this build configuration should trigger a fail that can be seen at build time and not be caught off-guard.

    Signed-off-by: Alexandru Ardelean [email protected]

    opened by commodo 23
  • heap-buffer-overflow in in msadpcm_decode_block

    heap-buffer-overflow in in msadpcm_decode_block

    Hi, fuzzing sndfile-info with AFL++ I found a heap-buffer-overflow in in msadpcm_decode_block /home/andreaf/real/libsndfile/src/ms_adpcm.c:279

    I'm on an x86-64 Ubuntu 20.04 with Clang 10.

    The AddressSanitizer report is the following:

    =================================================================
    ==24888==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000001238 at pc 0x0000005ebedc bp 0x7ffced651bd0 sp 0x7ffced651bc8
    WRITE of size 2 at 0x621000001238 thread T0
        #0 0x5ebedb in msadpcm_decode_block /home/andreaf/libsndfile/src/ms_adpcm.c:279:31
        #1 0x5e9cf8 in wavlike_msadpcm_init /home/andreaf/libsndfile/src/ms_adpcm.c:171:3
        #2 0x566da9 in wav_open /home/andreaf/libsndfile/src/wav.c:258:14
        #3 0x4cc6d2 in psf_open_file /home/andreaf/libsndfile/src/sndfile.c:3080:13
        #4 0x4caa5e in sf_open /home/andreaf/libsndfile/src/sndfile.c:359:9
        #5 0x4c57dd in cart_dump /home/andreaf/libsndfile/programs/sndfile-info.c:479:14
        #6 0x4c36c3 in main /home/andreaf/libsndfile/programs/sndfile-info.c:96:13
        #7 0x7f114ca61bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
        #8 0x41b4c9 in _start (/home/andreaf/libsndfile/programs/sndfile-info+0x41b4c9)
    
    0x621000001238 is located 0 bytes to the right of 4408-byte region [0x621000000100,0x621000001238)
    allocated by thread T0 here:
        #0 0x493d82 in calloc (/home/andreaf/libsndfile/programs/sndfile-info+0x493d82)
        #1 0x5e90b4 in wavlike_msadpcm_init /home/andreaf/libsndfile/src/ms_adpcm.c:138:27
        #2 0x566da9 in wav_open /home/andreaf/libsndfile/src/wav.c:258:14
        #3 0x4cc6d2 in psf_open_file /home/andreaf/libsndfile/src/sndfile.c:3080:13
        #4 0x4caa5e in sf_open /home/andreaf/libsndfile/src/sndfile.c:359:9
        #5 0x4c57dd in cart_dump /home/andreaf/libsndfile/programs/sndfile-info.c:479:14
        #6 0x4c36c3 in main /home/andreaf/libsndfile/programs/sndfile-info.c:96:13
        #7 0x7f114ca61bf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
    
    SUMMARY: AddressSanitizer: heap-buffer-overflow /home/andreaf/libsndfile/src/ms_adpcm.c:279:31 in msadpcm_decode_block
    Shadow bytes around the buggy address:
      0x0c427fff81f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x0c427fff8200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x0c427fff8210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x0c427fff8220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      0x0c427fff8230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    =>0x0c427fff8240: 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa
      0x0c427fff8250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c427fff8260: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c427fff8270: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c427fff8280: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
      0x0c427fff8290: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07 
      Heap left redzone:       fa
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
      Shadow gap:              cc
    ==24888==ABORTING
    

    To reproduce on git master:

    export CC='clang-10 -fsanitize=address'
    export CFLAGS='-g'
    ./configure --disable-shared
    make
    ./programs/sndfile-info --cart ./sndfile_heap_overflow
    

    The testcase that triggers the bug is (decompress it before):

    sndfile_heap_overflow.tar.gz

    Bug 
    opened by andreafioraldi 22
  • ABI broken by 5c6129fce69d0976b22d15cc695fc1d8521ceae7

    ABI broken by 5c6129fce69d0976b22d15cc695fc1d8521ceae7

    This commit stops generating libsndfile.so.1.0 with a symbol version script.

    This, unfortunately, constitutes an ABI break: the dynamic linker will cause every shared library and binary linked against a libsndfile predating the change to fail to load with e.g.

    /lib/libsndfile.so.1: no version information available (required by /usr/lib/pulseaudio/libpulsecommon-5.0.so)

    Please revert or reintroduce a version script some other way (or bump the soname, but doing that without good cause, and this does not seem to me to be good cause, will cause a small army of annoyed packagers to roam the land with murder in their eyes.)

    Bug 
    opened by nickalcock 22
  • unable to package libsndfile > 1.0.28 due to missing chain of trust

    unable to package libsndfile > 1.0.28 due to missing chain of trust

    As discussed in #470 the 1.0.29 release has been done. \o/

    Unfortunately the source tarball is now signed by @evpobr (9B1CFD2E92239C4B288E025F9D0D1F1CCB35FF8C - btw. the PGP public key can not be found on key servers), while all previous releases have been provided and signed by @erikd (6A91A5CF22C24C99A35E013FCFDCF91FB242ACED).

    This breaks the chain of trust as neither an additional allowed release manager for libsndfile has been defined (e.g. in the README, using a signed commit), nor has @erikd commented on the release and the aforementioned ticket.

    A way out of this situation can be:

    1. release the tarball for 1.0.29 in the usual location
    2. allow further contributors to the project to handle releases by adding their names and their PGP key to a document stating this fact using a signed (by @erikd) commit 2.1) make sure to upload the PGP public key 9B1CFD2E92239C4B288E025F9D0D1F1CCB35FF8C to the key servers 2.2) define this github repository as the default upstream (or at least as one possible upstream) 2.3) optional: transfer this repository to an organization so contributor/maintainer handling will be easier for current maintainers

    While option 1 is the faster (for this specific issue), I suggest implementing option 2, as this ensures easier handling and faster turn-around-time (in the mid and long term).

    It would be really great if this could be resolved, as I am unable to upgrade the package for Arch Linux due to us following TOFU in regards to upstream verification.

    opened by dvzrv 21
  • Please make a new release which includes #822

    Please make a new release which includes #822

    In #822 a fix was added, which allows CMake to properly detect Lame. Unfortunately that was merged after the last release. As a consequence, every Linux distro package of the latest release of libsndfile probably still misses MP3 support, even if Lame is installed at build time.

    It would be very helpful to have a new patch release, so that other packages depending on libsndfile can finally rely on mp3 support being present.

    opened by SpotlightKid 1
  • limit on comment length when reading WAV files?

    limit on comment length when reading WAV files?

    We noticed that we cannot read back a comment from a WAV file if it is >= 2046 chars long. It seems to be written ok (I can see it with https://mediaarea.net/MediaInfoOnline), but when I try to read it back with sf_get_string, I get back NULL.

    Here is some simple reproduction code:

    #include <iostream>
    #include "sndfile.h"
    
    int main()
    {
        // prepare data to write
        const int audioLength = 70000;
        double originalData[audioLength] = {0};
        
        const int commentLength = 2046; //2045 works fine
        char originalComment[commentLength];
        for (int i = 0; i<commentLength; i++) {
            originalComment[i] = 'a';
        }
        std::cout << "comment to be written: " << originalComment << std::endl;
        std::cout << "(comment length is " << commentLength << ")" << std::endl;
        
        
        // open WAV file for writing
        SF_INFO sndFileInfo;
        sndFileInfo.samplerate = 44100;
        sndFileInfo.channels = 1;
        sndFileInfo.format = SF_FORMAT_WAV | SF_FORMAT_DOUBLE;
        
        SNDFILE* sndFile = sf_open("mytest.wav", SFM_WRITE, &sndFileInfo);
        sf_command(sndFile, SFC_SET_SCALE_INT_FLOAT_WRITE, NULL, SF_TRUE);
        
        // write long comment
        int sferror = sf_set_string(sndFile, SF_STR_COMMENT, originalComment);
        if (sferror != SF_ERR_NO_ERROR)
        {
            std::cout << "Error writing a comment: " << std::endl;
            const char* errorStr = sf_strerror(sndFile);
            std::cout << "errorStr: " << errorStr << std::endl;
            return -1;
        }
        
        // write audio data
        sf_count_t framesWritten = sf_writef_double(sndFile, originalData, audioLength);
        std::cout << "Written " << framesWritten << " frames." << std::endl;
        
        // close file
        sferror = sf_close(sndFile);
        if (sferror != SF_ERR_NO_ERROR) {
            std::cout << "Error closing file for writing: "  << std::endl;
            const char* errorStr = sf_strerror(sndFile);
            std::cout << "errorStr: " << errorStr << std::endl;
            return -1;
        }
        
        // open file for reading
        SF_INFO sndFileInfoRead;
        SNDFILE* sndFileRead = sf_open("mytest.wav", SFM_READ, &sndFileInfoRead);
        
        // try reading comment back
        const char* readComment = sf_get_string(sndFileRead, SF_STR_COMMENT);
        sferror = sf_error(sndFileRead);
        if (sferror != SF_ERR_NO_ERROR) {
            std::cout << "Error reading the comment: "  << std::endl;
            const char* errorStr = sf_strerror(sndFileRead);
            std::cout << "errorStr: " << errorStr << std::endl;
            return -1;
        }
        
        if (readComment == NULL) {
            std::cout << "read comment is null" <<  std::endl;
        } else {
            std::cout << "read comment: " << readComment <<  std::endl;
        }
        
        // close file
        sferror = sf_close(sndFileRead);
        if (sferror != SF_ERR_NO_ERROR) {
            std::cout << "Error closing file for reading: "  << std::endl;
            const char* errorStr = sf_strerror(sndFileRead);
            std::cout << "errorStr: " << errorStr << std::endl;
            return -1;
        }
    
        return 0;
    }
    

    And here is the output:

    $ ./a.out 
    comment to be written: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    (comment length is 2046)
    Written 70000 frames.
    read comment is null
    

    If I try a smaller length, the comment can be read back correctly.

    This was run on my macOS 12.1 machine, but we are seeing this issue on Windows and unix platforms too. We are using the latest official libsndfile 1.1.0 release.

    opened by krisfed 2
  • Failed to read some OPUS audio

    Failed to read some OPUS audio

    we have a lot of OPUS audio, most of them can be read well, some got failed, but the failed OPUS can be played by Windows media player and mplayer. The failed example is here: https://drive.google.com/file/d/1_3oFZl7Ruv64rAMRCWCpTR1QkAEtZJSo/view?usp=sharing

    Using sndfile-info to check the audio, it can't get the Frames and Duration:

    ========================================
    File : zz.opus
    Length : 118784
    Ogg stream data : Opus
    Stream serialno : 409619929
    Opus library version: libopus 1.3.1
    Opus Header Metadata
      OggOpus version  : 1
      Channels         : 1
      Preskip          : 312 samples @48kHz
      Input Samplerate : 16000 Hz
      Gain             : 0.0
      Channel Mapping  : 0 (mono or stereo)
    VorbisComment Metadata
      Vendor: libopus 1.1
      ENCODER=opusenc from opus-tools 1.1
      Granule pos offset  : 0
    
    ----------------------------------------
    Sample Rate : 16000
    Frames      : unknown
    Channels    : 1
    Format      : 0x00200064
    Sections    : 1
    Seekable    : TRUE
    Duration    : unknown
    
    Bug 
    opened by veelion 5
  • odd number of frames with an odd number of bytes-per-frame behaves odd

    odd number of frames with an odd number of bytes-per-frame behaves odd

    so I have a 24bit PCM WAV that consists of 101 frames, which gives me a data-chunk worth of 303 bytes.

    such a file can be created as follows:

    #include <sndfile.h>
    
    #define NUMSAMPLES 101
    static float samples_float[NUMSAMPLES];
    
    int main() {
      SNDFILE*sf;
      SF_INFO sfinfo;
      sfinfo.frames = NUMSAMPLES;
      sfinfo.samplerate = 44100;
      sfinfo.channels = 1;
      sfinfo.format = SF_FORMAT_WAV | SF_FORMAT_PCM_24;
    
      sf = sf_open("303.wav", SFM_WRITE, &sfinfo);
      sf_write_float(sf, samples_float, NUMSAMPLES);
      sf_close(sf);
    }
    

    but if I read it back, like so:

      sf = sf_open("303.wav", SFM_READ, &sfinfo);
      sf_command(sf, SFC_GET_LOG_INFO, strbuffer, BUFFER_LEN);
      puts(strbuffer);
      sf_close(sf);
    

    i get a nasty error:

    *** 'data' chunk should be an even number of bytes in length.

    so he is to blame for this?

    • should SFM_WRITE add a zero-padding byte, so the number of bytes in the data chunk is even?
    • should SFM_READ check whether the number of bytes equals bytesperframe*frames, (and not complain if its odd)?
    • is the WAV standard broken?

    reading https://mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html, i see:

    data Chunk

    The data chunk contains the sampled data.

    | Field | Length | Contents| | --- | --- | --- | | ckID | 4 | Chunk ID: "data" | cksize | 4 | Chunk size: n | sampled data | n | Samples | pad byte | 0 or 1 |  Padding byte if n is odd

    which indicates that the reported 'data' chunksize (as written into the chunk header) can indeed be odd (but the actual chunksize must be even, supposedly for alignment with the chunk that follows the 'data'-chunk which must always be last :thinking: )

    (sorry for the pun in the title, but it was irresistible).

    Bug 
    opened by umlaeute 2
  • Allow providing sample rate to be forced to decoder while audio decoding (OPUS decoding is an important usecase for this)

    Allow providing sample rate to be forced to decoder while audio decoding (OPUS decoding is an important usecase for this)

    This is useful for codecs that can do resampling to a user-provided custom sample rate. This is useful for e.g. consuming OPUS audio files for purpose of training multi-sample-rate speech recognition model, more context here: https://github.com/pytorch/audio/issues/2586

    If I understand correctly, currently during decoding of OPUS, libsndfile uses sample rate stored in the OPUS header: https://github.com/libsndfile/libsndfile/blob/master/src/ogg_opus.c#L558. This is reasonable, but if one could also provide a custom sample rate to be used in recoding, fewer resampling steps can be performed (and probably less artifacts to be introduced).

    As far as I understood, currently SF_INFO decoding option structure does not allow for this: http://libsndfile.github.io/libsndfile/api.html#open

    Also, very free to have it closed as a wontfix, but a clear explanation about this usecase in documentation would be welcome (e.g. for OPUS, this would maybe mean a workaround by e.g. virtual file reading functions that can fake a opus header with a needed sample rate)

    opened by vadimkantorov 3
  • Vorbis Seeking Not Always Sample Exact

    Vorbis Seeking Not Always Sample Exact

    As discovered when fixing Opus Seeking in #794, under certain conditions, Vorbis seeking can end up offset.

    From seek stress-testing, the amount of error appears to be the Vorbis block size. This occurs on near-seeks.

    Consider the following test: Seek to 3362368 - Page boundary Seek to +1025 - one sample more than a lapped block - error Seek to +2048 - two blocks more (still offset by one) - error

    ./seek-stress-test roygbiv.ogg 3362368 +1025 +2048 -1024
    
    ================================ (0: 3362368 = 3362368) ================================
    
    ================================ (1: +1025 = 3371585) ================================
    Line 3371585: Actual SNR (-12.1) > target SNR (-500.0).
    
    ================================ (2: +2048 = 3381825) ================================
    Line 3381825: Actual SNR (-18.7) > target SNR (-500.0).
    
    opened by arthurt 1
Releases(1.1.0)
  • 1.1.0(Mar 27, 2022)

    1.1.0 - 2022-03-27

    Added

    • MPEG Encode/Decode Support.

      Uses libmpg123 for decode, liblame for encode. Encoding and decoding support is independent of each other and is split into separate files. MPEG support is generalized as subformats, SF_FORMAT_MPEG_LAYER(I,II,III) so that it might be used by other containers (MPEG1WAVEFORMAT for example), but also contains a major format SF_FORMAT_MPEG for 'mp3 files.'

      Encoding Status:

      • Layer III encoding
      • ID3v1 writing
      • ID3v2 writing
      • Lame/Xing Tag writing
      • Bitrate selection command
      • VBR or CBR

      Decoding Status:

      • Layers I/II/III decoding
      • ID3v1 reading
      • ID3v2 reading
      • Seeking
    • New fuzzer for OSS-Fuzz, thanks @DavidKorczynski.

    • This CHANGELOG.md. All notable changes to this project will be documented in this file. The old NEWS file has been renamed to NEWS.OLD and is no longer updated.

    • Add support for decoding MPEG III Audio in WAV files.

    • SECURITY.md file to give people instructions for reporting security vulnerabilities, thanks @zidingz.

    • Support for Vcpkg manifest mode.

      If you have problems with manifest mode, disable it with VCPKG_MANIFEST_MODE switch.

    • Export CMake targets from the build tree (PR #802)

    • CIFuzz fuzzer, thanks to @AdamKorcz (PR #796)

    Changed

    • SFC_SET_DITHER_ON_READ and SFC_SET_DITHER_ON_WRITE enums comments in public header, thanks @SmiVan (issue #677).

    • ENABLE_SNDFILE_WINDOWS_PROTOTYPES define is deprecated and not needed anymore.

      Previously, in order for the sf_wchar_open() function to become available on the Windows platform, it was required to perform certain actions:

      #include <windows.h>
      #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
      #including <sndfile.h>
      

      These steps are no longer required and the sf_wchar_open() function is always available on the Windows platform.

    • Use UTF-8 as internal path encoding on Windows platform.

      This is an internal change to unify and simplify the handling of file paths.

      On the Windows platform, the file path is always converted to UTF-8 and converted to UTF-16 only for calls to WinAPI functions.

      The behavior of the functions for opening files on other platforms does not change.

    • Switch to .xz over .bz2 for release tarballs.

    • Disable static builds using Autotools by default. If you want static libraries, pass --enable-static to ./configure

    Fixed

    • Typo in docs/index.md.

    • Typo in programs/sndfile-convert.c, thanks @fjl.

    • Memory leak in caf_read_header(), credit to OSS-Fuzz (issue 30375).

    • Stack overflow in guess_file_type(), thanks @bobsayshilol, credit to OSS-Fuzz (issue 29339).

    • Abort in fuzzer, thanks @bobsayshilol, credit to OSS-Fuzz (issue 26257).

    • Infinite loop in svx_read_header(), thanks @bobsayshilol, credit to OSS-Fuzz (issue 25442).

    • GCC and Clang pedantic warnings, thanks @bobsayshilol.

    • Normalisation issue when scaling floating point data to int in replace_read_f2i(), thanks @bobsayshilol, (issue #702).

    • Missing samples when doing a partial read of Ogg file from index till the end of file, thanks @arthurt (issue #643).

    • sndfile-salvage: Handle files > 4 GB on Windows OS

    • Undefined shift in dyn_get_32bit(), credit to OSS-Fuzz (issue 27366).

    • Integer overflow in nms_adpcm_update(), credit to OSS-Fuzz (issue 25522).

    • Integer overflow in psf_log_printf(), credit to OSS-Fuzz (issue 28441), (issue 25624).

    • ABI version incompatibility between Autotools and CMake build on Apple platforms.

      Now ABI must be compatible with Autotools builds. Note that this change requires CMake >= 3.17 for building dylib on Apple platforms.

    • Fix build with Autotools + MinGW toolchain on Windows platform.

      See https://github.com/msys2/MINGW-packages/issues/5803 for details.

    Security

    • Heap buffer overflow in wavlike_ima_decode_block(), thanks @bobsayshilol, credit to OSS-Fuzz (issue 25530).
    • Heap buffer overflow in msadpcm_decode_block(), thanks @bobsayshilol, credit to OSS-Fuzz (issue 26803).
    • Heap buffer overflow in psf_binheader_readf(), thanks @bobsayshilol, credit to OSS-Fuzz (issue 26026).
    • Index out of bounds in psf_nms_adpcm_decode_block(), credit to OSS-Fuzz (issue 25561).
    • Heap buffer overflow in flac_buffer_copy(), thanks @yuawn, @bobsayshilol.
    • Heap buffer overflow in copyPredictorTo24(), thanks @bobsayshilol, credit to OSS-Fuzz (issue 27503).
    • Uninitialized variable in psf_binheader_readf(), thanks @shao-hua-li, credit to OSS-Fuzz (issue 25364).
    Source code(tar.gz)
    Source code(zip)
    libsndfile-1.1.0-win32.zip(1.68 MB)
    libsndfile-1.1.0-win32.zip.asc(662 bytes)
    libsndfile-1.1.0-win64.zip(1.89 MB)
    libsndfile-1.1.0-win64.zip.asc(662 bytes)
    libsndfile-1.1.0.tar.xz(713.48 KB)
    libsndfile-1.1.0.tar.xz.asc(662 bytes)
  • 1.0.31(Jan 24, 2021)

    • The releaser of libsndfile starting from this version is the libsndfile team member @SoapGentoo, see AUTHORS for details.
    • Implement fast SSE2 optimized psf_lrintf() and psf_lrintf() functions to improve perfomance when libsndfile is built using Visual C++ (especially) and other compilers on x86 and AMD64 platforms. See also description of ENABLE_SSE2 CMake option in README.md.
    • Documentation:
      • Move site to new URL: http://libsndfile.github.io/libsndfile/
      • Convert documentation pages from HTML to Markdown
      • Use GitHub's Jekyll static site generator to generate static HTML pages for site
      • Fix api.md table error, thanks to @zodf0055980
      • Other docuemntation fixes and updates
    • Change CMake's project name from sndfile to libsndfile as it should be.
    • Change behaviour of ENABLE_STATIC_RUNTIME option. In short:
      • You can use ENABLE_STATIC_RUNTIME for CMake >= 3.15 without error.
      • You can use your our method to set MSVC runtime library flags if none of ENABLE_STATIC_RUNTIME and CMAKE_MSVC_RUNTIME_LIBRARY were set. Advanced information:
      • If this option is defined (set to ON or OFF), set CMP0091 policy to OLD (we handle MSVC runtime library flags using compiler flags), set corresponding compiler flags for user.
      • NEW: If this option is not defined, set CMP0091 policy to OLD (we handle MSVC runtime library flags using compiler flags), don't touch compiler options, allow user to set it manually.
      • NEW: If new CMake option CMAKE_MSVC_RUNTIME_LIBRARY is set, change CMP0091 policy to NEW (we handle MSVC runtime library flags using that option), don't touch compiler flags.
      • NEW: If both ENABLE_STATIC_RUNTIME and CMAKE_MSVC_RUNTIME_LIBRARY are set, terminate configuration with fatal error.
      • For MinGW toolchain this option is experimental. If you enabled it and then disabled again, you need to clear CMake cache (delete CMakeCache.txt).
    • Make CMake clip test faster.
    • Fix CMake bug with sndio library dependency, thanks to @drhenault.
    • Fix memory leak in wav_read_smpl_chunk() function, credit to OSS-Fuzz.
    • Fix aiff_read_header() memory leak(), credit to OSS-Fuzz.
    • Fix leak in wav_read_header(), credit to OSS-Fuzz.
    • Fix leak in wavlike_read_cart_chunk(), credit to OSS-Fuzz.
    • Fix memory leak in wav_read_acid_chunk(), credit to OSS-Fuzz.
    • Fix memory leak in aiff_read_basc_chunk(), credit to OSS-Fuzz.
    • Fix memory leak in wavlike_read_peak_chunk(), credit to OSS-Fuzz.
    • Fix memory leak in aiff_read_header(), credit to OSS-Fuzz.
    • Fix use of uninitialized value in exif_subchunk_parse(), credit to OSS-Fuzz.
    • Fix use of uninitialized value in endswap_int64_t_array(), credit to OSS-Fuzz.
    • Fix up the fuzzer so that it can't under or overseek, thanks to Max Dymond [email protected].
    • Fix Autotools configure on macOS, thanks to @tmcguire and @nwh.
    • Exclude repository-configuration from git-archive, thanks to @umlaeute.
    • Use version-script when compiling with clang on Unix with Autotools, thanks to @tstellar.
    • Improve handling of SMPL chunks in WAV files, thanks to @zodf0055980.

    Note for Autotools users: Please note that the "Source code (zip)" or "Source code (tar.gz)" downloads require you to have the autotools toolchain (autoconf, autogen, automake and libtool) installed. If you don't want to install it (or don't know what this means), you should probably download the libsndfile-*.tar.bz2 asset instead.

    Source code(tar.gz)
    Source code(zip)
    libsndfile-1.0.31-win32.zip(1.40 MB)
    libsndfile-1.0.31-win32.zip.sig(662 bytes)
    libsndfile-1.0.31-win64.zip(1.53 MB)
    libsndfile-1.0.31-win64.zip.sig(662 bytes)
    libsndfile-1.0.31.tar.bz2(854.81 KB)
    libsndfile-1.0.31.tar.bz2.sig(662 bytes)
  • v1.0.30(Sep 19, 2020)

    NOTE: libsndfile-1.0.30.tar.bz2 and libsndfile-1.0.30.tar.bz2.asc files were re-uploaded due to problems with incorrect line endings. Update the hashes if necessary. Sorry for the inconvenience.

    • Fix critical CMake bug with broken ABI of shared libsndfile library.
    • CMake build system considered to be stable.
    • Move sndfile.h.in from src/ to include/ directory. To avoid problems, delete old generated sndfile.h from $(top_builddir)/src.
    • Huge documentation update.
    • Fix opus test failures on BE platforms, thanks to Arthur Taylor [email protected].
    • Fix bug when sf_open_fd() function sometimes leaves filehandle open, even if close_desc parameter is TRUE, thanks to @uml√§ute.
    • Fix infinite loops on some pathological SD2 files, thanks to Jeremy Friesner [email protected].
    • Switch to GitHub Actions for continuous integration.
    • Add OSS-Fuzz tests to GitHub Actions workflow, thanks to Max Dymond [email protected].
    • Fix memory leak in wavlike_read_bext_chunk() function, credit to OSS-Fuzz.
    • Fix undefined behavior in avr-read_header() function, credit to OSS-Fuzz.
    • Add INSTALL_PKGCONFIG_MODULE CMake option to control sndfile.pc file installation, see README.md for details.
    • Add INSTALL_MANPAGES CMake option, see README.md for details.
    • Fix ENABLE_COMPATIBLE_LIBSNDFILE_NAME CMake option, now it works on MinGW platform too.
    • Fix ENABLE_CPACK CMake option, see README.md for details.
    • Fix ENABLE_STATIC_RUNTIME and CMAKE_MSVC_RUNTIME_LIBRARY behavior, see README.md for details.
    • Fix CMake man pages installation bug when sndfile-deinterleave.1 and sndfile-metadata-set.1 were not installed.
    • Fix sndfile-regtest paths handling on Windows platform, thanks to Gisle Vanem [email protected].

    The GPG signature is at Keybase.IO.

    Source code(tar.gz)
    Source code(zip)
    libsndfile-1.0.30-win32.zip(1.41 MB)
    libsndfile-1.0.30-win32.zip.asc(849 bytes)
    libsndfile-1.0.30-win64.zip(1.53 MB)
    libsndfile-1.0.30-win64.zip.asc(849 bytes)
    libsndfile-1.0.30.tar.bz2(832.34 KB)
    libsndfile-1.0.30.tar.bz2.asc(849 bytes)
  • v1.0.29(Aug 15, 2020)

    • Add support for Opus files.
    • Autotool build system improvements.
    • CMake build system improvements.
    • Fixes for: CVE-2017-12562, CVE-2017-17456, CVE-2017-17457, CVE-2018-19661, CVE-2018-19662, CVE-2018-19758 and CVE-2019-3832.
    • Add BWF v2 loudness parameters.
    • Wave64: Permit and skip arbitrary chunks prior to the data chunk.
    • Fix ASAN crash in wavlike_ima_seek().
    • Fix IMA-ADPCM encoding for AIFF files.
    • sndfile-convert: Handle gsm, vox and opus extensions the same way.
    • Add SFC_SET_OGG_PAGE_LATENCY_MS command to get Ogg page latency for Ogg Opus files.
    • Fix parsing of some SD2 files.
    • Documentation updates.
    • Minor bug fixes and improvements.

    The GPG signature is at Keybase.IO.

    Source code(tar.gz)
    Source code(zip)
    libsndfile-1.0.29-win32.zip(1.40 MB)
    libsndfile-1.0.29-win32.zip.asc(849 bytes)
    libsndfile-1.0.29-win64.zip(1.53 MB)
    libsndfile-1.0.29-win64.zip.asc(849 bytes)
    libsndfile-1.0.29.tar.bz2(811.61 KB)
    libsndfile-1.0.29.tar.bz2.asc(849 bytes)
  • 1.0.28(Apr 2, 2017)

    • Fix buffer overruns in FLAC and ID3 handling code.
    • Move to variable length header storage.
    • Fix detection of Large File Support for 32 bit systems.
    • Remove large stack allocations in ALAC handling code.
    • Remove all use of Variable Length Arrays.
    • Minor bug fixes and improvements.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.27(Mar 27, 2017)

    • Fix an SF_INFO seekable flag regression introduced in 1.0.26.
    • Fix potential infinite loops on malformed input files.
    • Add string metadata read/write for CAF and RF64.
    • Add handling of CUE chunks.
    • Fix endian-ness issues in PAF files.
    • Minor bug fixes and improvements.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.26(Mar 27, 2017)

LibMEI is a C++ library for reading and writing MEI files

C++ library and Python bindings for the Music Encoding Initiative format

Distributed Digital Music Archives and Libraries Lab 58 Nov 17, 2022
RetroWave is a hardware sound board series that uses vintage sound chips and works with modern hardware.

RetroWave Authentic sounds from vintage sound chips, on modern hardware! Introduction RetroWave is a hardware sound board series that uses vintage sou

SudoMaker 54 Oct 25, 2022
Open source digital sound effects based on JACK audio connection kit.

Noiseworks Digital Audio Effects Repository Open source digital sound effects based on JACK audio connection kit. This repository is intended to provi

null 5 Jul 29, 2022
straightforward CLI tool for spectral analysis of sound files

dowser dowser is (presently) a quick and simple low-level utility for performing spectral analysis of sound files. usage dowser

ezra buchla 14 Oct 26, 2022
PortAudio is a portable audio I/O library designed for cross-platform support of audio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.

PortAudio 750 Nov 19, 2022
SSMLSDL - Simple Sound Manipulation Library, Based on SDL and LIBWAV.

SSM-lib SSMLSDL - Simple Sound Manipulation Library, Based on SDL and LIBWAV. This library is open source and free software. It's aims to provide YOU,

UtoECat 1 Jan 20, 2022
highly efficient sound library for the Gameboy Advance

The Apex Audio System (AAS) is a sound library for the GBA. It includes a highly efficient mixer, MOD playing routines and support for up to 16 channels. It is designed for developers using a GCC-based development environment. AAS uses RAW, WAV or *tracker 1-16 channel MOD files as input.

Ties Stuij 31 Oct 27, 2022
Automatic Volume Adjuster for TVs and Sound Systems

Automatic Volume Adjuster Recently Great Scott built his version of an automatic volume adjuster. In this project he solved one of the biggest problem

Stefan Wagner 22 Jan 16, 2022
A tiny, header only, easy to use, cross-platform, portaudio wrapper, sound and notation manager, tailored for the demo scene.

TDAW A tiny, header only, easy to use, cross-platform, portaudio wrapper, sound and notation manager, tailored for the demo scene. This header enables

kbx 12 Nov 12, 2022
Scream - Virtual network sound card for Microsoft Windows

Scream is a virtual device driver for Windows that provides a discrete sound device. Audio played through this device is published on your local network as a PCM multicast stream.

Tom Kistner 1.4k Nov 25, 2022
OBS Plugin with image that reacts to sound source.

OBS Image Reaction Plugin Image that reacts to sound source. Installing binaries Download binaries from Releases. For Windows, Move the contents of pl

null 35 Oct 26, 2022
C++ library for audio and music analysis, description and synthesis, including Python bindings

Essentia Essentia is an open-source C++ library for audio analysis and audio-based music information retrieval released under the Affero GPL license.

Music Technology Group - Universitat Pompeu Fabra 2.2k Nov 25, 2022
C library for cross-platform real-time audio input and output

libsoundio C library providing cross-platform audio input and output. The API is suitable for real-time software such as digital audio workstations as

Andrew Kelley 1.6k Nov 22, 2022
C++ Audio and Music DSP Library

_____ _____ ___ __ _ _____ __ __ __ ____ ____ / \\_ \\ \/ / |/ \| | | | \_ \/ \ | Y Y \/ /_ \> <| | Y Y \ | |_|

Mick Grierson 1.4k Nov 26, 2022
Single file audio playback and capture library written in C.

A single file library for audio playback and capture. Example - Documentation - Supported Platforms - Backends - Major Features - Building - Unofficia

David Reid 2.5k Nov 25, 2022
a library for audio and music analysis

aubio is a library to label music and sounds. It listens to audio signals and attempts to detect events. For instance, when a drum is hit, at which frequency is a note, or at what tempo is a rhythmic melody.

aubio 2.8k Nov 15, 2022
Single file C library for decoding MPEG1 Video and MP2 Audio

PL_MPEG - MPEG1 Video decoder, MP2 Audio decoder, MPEG-PS demuxer Single-file MIT licensed library for C/C++ See pl_mpeg.h for the documentation. Why?

Dominic Szablewski 589 Nov 17, 2022
A simple and easy-to-use audio library based on miniaudio

raudio A simple and easy-to-use audio library based on miniaudio raudio forks from raylib.audio module to become an standalone library. Actually, it w

Ray 61 Oct 5, 2022