ftz.Lyberta.net

Modern C++ goodness

ftz Audio

Digital audio processing and synthesis library

The following operations are implemented:

  • Amplification
  • Mixing
  • Panning
  • Bit depth conversion
  • Sample rate conversion
  • Pitch shifting

The following oscillators are implemented:

  • Sine wave
  • Pulse wave
  • Triangle wave
  • Sawtooth wave
  • White noise

The following sample formats are implemented out of the box (you can always add yours):

  • 16 bit signed int
  • 24 bit signed int
  • 32 bit signed int
  • 32 bit float
  • 64 bit float

The following file formats are supported:

  • Microsoft RIFF Wave

The following audio interfaces available for playback:

  • ALSA

Key features

  • Cross platform - written in ISO C++17 + Concepts TS (+ #pragma once).
  • (Almost) header only - no need to build and worry about compiler settings.
  • Highly generic code - same algorithm works on any data regardless of it’s bit depth, sample rate or number of channels.
  • Free software - released under the terms of GNU GPLv3 or any later version.

Dependencies

Compiler support

  • G++ 8 or newer with libstdc++

How to get

You need to use Conan to install and use this library. To install Conan on APT-based distros you would typically do:

# apt install python-pip
$ pip install conan

Then add official ftz repository:

$ conan remote add ftz https://conan.ftz.lyberta.net

Then you need to follow a Conan tutorial to declare that your project depends on this library, for example, using conanfile.txt:

[requires]
ftzAudio/Latest@Lyberta/Latest

Or using conanfile.py:

build_requires = "ftzAudio/Latest@Lyberta/Latest"

The rest depends on your build system. In CMake you would do:

# Importing Conan settings.
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

# Adding example executable target.
add_executable(Example ...)

# Specifying libraries to link executable to.
target_link_libraries(Example PRIVATE CONAN_PKG::ftzAudio)

After that in your source code you include files like this:

#include <ftz/Audio/SomeHeader.h>

To build your code, remember to execute conan install before calling conan build or cmake so your dependencies will be set correctly.

Source code

API reference

Manually building the library

Build dependencies:

  • Git
  • G++ 8 or newer
  • CMake 3.8 or newer
  • Conan 1.2 or newer

To install dependencies on Debian Testing you would invoke:

# apt install git g++-8 cmake python-pip
$ pip install conan

If you didn’t have Conan installed before, you probably need to configure the default profile:

$ conan profile new --detect default
$ conan profile update settings.compiler.version=8 default
$ conan profile update settings.compiler.libcxx=libstdc++11 default
$ conan profile update settings.cppstd=17 default

Add official ftz repository to Conan:

$ conan remote add ftz https://conan.ftz.lyberta.net

Clone the repository and switch into it:

$ git clone https://gitlab.com/ftz/audio.git
$ cd audio

Build the Conan package with your specified user and channel:

$ conan create . User/Channel