synth-datagen

Getting started

Table of contents

Installation

Prebuilt binaries

Prebuilt binaries for multiple platforms are available from the rolling release, which is automatically built from the latest source:

PlatformArchitectureArchive format
Linuxamd64.tar.xz
Linuxarm64.tar.xz
macOSarm64.tar.xz
Windowsamd64.zip

Each archive contains the synth-datagen binary (synth-datagen.exe on Windows) and the project license.

Building from source

Alternatively, synth-datagen can be installed from source with Go 1.26 or later:

go install rafaelmartins.com/p/synth-datagen@latest

How it works

synth-datagen reads a synth-datagen.yml configuration file that defines global parameters (sample rate, amplitude, scalar types) and one or more output header files. Each output specifies its #include directives, #define macros, and DSP module invocations with selectors that control which data arrays to generate.

Running the tool produces C headers with a consistent structure:

// Code generated by "synth-datagen ..."; DO NOT EDIT.

// SPDX-FileCopyrightText: 2022-present Rafael G. Martins <rafael@rafaelmartins.eng.br>
// SPDX-License-Identifier: BSD-3-Clause

#pragma once

#include <stdint.h>

#define adsr_sample_amplitude 0xff

static const uint8_t adsr_curve_as3310_attack[256] = {
    ...
};
#define adsr_curve_as3310_attack_len 256

All generated data is declared static const with automatically emitted #define macros for array dimensions (_len, _rows, _cols), making it straightforward to iterate over the data in firmware.