Skip to content

Commit

Permalink
Updates the README with the lastest compile information.
Browse files Browse the repository at this point in the history
  • Loading branch information
modlfo committed Feb 25, 2023
1 parent 1da022c commit 8e332ba
Showing 1 changed file with 67 additions and 9 deletions.
76 changes: 67 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Vult is a simple and powerful language to program high-performance algorithms that may run in small microprocessors or microcontrollers. Vult is specially useful when programming Digital Signal Processing (DSP) algorithms like audio effects or synthesizers.

The Vult compiler is a transcompiler, which takes Vult code and produces plain C/C++ code that can be compiled in any platform with a C/C++ compiler, for example: Arduino or Teensy boards. Vult can also generate JavaScript that can be run directly in the browser or C/C++ that can be compiled as Pure Data externals. Code written in Vult has freedom.
The Vult compiler is a transcompiler, which takes Vult code and produces plain C/C++ code that can be compiled in any platform with a C/C++ compiler, for example: Arduino or Teensy boards (using fixed-point arithmetics). Vult can also generate JavaScript that can be run directly in the browser or C/C++ that can be compiled as Pure Data externals. Code written in Vult has freedom.

Check out the documentation and tutorial in http://vult-dsp.github.io/vult/ or take a look at the [Wiki](https://github.com/vult-dsp/vult/wiki).

Expand All @@ -29,6 +29,7 @@ Vult provides a few templates; for example to generate objects compatible with t

You can check these repositories for examples:

- PicoADK (Raspberry Pi Pico) https://github.com/DatanoiseTV/PicoADK-Firmware-Template
- WebAudio https://github.com/modlfo/vult-webaudio
- PureData https://github.com/vult-dsp/vult/tree/master/examples
- Teensy Audio https://github.com/modlfo/teensy-vult-example
Expand All @@ -39,6 +40,8 @@ In the Wiki
- [Command Line Options](https://github.com/vult-dsp/vult/wiki/Command-Line-Options)
- [Videos and Examples](https://github.com/vult-dsp/vult/wiki/Videos-and-Examples)

The DSP code for all [Vult VCV Rack](https://modlfo.github.io/VultModules/) and [Vult Eurorack](https://www.vult-dsp.com/hardware) modules is written in the Vult language.

## Credits

Vult is maintained by: Leonardo Laguna Ruiz with the help of Carl Jönsson and Johan Rhodin
Expand All @@ -56,15 +59,19 @@ There are three flavors the Vult compiler:

### Installing with npm

You need to have `node.js` and `npm` installed.
You need to have `node.js` and `npm` installed. This version of the compiler is 4x slower than the native version. If you have a large project it is recommended to install the native compiler. To install the Js version with npm run:

```
$ npm install vult -g
```

This will install provide `vultc` command in your path. Vult is updated frequently, you can use the same command to update Vult.

The native executables can be downloaded from the [releases page](https://github.com/vult-dsp/vult/releases).
### Installing the native executable

The native executables can be downloaded from the [releases page](https://github.com/vult-dsp/vult/releases). Pick the executable corresponding to your operating system and place it in a location pointed by your PATH variable.

### Installing the compiler as a JavaScript library

To install the node.js library use:
```
Expand All @@ -82,6 +89,44 @@ For an example check:

https://github.com/modlfo/vult-webaudio

## A glipse of Vult

Vult is based on the idea that a single function can be a full processing unit. Think of it as being a block or a box in your favorite graphical audio environment e.g. a box in PureData. Functions can store information. Consider the following code for a digital biquad filter:

```
fun biquad(x0, b0, b1, b2 ,a1 ,a2) : real {
mem w1, w2;
val w0 = x0 - a1 * w1 - a2 * w2;
val y0 = b0 * w0 + b1 * w1 + b2 * w2;
w2, w1 = w1, w0;
return y0;
}
```

That function declares two memory (`mem`) variables `w1` and `w2` which will remember the state of every instance of this filter.

Every time we need a new `biquad` instance, we just need to call the function. For example:

```
fun process(i1, i2) {
val o1 = biquad(i1, ....);
val o2 = biquad(i2, ....);
}
```
The filter that process the signal `i1` is completely independent of the one that process `i2`.

Vult also has a bunch of useful features, like the possibility of creating compile-time lookup tables and embedding wav files (with and without interpolation). For example, the following function is replaced by a lookup table which would be more efficient than executing the body of the function.

```
fun pitchToRate(d) @[table(size=127,min=0.0,max=127.0)] {
return 0.00018539226566085504 * exp(0.057762265046662105 * d);
}
```

The Vult compiler can generate C++ code that performs all the calculations using fixed-point arithmetics. Fixed-point arithmetics executes faster than floating-point arithmetics in processors that do no have a dedicated FPU. For example AVR Arduinos, Teensy 3.2 and Raspberry Pi Pico.


## Text editor support

### SublimeText
Expand All @@ -96,15 +141,28 @@ Install the extension `vult` available in the [marketplace](https://marketplace.

## Compile from source

### Requirements
If you want to compile the Vult source, it is recommended to use a Linux or Mac computer. It is possible to compile on Windows but the process is more difficult.

First you need to install Opam. Check the alternatives on https://opam.ocaml.org/

Opam can be installed on Linux using your package manager. If you use a Debian/Ubuntu based distro you can use:

```
$ sudo apt install opam
```

In Mac you can install Opam using brew

```
$ brew install opam
```

### Installing the compiler and dependencies

- Ocaml >= 4.03
- Opam >= 1.2 https://opam.ocaml.org/
The simplest way to install all requirements is with Opam.

### Installing the tools
The simplest way to install the requirements is with Opam
```
$ opam switch 4.07.1
$ opam switch 4.14.0
$ opam install ocamlbuild containers ppx_deriving pla result ounit js_of_ocaml js_of_ocaml-ppx
```
### Compiling Vult
Expand Down

0 comments on commit 8e332ba

Please sign in to comment.