Skip to main content

`hvcc` is a python-based dataflow audio programming language compiler that generates C/C++ code and a variety of specific framework wrappers.

Project description

Heavy Compiler Collection (hvcc)

Build Status pypi python

hvcc is a python-based dataflow audio programming language compiler that generates C/C++ code and a variety of specific framework wrappers.

Background

Originaly created by Enzien Audio, the need for hvcc arose from running against performance limitations while creating interactive music and sound products for the iPhone. Pure Data (libpd) was the only real choice for a design tool as it was embeddable and provided a high enough abstraction level that musicians or sound designers could be creative.

The goal was to leverage Pure Data as a design interface and statically interpret the resultant patches to generate a low-level, portable and optimised C/C++ program that would be structured to take advantage of modern hardware whilst still generating the same behaviour and audio output as Pure Data.

It has since then been expanded to provide further support for many different platforms and frameworks, targeting game audio design, daw plugins and embedded production tools. In 2021 Wasted Audio took over maintenance of the project.

Documentation

Integrations

hvcc has been integrated into several projects and services. This allows to easily compile patches without having to install hvcc manually.

  • plugdata - Modern interface for Pure Data. Includes a full cross-platform toolchain and targets Daisy, DPF and PD Externals.
  • mod-cloud-builder - Online service for building LV2 plugins for the MOD platform.
  • OWL Patch Library - Online service for building OWL plugins (uses an old fork).

Requirements

Python 3.9 up to 3.14

  • jinja2 (for generator templating)
  • pydantic (for data types)
  • pydantic-extra-types (for data types)
  • arpeggio (for expr~ translation)

For tests:

  • tox (python install)
  • numpy/scipy (dev dependencies)
  • midifile (git submodule)
  • tinywav (git submodule)
  • clang/clang++ (system install)

Installation

hvcc is available from pypi.org and can be installed using python3 pip:

pip3 install hvcc

If you want to develop hvcc you can install it from the source directory:

git clone https://github.com/Wasted-Audio/hvcc.git
cd hvcc/
pip3 install -e .

Also review our Contribution Guide before opening a pull request.

Usage

hvcc requires at least one argument that determines the top-level patch file to be loaded.

Generate a C/C++ program from input.pd and place the files in ~/myProject/

hvcc ~/myProject/_main.pd

This command will generate the following directories:

  • ~/myProject/hv heavylang representation of the input pd patch(es)
  • ~/myProject/ir heavyir representation of the heavylang patch
  • ~/myProject/c final generated C/C++ source files (this is what you would use in your project)

-o Select output directory

As seen in the above command, typical output of hvcc is split into several directories that contain the intermediate files used by the compiler itself, the final generated source files, and any additional framework specific files and projects.

The -o or --out_dir parameter will specify where the output files are placed after a successful compile.

For example:

hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/

Will place all the generated files in ~/Desktop/somewhere/else/.

-n Specify Patch Name

The -n or --name parameter can be used to easily namespace the generated code so that there are no conflicts when integrating multiple patches into the same project.

hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth

-g Generators

Once hvcc has generated internal information about the patch the -g or --gen parameter can be used to specify the output files it should generate. By default it will always include c for the C/C++ source files and additional generators can specified for certain framework targets.

For example:

hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth -g unity

Will also generate a unity section in the output directory contain all the build projects and source files to compile a Unity plugin.

It is also possible to pass a list of generators:

hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth -g unity wwise js

A list of available generator options can be found here

-p Search Paths

hvcc will iterate through various directories when resolving patch objects and abstractions. The -p or --search_paths argument can be used to add additional folders for hvcc to look in. Note that this argument is not needed for abstractions in the same folder as the top-level patch.

This can be handy when using a third-party patch library like heavylib for example.

Simply append any folder paths after the -p flag like so:

hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth -p ~/Workspace/Projects/Enzien/heavylib/ ~/Desktop/myLib/

-m Meta Data

hvcc can take extra meta-data via a supplied json file. It depends on the generator which fields are supported.

--copyright User Copyright

By default all the generated source files via hvcc will have the following copyright text applied to the top of the file:

Copyright (c) 2018 Enzien Audio, Ltd.

This can be changed with --copyright parameter

hvcc ~/myProject/_main.pd -o ~/Desktop/somewhere/else/ -n mySynth --copyright "Copyright (c) Los Pollos Hermanos 2019"

--help

Displays all the available parameters and options for hvcc.

Contact

The Heavy community aims to be safe and inclusive, please read our Code of Conduct before engaging.

There are several places where heavy/hvcc conversation is happening:

Or you can use the discussions tab of this repository

Funding

This project is partially funded through NGI0 Commons Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet program. Learn more at the NLnet project page.

NLnet foundation logo NGI Zero Logo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hvcc-0.15.0.tar.gz (357.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hvcc-0.15.0-py3-none-manylinux_2_41_x86_64.whl (33.6 MB view details)

Uploaded Python 3manylinux: glibc 2.41+ x86-64

File details

Details for the file hvcc-0.15.0.tar.gz.

File metadata

  • Download URL: hvcc-0.15.0.tar.gz
  • Upload date:
  • Size: 357.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.12.57+deb13-amd64

File hashes

Hashes for hvcc-0.15.0.tar.gz
Algorithm Hash digest
SHA256 ed86244d7f01563e07cf5e42f6e4389453bcc68a22d1eda9f890c8be610f8de7
MD5 565cedb0dd322424d00415acc87bf796
BLAKE2b-256 4c7371337114652c3541cdf6348cb202ac89a8c470a38b46a3c97017269a46b5

See more details on using hashes here.

File details

Details for the file hvcc-0.15.0-py3-none-manylinux_2_41_x86_64.whl.

File metadata

  • Download URL: hvcc-0.15.0-py3-none-manylinux_2_41_x86_64.whl
  • Upload date:
  • Size: 33.6 MB
  • Tags: Python 3, manylinux: glibc 2.41+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.7 Linux/6.12.57+deb13-amd64

File hashes

Hashes for hvcc-0.15.0-py3-none-manylinux_2_41_x86_64.whl
Algorithm Hash digest
SHA256 0fc8753956c499c857cd06bf11df445678796ac0c89fa0b962e8c9dfa60bbf5e
MD5 2c7a2e64d981e1cae7d1ecad3bc8dece
BLAKE2b-256 9375667651ec49aa5985d327141829828f896d4166762daec4b1722176293a7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page