Audio Programming Environment

Audio Programming Environment is an open-source audio plugin, that allows to directly program C++ DSP in real time - integrated directly in your signal chain. Empowered by clang and LLVM, utilizing a built-in code editor, compiler, console and a basic control surface API, testing and prototyping DSP is extremely easy and convenient.


Complete picture of APE

Welcome to the manual for the APE program, Audio Programming Environment. APE is my biggest procrastination yet, having struggled to learn to write DSP code in a practical manner. I grew tired of spending most of my time writing interfaces, frameworks, GUI's and whatnot, managing different libraries, dependencies etc. for very small plugins until I ultimately decided that it would be better to abstract the whole package away - enter APE.

APE is a comparatively small program that hosts user-written code and integrates it into the signal path of your host program. It provides a set of commonly used math and DSP tools, and a generally idiomatic plugin declaration syntax - that maps to a final plugin SDK well - to hit the ground running. Integrated, automatable real time parameters with automatic UI to adjust variables inside your code, and access to certain system information like tempo, channels etc. together with a console and an editor allows easy development and testing.

APE's intended use is the development process - testing out and fine-tuning algorithms in an efficient manner before integrating it into your primary project. It allows for on-the-fly compilation and testing; hence iteration speed is pivotal and very optimized.

You don't have to worry about anything but the actual relevant code, since it's intended to provide a simple introduction to writing DSP code. It is therefore an ideal tool for teaching/educational projects and demonstrating small algorithms and / or effects.

I hope that someday it will evolve into a user provided library of effects with a working implementation, with a design that allows to easily use the code in your own projects. Many great sites on the internet provide a lot of great examples, though they are mostly scattered, incomplete and with a difficult path to testing.



Technical Reference

For now, refer to the manual (pdf).

Development Status

Actively being worked on, with the latest release just out.


Alpha 0.5.0: 10-02-2021
  Version controlled
  New repository:
   New source structure with permanent platform projects
   Most dependencies now included as submodules
   Modular and testable components
   Unit tests
  Build system
  Headers shared between plugin and user scripts, removes stale errors
  Complete rewrite to modern C++
  All manual memory management and leaks removed
  All UI, utility etc. now uses cpl
  Extended platform support, including technical Linux support. See requirements.
   Much more precise user controls, with ability to type in precise 64 bit values
   More flexible and extensible format / range options for parameter values
   Enumeration / lists of strings now supported as combo boxes
   Now automatable by host
   64-bit precision internally
   Meters are now per-sample evaluated and properly decaying. Also contains peak markers.
   Compatible parameter values preserved
   Hotkeys for all major operations
   True multithreaded compilation across plugins
   Old/new sound blended on swapping instances
   Optimized and built-in FFT
   Support for streaming audio files to and from disk, optionally resampled
   Audio thread interactions now completely lock free
   Precise transport access and playback state events to the plugin
  Quality of life
   SDKs and libraries now ship included, removed reliance on user development setup
   Plugin callbacks for initialization and reconfigurations now run asynchronously to avoid stutter on audio thread and hiccups on main thread
   Many more checks of resource managements, assertions etc. to make it much more safe
   Working code is serialized into the project as well, instead of referencing a script on disk.
   User is notified mismatched / out-of-date scripts
   Removed nonsensical errors on abandoned save dialogs
   Long operations timed and printed to the console
  Plugin GUI
   Redesigned, bit buttons removed in favor of simple icons and hotkeys
   Now completely uses vector graphics instead of bitmaps
   Switched to a tabbed system to increase real estate
   Tabs can be orphaned into separate desktop windows, and redocked back
   Graphics optimized and employs precise redrawing, much faster on OS X using core graphics ren-derer
   Subpixel text rasterization for normal DPI displays
   Removed "fpu exceptions" and "protected buffers" switches. These are now determined by compi-lation mode.
  Source code editor
   Externally editing files is now supported, reloading and recompiling whenever the file is saved ex-ternally
   Full project and intellisense when working in the source repository for user scripts
   Evaluate source code expressions as "breakpoints"
   Text scaling
   Auto indentation
   Saving a file without extension and determined language appends the default language extension
   Menu option to open "home" (also configurable) scripting directory
   Menu option to create a new file, cloned from the template file
   Menu options for build events (compile, activate, clean, edit externally etc.)
   Default now with a dark theme
  New compiler / language: CppApe
   C++ 17 bleeding edge compiler, based on Clang
   Runtime vehicle is libCppJit: Multithreaded, lazy JIT based on LLVM
   User scripts can now include and use other scripts
   Completely revised front end together with safe and idiomatic user API, boiler plate removed
   Access to most of C++ standard library, based on libcxx
   Subset of C standard library available, based on ccore
   Built-in SIMD vectorized math
   DSP primitives, interpolation algorithms
   Type safe and much faster print() family functions
   32-bit / 64-bit / 80-bit templated math precision, switchable by user in UI
   Typical scientific math constants available as templated constant expressions
   Complete user API documentation here: TODO
   Assertions supported
   RAII and unwind support
   Some exception support
   Globals, static constructors and destructors supported
   Memory mapped and precompiled system headers for compilation speed
   Based on Signalizer
   Per-sample source code expression evaluation and graphing
   Color coded inputs / outputs
   User-defined triggering
   Console is now thread safe
   Compilation is now thread safe
   Fixed crashes on immediate deserialization
   Many user file bugs fixed
   More or less deprecated, still ships in source form but complete support is missing
   Same for syswrap.

Alpha 0.3.2: 23-04-2014
  Missing examples for x64 vst target on OSx
  Alpha 0.3.1: 14-04-2014
  Fixed config.cfg's windows targets; tcc should now find missing headers
  Fixed a crash on host exit (directwrite disabled for now) on windows
  Alpha 0.3.0: 08-04-2014
  Source code rewritten to support JUCE also, which is the primary target platform now.
  this affects several things; notably the editor is switched from Scintilla to JUCE's inbuilt code editor now
  this has the welcome side effect of hotkeys working again
  syntax highlight only for C++ and friends for the moment.
  x32 and x64 builds on both Windows and OSx as AudioUnit and VST 2.4
  Countless bug fixes / code rewrite
  project recall now implemented
  autosave now implemented
  support for high dpi display
  an actual threading- and multi-instance model is now implemented; it should be completely safe to run multiple plugins in the same or other processes
  fix of fpu exceptions
  improved header support for other compilers than tcc
  improved graphics on some points, degraded on others

Alpha 0.2: 10-02-2014
  fixed uninitialized variable 'Engine::clocksPerSample'
  scilexer now properly adds filenames to project struct even in case of singleString-compilation
  scilexer now properly sets amount of files in the project
  the console should now properly print strings with linebreaks in them, this affects the core, api and scripts.
  fixed a bug where newlines will crash the console code.
  output logging of console now properly contains newlines.
  due to larger amounts of info being printed to the console, it is now scrollable and has a longer history
  added new compiler: syswrap. syswrap allows to interface to installed system compilers.
  fixed a bug where closing the editor would not reset the editor button in APE
  pressing the editor button now properly restores the window if user had minimized it before
  fixed a memory leak in the TCC compiler (early return caused no deallocation of plugin data)
  fixed a wrong return value in CInterface.h
  added a new knob function: api.createRangeKnob(). This knob formats it's display value based off a minimum, maximum and a callback function.
  fixed a bug where knobs initially would have the wrong format
  to enhance c++ compability, 'this' is now an illegal identifier
  added new valuestruct: scale
  added f_mod() and f_sin()
  added pi values
  compatized header with various compilers
  updated the example scripts to reflect these changes.

Alpha 0.1
  Initial release.

You may also want to check out commit history.