Omni logo

Omni is a cross-platform DSL (Domain Specific Language) for low level audio programming. It aims to be a new, expressive and easy to use programming language to code audio algorithms in.

Omni leverages Nim and C to compile self-contained static or shared libraries that can then be loaded and used anywhere. So far, two wrappers have already been written to compile omni code to SuperCollider UGens (OmniCollider), or Max objects (OmniMax).

Also, a basic syntax highlighting VSCode plugin is available by simply looking for omni in the Extensions Marketplace.

The omni CLI

Once you’ve installed Omni, the omni executable will be placed in your ~/.nimble/bin folder.

The omni executable has one positional argument: the .omni or .oi file to compile. The argument can also be a list of multiple omni files, or a directory. In this latter case, all .omni or .oi files in the directory will be compiled.

Run omni -h to get help on all the available flags.

Omni - version 0.4.0
(c) 2020-2021 Francesco Cameli

Arguments:
  Omni file(s) or folder.

Options:
  -n=, --outName=       ""        Name for the output library. Defaults to the name of the input file with 'lib'
                                  prepended to it (e.g. 'OmniSaw.omni' -> 'libOmniSaw.so'). This argument does not work
                                  for directories or multiple files.
  -o=, --outDir=        ""        Output folder. Defaults to the one of the Omni file(s) to compile.
  -l=, --lib=           "shared"  Build a 'shared' or 'static' library.
  -a=, --architecture=  "native"  Build architecture.
  -c=, --compiler=      "gcc"     Select a different C backend compiler to use. Omni supports all of Nim's C compilers.
  -b=, --performBits=   "32/64"   Set precision for 'ins' and 'outs' in the perform block. Accepted values are '32',
                                  '64' or '32/64'. Note that this option does not affect Omni's internal floating point
                                  precision.
  -w=, --wrapper=       ""        Specify an Omni wrapper to use.
  -d=, --define=        {}        Define additional symbols for the intermediate Nim compiler.
  -m=, --importModule=  {}        Import additional Nim modules to be compiled with the Omni file(s).
  -p=, --passNim=       {}        Pass additional flags to the intermediate Nim compiler.
  -e, --exportHeader    true      Export the 'omni.h' header file together with the compiled lib.
  -i, --exportIO        false     Export the 'omni_io.txt' file together with the compiled lib.

When running the omni compiler, the output is either a static or shared library (depending on the --lib flag). Along with it, an omni.h file (depending on the --exportHeader flag) containing all the callable functions in the shared/static library will be exported.

Documentation

01 - Syntax

02 - The ins, outs and params blocks

03 - The init block

04 - The perform and sample blocks

05 - Functions: def

06 - Custom types: struct

07 - Memory allocation: Data

08 - External memory: buffers

09 - Stdlib: Delay

10 - Code composition

11 - Writing wrappers

12 - Nim interoperability