Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

vtl-torch-gpu

GPU-batchable PyTorch port of core VocalTractLab (VTL) computations — articulatory geometry (vocal tract surfaces, cross-sections, tongue ribs) and the acoustic transfer function of the vocal tract tube model. Built as part of an independent speech-technology research project; extracted here as a standalone, reusable module.

What this is

VocalTractLab is a C++ articulatory speech synthesizer developed by Peter Birkholz and colleagues (Technische Universität Dresden, STKS group). Its reference backend is open source: TUD-STKS/VocalTractLabBackend-dev (GPL-3.0).

This repository provides a batched, GPU-capable PyTorch reimplementation of two parts of that pipeline, so that many vocal tract configurations can be processed in parallel on a GPU instead of one at a time through the native single-instance C++/API call:

  • Geometry (fast_vtl_geometry_torch.py, vtl_calc_surfaces_torch.py, mesh_kernel_torch.py, calc_tongue_ribs_torch.py): vocal tract surface calculation (larynx, pharynx, velum, mandible, tongue, lips, epiglottis, uvula), center-line and cross-section extraction, tube sectioning, and the underlying triangle-intersection mesh primitive. These modules are a line-for-line port of the GPL-3.0 formulas in the original C++ backend (VocalTract.cpp, Surface.cpp) — the target language is PyTorch instead of C++, the algorithm and its structure are unchanged. This is a derivative work under the GPL-3.0.
  • Acoustics (fast_vtl_acoustic.py, fast_vtl_acoustic_torch.py): the transfer-function computation of the vocal tract tube model (chain-matrix method, pharynx/mouth chains, nasal cavity, piriform fossa side-branch, Sondhi junction corrections, four radiation-impedance models). This part was independently written from the underlying acoustic theory and the published algorithm description, then cross-checked numerically against the native VTL reference output for correctness — it is not a copy of the C++ source. The Torch variant batches only the parts of the computation that depend on the per-sample tract vector (pharynx/mouth chain, nasal head); static per-speaker parts are computed once and reused, following the structure of the underlying physical model, not the C++ implementation's control flow.

Given the shared subject matter and to keep licensing unambiguous for anyone using this repository, the entire repository is released under GPL-3.0, matching the original project. See "License" below for what that does and does not allow.

Status / what is verified, what is not

  • Numerical accuracy of the geometry and acoustic modules was checked against the native VTL reference implementation during development (not shipped here as an executable test suite, since the verification harness has additional internal dependencies specific to the private project it came from). Reported internally: acoustic transfer function matched to within ~1e-13 (complex128), geometry surface points within ~1e-10 to ~1e-9 of the native output.
  • The geometry and acoustic Torch modules are not yet wired into a single end-to-end pipeline (articulatory parameters → geometry → tube state → acoustics → waveform) in this repository. They are two independently usable, independently verified pieces.
  • A small, unresolved discrepancy was observed in some subglottal configurations above ~7 kHz; root cause not identified at the time of publishing.
  • No warranty. This code was written and adapted with AI assistance (Claude) as part of a research project, including the translation from the original NumPy/C++-derived logic into the batched PyTorch form. It has been checked as described above, but may still contain errors. Use at your own risk; review before relying on it for anything beyond research/experimentation.

Requirements

  • Python 3.10+, PyTorch (CPU or CUDA), NumPy.
  • fast_vtl_acoustic_torch.py imports constants and shared (non-batched) computations from fast_vtl_acoustic.py — keep both files together (flat directory, no packaging beyond that).
  • To generate the tract-vector / tube-state inputs these modules expect, or to reproduce them against the native reference, you will separately need VocalTractLab itself (see its own repository/license) — it is not required to run the Torch modules on their own with your own input tensors.

Usage

Each module can be imported directly (flat, no package __init__.py — add this directory to PYTHONPATH or run scripts from within it):

import fast_vtl_geometry_torch as vtl_geom
import fast_vtl_acoustic_torch as vtl_acoustic

Most files also run a self-check when executed directly, e.g.:

python fast_vtl_acoustic_torch.py

License

GPL-3.0, see LICENSE — the full, unmodified license text of the GNU General Public License, Version 3. In short: you may use, study, modify, and redistribute this code, including commercially, but any distributed work built on it must also be licensed under GPL-3.0 (or a compatible license) with source code made available. GPL-3.0 does not permit adding further restrictions such as "non-commercial use only" on top of it.

If you use this code, please retain this attribution and a reference to the original VocalTractLab project by Peter Birkholz and the TUD-STKS group, whose published algorithm and (for the geometry modules) source code this is based on.

About

GPU-batchable PyTorch port of VocalTractLab geometry and acoustics (GPL-3.0)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages