embcat: embeddeed concatenative synthesizer

embcat is an embedded concatenative synthesizer based on the
2024 ISMIR paper written
by Ben Cantil and Christopher J. Tralie PhD. It is insipired by
the Datamind Audio Concatenator
VST plugin.

the concatenator describes a real-time concatenative synthesis algorithm
utilizing a particle filter to approximate a real-time audio signal given
a corpus of audio.
this is fancy jibberish that effectively says if you give the algorithm a
folder of sounds and pass audio through it, it will be able to pick the moments
within the given sounds that it believes sounds the most similar to the audio
that is being passed through it.

the concatenator utilizes “old-fashioned AI,” relying on probablistic models
and evolutionary resampling algorithms to make predictions that evolve with a
real-time audio signal that potentially can change over time.

embcat’s codebase is separated into two main parts:

  • the corpus construction system (ecc)
  • the embcat source library

ecc : embcat corpus construction system

the corpus construction system is designed for use with the embedded system. it
consists of one monolithic binary file that contains all the required metadata
and PCM audio data. at its current iteration, the pcm audio data is 32-bit
floating point and is foricbly resampled and remixed to the user’s desired
sample rate and channel amount (currently just mono and stereo). this is done
to avoid as many headaches during the real-time loop when audio is being
loaded into RAM from the corpus.

the corpus construction system allows for the source library to pull metadata and
PCM audio data without needing to cache large audio files into memory. this is
particularly significant for an embedded system because memory is a very finite
resource in both the read/write speed and its quantity. christopher tralie and
ben cantil describe in their paper that it is theoretically possible for their
algorithm to be implemented with an “infinitely large corpus,” and the design of
the corpus aims to honor that philosophy by minimizing the amount of data that must be
cached in RAM at any given moment.

the corpus structure is as follows:

<-- file start -->
[header metadata]
[audio file metadata]
[window metadata]
[pcm audio]
<-- file end -->

the embcat source library

the embcat source library consists of the following:

  • core : foundational mathematical functions and data structures to keep the program afloat
    • buffer : files associated with ring buffers & ola-buffers
    • dsp : functions to perform DSP computations ranging from fft & RMS computations
    • dsp_core : functions to generate window and digit tables and mel filterbanks
    • linalg : functions for matrix-matrix computations, NMF, and KL-Divergence.
  • corpus : objects and functions relating to managing and retrieving information from the corpus
    • corpus : objects related to managing and retrieving metadata & PCM audio.
    • metadata : implementation of metadata-managing classes such as the yabadabadooey and the window_cache
    • counts : implementation of the poll_booth, the particle voting mechanism.
    • particle : implementation of main mechanism behind embcat
    • pfilter : implementation of the main mechanism behind embcat
  • utils : functions and definitions that serve a well defined purpose across the entire library
    • structs : core structs for use across the entire codebase.
    • utils : general-purpose utilities for use across the codebase (rng, linspace, etc.)
  • globals.hpp : constant hardcoded values that the program regularly relies on