Skip to content

About

A programming language designed with a digital audio compilation target.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Tøn-programming-language 🎵

Tøn is a custom, strongly-typed programming language and built-in Digital Audio Workstation (DAW) engine written in modern C++. Designed for programmatic music generation, it allows developers to script, mix, and manipulate audio events natively.

By blending standard programming paradigms (loops, functions, strict scoping) with domain-specific musical types (NOTE, SOUND, TIMELINE), Tøn empowers you to generate complex audio tracks from code and export them directly to .wav files. Under the hood, it features an ANTLR4-based multi-pass compiler, static type checking, and an intelligent, user-friendly diagnostic system.


Documentation Structure 📃

  • Setup & Build Guide – Requirements, installation scripts, and SoundFont configuration.
  • Core Syntax – Variables, data types, type casting, loops, and memory scoping.
  • Audio Engine – Generating SOUNDs, building a TIMELINE, audio operators (+, &), and .wav export.
  • Diagnostics – Smart typo suggestions, memory safety checks, and the !debug; tool.
  • Technical Report – Deep dive into the C++ backend, ANTLR4 compiler pipeline, and DSP implementation.
  • Credits & Acknowledgments – Third-party libraries, open-source tools, and licenses used in the project.

Setup and Build 🏗️

This repository comes with 2 configuration scripts for both Windows and Linux machines. If you wish to dive deeper into the configuration, please visit setup.md file.

Quick guide on running the configuration scripts:

To run the script, simply open your terminal in the project root directory and execute the following command:

Windows 💩

.\install-windows.bat

Linux 🐧

bash install-linux.sh

Project structure 🌲

Ton-programming-language/
├── antlr4_generated/
│   ├── TonBaseVisitor.cpp
│   ├── TonBaseVisitor.h
│   ├── TonLexer.cpp
│   ├── TonParser.cpp
│   └── ...         
├── docs
│   ├── audio.md
│   ├── brainstorm.md
│   ├── credits.md
│   ├── diagnostics.md
│   ├── doc.md.old
│   ├── raport.md
│   ├── setup.md
│   └── syntax.md
├── examples/
│   └── .gitkeep
├── runtime/
├── include
│   ├── core
│   │   ├── MusicBase.h
│   │   ├── Scope.h
│   │   ├── Timeline.h
│   │   └── tsf.h
│   ├── diagnostics
│   │   └── Diagnostics.h
│   ├── interpreter
│   │   └── TonInterpreter.h
│   ├── listener
│   │   ├── TonDeclarationListener.h
│   │   └── TonSyntaxErrorListener.h
│   ├── repl
│   │   └── TonRepl.h
│   └── typechecker
│       └── TonTypeChecker.h
├── src
│   ├── interpreter
│   │   └── TonInterpreter.cpp
│   ├── listener
│   │   ├── TonDeclarationListener.cpp
│   │   └── TonSyntaxErrorListener.cpp
│   ├── main.cpp
│   ├── repl
│   │   └── TonRepl.cpp
│   └── typechecker
│       └── TonTypeChecker.cpp
├── CMakeLists.txt
├── install-linux.sh
├── install-windows.bat
├── LICENSE
├── README.md
└── Ton.g4

About

A programming language designed with a digital audio compilation target.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages