Metadata-Version: 2.4
Name: hvcc
Version: 0.17.2
Summary: `hvcc` is a python-based dataflow audio programming language compiler that generates C/C++ code and a variety of specific framework wrappers.
License: GPLv3
License-File: LICENSE
Author: Enzien Audio, Wasted Audio
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Compilers
Requires-Dist: Jinja2 (>=2.11)
Requires-Dist: arpeggio (>=2.0.2,<3.0.0)
Requires-Dist: pydantic (>=2.9.1)
Requires-Dist: pydantic-extra-types (>=2.10.6,<3.0.0)
Project-URL: Documentation, https://wasted-audio.github.io/hvcc/
Project-URL: Repository, https://github.com/Wasted-Audio/hvcc
Description-Content-Type: text/markdown

# Heavy Compiler Collection (hvcc)

[![Build Status](https://github.com/Wasted-Audio/hvcc/actions/workflows/ci.yml/badge.svg)](https://github.com/Wasted-Audio/hvcc/actions)
[![pypi](https://img.shields.io/pypi/v/hvcc.svg)](https://pypi.python.org/pypi/hvcc)
[![python](https://img.shields.io/pypi/pyversions/hvcc.svg)](https://pypi.python.org/pypi/hvcc)

`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](https://puredata.info) (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.

> [!IMPORTANT]
> **Using HVCC in a (commercial) product, hardware device, game, or research?**
>
> We are collecting information on how HVCC is used in the wild to better understand ecosystem needs and ensure long-term sustainability. [**Tell us about your use case!**](#use-cases-and-commercial-users)

## Documentation

- [Introduction](docs/getting-started/index.md)
  - [What is heavy?](docs/getting-started/index.md#what-is-heavy)
  - [Supported patch formats](docs/getting-started/index.md#supported-patch-formats)
  - [Supported platforms](docs/getting-started/index.md#supported-platforms)
  - [Supported frameworks](docs/getting-started/index.md#supported-frameworks)
  - [Licensing](docs/getting-started/index.md#licensing)
- [Getting Started](docs/getting-started/patching.md)
- [Generators](docs/generators/index.md)
- [MIDI](docs/reference/midi.md)
- [C API](docs/reference/c.md)
- [C++ API](docs/reference/cpp.md)
- [Heavy Lang Info](docs/reference/ir/heavy_lang.md)
- [Heavy IR Info](docs/reference/ir/heavy_ir.md)
- [Heavy GUI IR Info](docs/reference/ir/heavy_gui_ir.md)
- [Supported vanilla objects](docs/reference/objects/supported.md)
- [Unsupported vanilla objects](docs/reference/objects/unsupported.md)

## Integrations

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

- [plugdata](https://plugdata.org/) - Modern interface for Pure Data. Includes a full cross-platform toolchain and targets Daisy, DPF and PD Externals.
- [mod-cloud-builder](https://github.com/moddevices/mod-cloud-builder) - Online service for building LV2 plugins for the MOD platform.
- [OWL Patch Library](https://www.rebeltech.org/patch-library) - Online service for building OWL plugins (uses an old fork).
- [Boochow Web Apps](https://app.boochow.com/) - Online service for building Korg Logue SDK plugins.

## 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:

```sh
pip3 install hvcc
```

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

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

Also review our [Contribution Guide](CONTRIBUTING.md) before opening a pull request.

## Basic 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/`

```sh
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:

```sh
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.

```sh
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:

```sh
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:

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

A list of available generator options can be found [here](docs/generators/index.md)

### `-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](https://github.com/Wasted-Audio/heavylib) for example.

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

```sh
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

```sh
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.

For more information see [CLI & Tools](docs/getting-started/tools.md)

## Contact

The Heavy community aims to be safe and inclusive, please read our [Code of Conduct](CODE_OF_CONDUCT.md) before engaging.

### Use Cases and Commercial Users

We are actively gathering information from individuals and companies using HVCC in production, commercial products, embedded hardware, or research.

Sharing your experience helps guide future development, highlight real-world adoption, and support the project's sustainability.

If you or your organization use HVCC, please reach out to:

- **Email (Private):** [`contact@wasted.audio`](mailto:contact@wasted.audio)
- **GitHub Discussions (Public):** Share your work in [HVCC Discussions](https://github.com/Wasted-Audio/hvcc/discussions)

**Helpful details to include:**

- Company or project name (and whether you'd like to be publicly featured or kept confidential)
- Target framework or hardware (e.g., Daisy, DPF/VST/LV2, Unity/Wwise, custom embedded C/C++)
- Any features or improvements that would most benefit your workflow

### Community and Chat

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

- [Discord](https://discord.gg/fmxJveg)
- [IRC](https://web.libera.chat/#hvcc) (`#hvcc` on Libera.Chat)
- Forums:
  - [Bela](https://forum.bela.io/?q=hvcc)
  - [Rebel Technology](https://community.rebeltech.org/tags/puredata)
  - [Daisy](https://forum.electro-smith.com/c/integrations/pure-data/32)
  - [MOD](https://forum.moddevices.com/c/developers/pure-data/56)
- [Github Discussions](https://github.com/Wasted-Audio/hvcc/discussions)

## Funding

This project is partially funded through [NGI0 Commons Fund](https://nlnet.nl/commonsfund), a fund established by [NLnet](https://nlnet.nl) with financial support from the European Commission's [Next Generation Internet](https://ngi.eu) program. Learn more at the [NLnet project page](https://nlnet.nl/project/HVCC).

[<img src="https://nlnet.nl/logo/banner.png" alt="NLnet foundation logo" width="20%" />](https://nlnet.nl)
[<img src="https://nlnet.nl/image/logos/NGI0_tag.svg" alt="NGI Zero Logo" width="20%" />](https://nlnet.nl/commonsfund)

