SynthRT is a package-oriented runtime for singing voice synthesis. Packages describe the contributions they provide, while category implementations and plugins interpret those declarations and perform the actual work.
Warning
SynthRT is pre-release software. DS Spec 2.4 and the C++ API are still evolving together, so breaking changes currently have no deprecation period.
- synthrt provides the host runtime. It reads package manifests, resolves dependencies and contribution references, discovers interpreters, and manages package loading.
- dsinfer provides the DiffSinger-facing inference contracts and implementations. It installs as the CMake package
synthrt-dsinferand its target issynthrt::dsinfer.
- A package is currently an installed directory containing a
desc.jsonmanifest. - A package is identified by its package ID and a version of one to four numeric parts, compared as integers after padding on the right.
- The root
contributionsobject groups declarations by contribution category. - Built-in categories currently include
inferenceandsinger. - Applications may register additional categories before loading their first package.
- A contribution may use an external declaration file or exist entirely as an entry in
desc.json, depending on its category.
Contribution locators do not contain package versions. Dependency resolution selects package versions before contribution references are bound.
vendor/sample:inference/acoustic
vendor/sample:singer/main
:singer/main
vendor/sample:inference/acousticrefers toacousticin the already-resolved direct dependencyvendor/sample.:singer/mainrefers tomainin the current package.- A locator names one contribution. Package dependency requirements use the separate
idandversionfields indesc.json.
SynthUnit exposes two package opening modes:
DataOnlyreads package data without discovering or loading plugins and without publishing the package into runtime state.Loadperforms the full load transaction:- Probe package declarations and discover matching plugins without loading them.
- Acquire the required runtime resources.
- Validate that every contribution is ready.
- Commit the complete package graph atomically.
If any step before Commit fails, the package is not made visible as loaded. The committed package and its resolved plugin choices remain stable for the lifetime of that load.
SingerProviderPlugincreates singer providers.InferenceInterpreterPlugincreates interpreters for a requested(interface, level, variant)contract.InferenceDriverPlugincreates model execution drivers selected by backend metadata, such as theonnxbackend supplied byonnxdriver.- One plugin bundle may advertise and create more than one supported contract.
- Each plugin category has its own ordered search path sequence.
Plugin bundles contain a shared library and a neighboring plugin.json. Each library keeps its plugins beside its own library directory, in the build tree and in the install tree alike:
lib/
└── synthrt-dsinfer/
└── plugins/
├── inferencedrivers/
│ └── onnx/
├── inferenceinterpreters/
│ ├── acoustic/
│ ├── duration/
│ ├── pitch/
│ ├── variance/
│ └── vocoder/
└── singerproviders/
└── diffsinger/
A host passes the category directories under lib/synthrt-dsinfer/plugins of the prefix that it installs dsinfer into to SynthUnit::setPluginPaths(). When several libraries ship interpreters of one category, the host lists the directory of each in the same call:
const auto plugins = prefix / "lib" / "synthrt-dsinfer" / "plugins";
unit.setPluginPaths("inference", {plugins / "inferenceinterpreters"});
unit.setPluginPaths("singer", {plugins / "singerproviders"});The CMake package exports every installed plugin as an imported target, such as synthrt::acoustic and synthrt::onnxdriver. A CMake project that deploys the plugins, or needs the directory of one, reads it with $<TARGET_FILE_DIR:synthrt::onnxdriver>, which also resolves the Debug tree of a vcpkg installation.
The runtime currently implements:
DataOnlymanifest inspection- the full
Loadtransaction: Probe, Acquire, Ready and atomic Commit - dependency selection and contribution locator binding
- ImportBinding lifecycle and executive supervision
- shared package identities and strong-reference-based release
- typed
ITaskexecution with cancellation, waiting and callback lifetime rules
Installing a .dspk archive is the host installer's responsibility. The loader accepts only installed package directories.
See Project status for the maintained task list.
- CMake 3.19 or later
- A C++17-capable compiler
- Ninja or another CMake-supported build tool
- Git, with which vcpkg and its overlays are checked out for the manifest-managed dependencies
The vcpkg manifest supplies the project's library and build dependencies:
Additional dependencies are required for particular targets:
- ONNX Runtime is required to build the ONNX inference driver.
- Boost.Test is required when
SYNTHRT_BUILD_TESTSis enabled.
The dependencies are installed with vcpkg-workspace.cmake, downloaded into scripts/. The script checks out vcpkg and the overlays that scripts/vcpkg-sources.json specifies into deps/, and installs the dependencies there. Run the following commands from the repository root.
curl -fsSL -o scripts/vcpkg-workspace.cmake https://raw.githubusercontent.com/stdware/dev-scripts/main/scripts/vcpkg-workspace.cmake
cmake -P scripts/vcpkg-workspace.cmake install -- --x-feature=testsOn Windows, the script is downloaded in PowerShell or in cmd with
powershell -Command "Invoke-WebRequest -OutFile scripts/vcpkg-workspace.cmake https://raw.githubusercontent.com/stdware/dev-scripts/main/scripts/vcpkg-workspace.cmake"Omit -- --x-feature=tests if automated tests are not required. cmake -P scripts/vcpkg-workspace.cmake help lists the other commands. --dry-run prints the commands without running them. scripts/vcpkg-sources.local.json takes precedence over scripts/vcpkg-sources.json, for example to use a local overlay.
ONNX Runtime is provided by the onnxruntime-builds overlay port. The onnx feature of the vcpkg manifest installs it together with the other dependencies:
cmake -P scripts/vcpkg-workspace.cmake install -- --x-feature=tests --x-feature=onnxThe CUDA 12 build of ONNX Runtime is the cuda12 feature of that port, onnxruntime-builds[cuda12].
This repository specifies no ONNX Runtime version. The overlay port alone determines the installed version, so a different ONNX Runtime payload requires no change to this repository. If the onnx feature is not installed, CMake omits the ONNX utility and driver targets, and the remaining libraries can still be built.
The build deploys no ONNX Runtime libraries beside the driver plugin. The driver loads ONNX Runtime from the directory that the host passes in DriverInitArgs::runtimePath, so the run-time location of ONNX Runtime is the responsibility of the host application. The tests in this repository pass ONNXRUNTIME_BUILDS_RUNTIME_DIR, which the onnxruntime-builds package defines.
The following example uses a single-configuration Ninja build:
cmake -S . -B build/Release -G Ninja \
-DCMAKE_INSTALL_PREFIX=<install-dir> \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=deps/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DSYNTHRT_BUILD_TESTS=ON
cmake --build build/Release --target all
cmake --install build/ReleaseSYNTHRT_BUILD_TESTS=ON registers the Boost.Test targets with CTest. On Windows the test executables link Boost.Test and the vcpkg runtime libraries dynamically, so the loader cannot find them unless the matching directory is on PATH first. Without it, every test aborts with 0xc0000135 (STATUS_DLL_NOT_FOUND) before it starts.
$env:PATH = "deps\vcpkg\installed\x64-windows\bin;$env:PATH"
ctest --test-dir build/Release --output-on-failureA Debug build takes the runtime libraries from deps\vcpkg\installed\x64-windows\debug\bin instead.
tests/auto/plugins of dsinfer holds the tests of single plugins, one test_<header>.cpp for each header, which links the objects of the plugin as the test of a library class links the library.
find_package(synthrt CONFIG REQUIRED)
add_executable(example main.cpp)
target_link_libraries(example PRIVATE synthrt::synthrt)find_package(synthrt-dsinfer CONFIG REQUIRED)
add_executable(example main.cpp)
target_link_libraries(example PRIVATE synthrt::dsinfer)Point CMAKE_PREFIX_PATH at the installation prefix when CMake cannot find the packages automatically. The dsinfer library file, its CMake package and its install directories are all named synthrt-dsinfer, while the target keeps the short name, synthrt::dsinfer.
- DS package specification 2.4
- dsinfer level 1 revised contracts
- Development guide
- Development conventions
Apache License 2.0. See LICENSE.