Giter Site home page Giter Site logo

vult-dsp / vult Goto Github PK

View Code? Open in Web Editor NEW
475.0 27.0 24.0 17.98 MB

Vult is a transcompiler well suited to write high-performance DSP code

Home Page: https://vult-dsp.github.io/vult

License: Other

JavaScript 0.01% Shell 0.04% OCaml 95.75% C 0.93% Makefile 0.31% Standard ML 1.98% Lua 0.01% C++ 0.98%
ocaml compiler dsp synthesizer vult microcontroller audio-effect puredata webaudio

vult's Introduction

Vult

Build Status Build status Coverage Status

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 (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.

Basics

To generate C/C++ code with floating point arithmetic you have to execute vult as follows:

$ vultc -ccode infile.vult -o outfile

This will produce the files outfile.h and outfile.cpp. In order to compile and link these files you need to include in your project the files runtime/vultin.h and runtime/vultin.cpp.

To generate code with fixed point arithmetics you need to execute:

$ vultc -ccode -real fixed infile.vult -o outfile

Fixed point arithmetics are performed in q16 format; 16 bits for the integer part and 16 for the decimal.

Vult provides a few templates; for example to generate objects compatible with the Teensy Audio Library or Pure Data externals.

You can check these repositories for examples:

In the Wiki

The DSP code for all Vult VCV Rack and Vult Eurorack 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

Logo design by: John Klimt https://www.facebook.com/JohnKlimt

The Vult logo is property of Leonardo Laguna Ruiz, all rights reserved.

Installing

There are three flavors the Vult compiler:

Installing with npm

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.

Installing the native executable

The native executables can be downloaded from the releases page. 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:

$ npm install vultlib

Embedding in a Web page

The compiler can be embedded in a web page providing and it provides all the functionality.

<script src="https://modlfo.github.io/vult/javascripts/vultweb.js"></script>

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

Put the syntax file in the corresponding Sublime Text User packages.

In Mac, the path is the following $HOME/Library/Application Support/Sublime Text 3/Packages/User/vult.sublime-syntax.

Visual Studio Code

Install the extension vult available in the marketplace.

Compile from source

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

The simplest way to install all requirements is with Opam.

$ opam switch 4.14.0
$ opam install ocamlbuild containers ppx_deriving pla result ounit js_of_ocaml js_of_ocaml-ppx

Compiling Vult

To compile the native executable:

$ make

Compile the node.js code:

$ make jscompiler

Running tests (Linux and macOS):

$ make test

vult's People

Contributors

callejn avatar cristiano-belloni avatar johanrhodin avatar kant avatar modlfo avatar ritschwumm avatar techbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vult's Issues

Vult Not Backward Compatible With VCV Rack 0.6.0?

Having an issue. Recently installed VCV Rack 0.6.0.

  • Vult modules came up as missing after installation.
  • Downloaded VultModulesFree
  • VultModulesFree now shows up as an Author. However,
  • Old 0.5.1 projects containing Vult modules can't find them

screen shot 2018-04-09 at 3 26 15 pm

  • Apparently this is because this suite of modules has been given a new name: "VultModulesFree". (Is that the reason?)
  • Therefore all my old projects containing Vult modules are now broken, which defeats the whole purpose of being able to save patches, doesn't it?

Can something be done about this? Thanks.

Initializations with @[init] ?

Hello,
I have been having issues with variable initializations in Vult. Sometimes my plugin behaves erratically outputting very large positive/negative values (no divisions by zero are present). This is probably due to some issues in variable initializations.
I am testing the Vult code and I noticed how the default@[init] of the process is not working as expected.
For instance:
I have a fun lfo function that I want to initialize with phase = 1.0 and I have created:

fun lfo(){
     mem phase;
...
}
and initPhase(){
      phase = 1.0;
}

then

fun process(sampletime:real){
 ....
}
and default()@[init]{
        _ = initPhase();

The variable always gets initialized to 0 or I get erratic outputs in the LFO.
In the myLfoModule.cpp I call void myLfo_process_init(); before process. (I also tried to call void myLfo_default())
I asked the VCV forum and it was suggested to implement a dataTo/From/Json to take control of variable initialization, which I did and maybe the situation has improved in terms of erratic behavior but the issue with the variable initialization in Vult is still there.
I am using the latest vult.exe on Windows. Is this an issue of the transcompiler or am I doing something wrong?

This is my plugin

Modifying fixed point type in vult runtime

I'm developing platform for modular synth based on relatively cheap MCUs. I prefer Vult over other DSL's due to its native support of fixed-point math. But I'd like to use 8.24 format instead of default 16.16. Is it possible to implement new format only by modifying vultin.h/vultin.c? I have almost compatible header-only 8.24 fixed-point math library from previous projects. Or is 16.16 format hardcoded inside transpiler?

V2 Rack browser crash

Windows 10
Rack version 219bbaf137d5dc70c96bd4206c3f8aad5524a81b

I was getting a crash trying to set up a default patch.
I run rack. Then click browser and type in 'cl' and boom it crashes. I figured out Vult was the culprit by moving all the plugins out of Rack2/plugins, then adding them back in one at a time. I'll put the crash stack in after the list of Modules.

I have a number of Rack modules I've built:
AudibleInstruments
ESeries
ImpromptuModular
squinkylabs-plug1
Befaco
FrozenWasteland
JW-Modules
Bidoo
Fundamental
MindMeldModular
CountModula
HetrickCV
SubmarineFree VultModulesFree

[21.416 fatal adapters/standalone.cpp:49 fatalSignalHandler] Fatal signal 11. Stack trace:
40: 0x0
39: 0x0
38: _C_specific_handler 0x7fffc199acc0
37: _chkstk 0x7fffc30081d0
36: RtlRestoreContext 0x7fffc2f95160
35: KiUserExceptionDispatcher 0x7fffc30072e0
34: ZN4rack10contextSetEPNS_7ContextE 0x6fa294d0
33: nvgFill 0x6f9fb7fd
32: ZN4rack6widget17FramebufferWidget6renderENS_4math3VecES3_NS2_4RectE 0x6fa9a6d8
31: ZN4rack6widget17FramebufferWidget4drawERKNS0_6Widget8DrawArgsE 0x6fa9b0a4
30: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
29: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x6fa9cb4a
28: ZN4rack6widget10ZoomWidget4drawERKNS0_6Widget8DrawArgsE 0x6fa9cdf6
27: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
26: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x6fa9cb4a
25: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
24: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x6fa9cb4a
23: ZN4rack3app7browser8ModelBox4drawERKNS_6widget6Widget8DrawArgsE 0x6fed49f0
22: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
21: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x6fa9cb4a
20: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
19: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x6fa9cb4a
18: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
17: ZN4rack6widget6Widget4drawERKNS1_8DrawArgsE 0x6fa9cb4a
16: ZN4rack6widget6Widget9drawChildEPS1_RKNS1_8DrawArgsEi 0x6fa9c9a8
15: ZN4rack6widget6Widget4drawERKNS1

Arduino Template / Example

I've written a few VCV Rack plugins with Vult now, I'd like to try running some Vult on an Arduino as a Eurorack module. However, I only see templates/examples for WebAudio, JS, PD and Teensy. Are there any instructions for using Vult on an Arduino (particularly the Nano)?

How to create a (zeroed) array of 5000 samples?

Hi, I'm taking the first steps with Vult. I'm creating a simple instrument which involves the initialisation of an array long 5000 samples. I don't really care if it's full of zeroes or random values, since I fill it using a mem counter, but I should be able to get and set on it.

What I'm doing is:

and start(freq: int) @[init] {
   impulse = 44100 / 100;
   y: array(real, 5000) = [];
   N: real = floor(44100.0 / freq);
}

and earlier:

fun processor() {
    mem N;
    mem impulse;
    mem n;
    mem y;
    ...
    val yn = get(y, n);
    val yn1 = get(y, n + 1);
    out = xn + (yn + yn1 % N) / 2.0;
    _ = set(y, n, out);
  ...
}

But the compiler comes back with This expression has type (array, 0) but (array, 5000) was expected.
Which makes sense as a response to my javascript-y initialisation, I guess, but do I need to specify all the 5000 values (or 10k or 50k) on initialisation? Is there a shorthand for this?

Recovery From Instability // Frequency Mapping

The biggest problem I am having as a Vult language user is unrecoverable instability.

This seems to come from my problem converting from actual-frequencies to w0 values for filters - there are some combinations which I'd expect to work, but will just totally crash the module in an unrecoverable way (ex, cutoff of .5 works but .4 crashes the plugin). Annoying! Can you explain the best way to convert from actual frequencies to values the filters from the cookbook will expect and not crash from (ex, 800Hz becomes .52 - how?)

Cheers!
R

Simple installation issue

Hello,
I have an issue in installing Vult. I did run the NPM installation line but I can't seem to access the vultc executable. Can you be more specific about how to install it in Windows?
Thanks!

How to include Vult source ?

Hi,

When I install the Vult cli with Node.js, and try to compile the sine example with it, I get the following error:

vultc -ccode ./src/vult/sine.vult -o sine
Error: ./src/vult/sine.vult:11:6-15: Unknown function 'Util.edge'
   mem trig;
   if(Util.edge(reset > 0.5)) {
      ^^^^^^^^^

I'm not sure how to include the Vult source code; please advise.

Can't build

When I run build.sh I get:

$ ./build.sh
    + /opt/local/bin/ocamldep.opt -modules lexerVult.ml > lexerVult.ml.depends
    File "lexerVult.ml", line 26, characters 0-4:
    Error: Syntax error
    Command exited with code 2.
    Compilation unsuccessful after building 2 targets (1 cached) in 00:00:00.

And line 26, characters 0-4 in lexerVult.ml is the keyword "open".

Generate templates for XMOS Devices

The XMOS multicore microcontrollers are great for DSP. It's really easy to develop multicore DSP applications for it and it would really profit from VULT support.

Popping in Bleak

I'm hearing occasional pops in the output of Bleak 0.6.16. I have confirmed this by looking at the output in Scope. I can see the waveform jumping at the moments when the sound has a pop. If drag-and-drop works, I'll be able to drag the video in here. If it doesn't, email me at [email protected], and I'll send it to you as an attachment. Thanks for doing the great modules!

Oops. This interface doesn't like a .wmv. I'll try zipping it.
bleak_pops_movie_zipped.zip

--Jim Aikin

Add support for arrays

Arrays are very important to create effects like delays, comb filters or granular synthesis.

Error calling `random()` method in VCV Rack

Hi,

I wrote a simple method returning a random number:

fun process() : real {
  return (random() - 0.5) * 10.0;
}

The generated c++ code looks like this:


/* Code automatically generated by Vult https://github.com/modlfo/vult */
#ifndef NOISE_H
#define NOISE_H
#include <stdint.h>
#include <math.h>
#include "vultin.h"
#include "noise.tables.h"

static_inline float Noise_process(){
   return (10.f * (-0.5f + float_random()));
};

#endif // NOISE_H

I have vultin.h in the same folder as noise.h.

However, when I call Noise_process() in my VCV plugin, rebuild and launch VCV, the plugin cannot be loaded, and i see the following error in the VCV logs:

[0.895 info src/plugin.cpp:120 loadPlugin] Loading plugin from /Users/sppericat/Documents/Rack2/plugins/shortwav-audio
[0.958 warn src/plugin.cpp:173 loadPlugin] Could not load plugin /Users/sppericat/Documents/Rack2/plugins/shortwav-audio: Failed to load library /Users/sppericat/Documents/Rack2/plugins/shortwav-audio/plugin.dylib: dlopen(/Users/sppericat/Documents/Rack2/plugins/shortwav-audio/plugin.dylib, 6): Symbol not found: __Z12float_randomv
  Referenced from: /Users/sppericat/Documents/Rack2/plugins/shortwav-audio/plugin.dylib
  Expected in: flat namespace
 in /Users/sppericat/Documents/Rack2/plugins/shortwav-audio/plugin.dylib

any idea why this is happening ? it works fine if i use the random::normal() method from the VCV SDK.

Problem with multiple independently compiled files when included (redefinition error)

My build script for PlatformIO is compiling my used .vult "modules" independently and if another function uses Util. for example, I get a compiler error from the C++ compiler about redefinition of the Utility functions.

I've tried with "-tables false" for all but the first vult file, but that doesn't fix the issue.

vultc -ccode -i vultinc/phase -i vultinc/util vultsrc/{INFILE} -o gen_{INFILE}

In file included from lib/vultgen/vultgen.h:5:0,
                 from src/main.cpp:2:
lib/vultgen/gen_blit_vult.h:254:21: note: 'float Util_cvTokHz(float)' previously defined here
 static_inline float Util_cvTokHz(float cv){
                     ^

How do I deal with it?

Exponential/Power Functions

Heyo! Loving Vult so far!

I'm looking at the language reference, and I don't see anyway to do power functions ( ex: 3**3 == 27 or pow(3,3)==27). There is an exp(), but it only takes one argument so I'm not sure what that's doing.

Can you either add this feature, or add the documentation for it if it already exists?

Thanks!
Rich

Generate random programs for testing

By generating random, but correctly typed programs it would be possible to perform more exhaustive testing of the transformations and the code generation.

Range or scaling factors of parameters?

Just have been playing around with the puredata examples and also looking at the vult and cpp code for each generated external. Everything generates and compiles well. Thanks!

I am assuming that the process function's parameters are the parameters for each external. Now are there specific ranges for such parameters? or is there is a convention of some kind operating such that a real parameter's range is 0.0 to 1.0 and then needs to be scaled? It would be nice to have an explicit range of some kind for each parameter (especially to make sliders, documentation, etc). any clarification would be much appreciated.

tanh not working in browser demo

Hello!
This:

fun saturate_table(x) @[table(size=10,min=0.0,max=6.0)] {
  return tanh(x);
}

Silently returns Code: Error when compiling without any further explanation.
If I change tanh to sin it works. Might it be that the demo version is old and doesn't support tanh? For sure it doesn't support random (but in that case, we get an Ace popup).

Install vult from native executbale

Hello,

I m trying to install vult from the native excutable for windows.
I try from mingW and windows terminal with 'start vultc' and my antivirus stop the install (then I ve desactivated it). I retried but nothing seems to happen.
I tried by right click on it and run as admin but it oesn't seem to work.
When I try to compile vult code I get an error that tell me that vultc is not a valid command.

What am I doing wrong?

Thanks a lot.

Raspberry Pi Pure data building examples

Hi I get a syntax error on running the cmake:

pi@raspberrypi:~/vult-master/examples/build $ cmake ../
CMake Warning (dev) in CMakeLists.txt:
No project() command is present. The top-level CMakeLists.txt file must
contain a literal, direct call to the project() command. Add a line of
code such as

project(ProjectName)

near the top of the file, but after cmake_minimum_required().

CMake is pretending there is a "project(Project)" command on the first
line.
This warning is for project developers. Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Vult compiler found in /home/pi/vult/vultc
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
/home/pi/vult/vultc: 8: /home/pi/vult/vultc: Syntax error: ")" unexpected
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/vult-master/examples/build

Compiling Problem

Hello,

I tried to build Vult, but I've run into this problem:

Error: Signature mismatch:
...
Values do not match:
val compare :
TypesVult.identifier ->
TypesVult.identifier -> Ppx_deriving_runtime.int
is not included in
val compare : t -> t -> int
File "src/typesUtil.ml", line 89, characters 7-14: Actual declaration
Command exited with code 2.

Has anybody experienced the same problem?

Window puredata example build fail

Hello!
I try to build on Windows 10 the puredata examples. I installed Cmake (v3.20.2) and vultc (v0.4.13) , the both are in my path. When I try to run the command cmake ../, I have this log :
Any one could help me ?

../repos/vult/examples/build (master)
$ cmake ../
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
  The CMAKE_C_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error in CMakeLists.txt:
  The CMAKE_CXX_COMPILER:

    cl

  is not a full path and was not found in the PATH.

  To use the NMake generator with Visual C++, cmake must be run from a shell
  that can use the compiler cl from the command line.  This environment is
  unable to invoke the cl compiler.  To fix this problem, run cmake from the
  Visual Studio Command Prompt (vcvarsall.bat).

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

ccode flag generates invalid C (references)

At this point, the vultc generates a mix of C and C++. C doesn't support references, therefore on my platform (RP2040) the compiler complains:

n file included from /home/syso/dev/pico-project-generator/i2s-codec-demo/i2s-codec-demo.c:11:
/home/syso/dev/pico-project-generator/i2s-codec-demo/vult.h:16:59: error: expected ';', ',' or ')' before '&' token
   16 | static_inline void Util__ctx_type_0_init(Util__ctx_type_0 &_output_){
      |                                                           ^
/home/syso/dev/pico-project-generator/i2s-codec-demo/vult.h:23:52: error: expected ';', ',' or ')' before '&' token
   23 | static_inline void Util_edge_init(Util__ctx_type_0 &_output_){
      |                                                    ^
/home/syso/dev/pico-project-generator/i2s-codec-demo/vult.h:28:50: error: expected ';', ',' or ')' before '&' token
   28 | static_inline uint8_t Util_edge(Util__ctx_type_0 &_ctx, uint8_t x){
      |                                                  ^
...

No random generator in the language reference

Hello,
I was looking at the reference wiki and found no random() function in the "mathematical functions" section.

I guess one could always implement its own PRNG but I was wondering if it is something you would consider to add or it's missing by design?

Decline has wrong description

I think Decline has the description from Debriatus. It says 'Wave destruction' But I guess it should say 'Equalizer'.

Converting PD examples to Teensy

Hi there

Is it possible to convert the PD examples to teensy objects? I tried it with the ladder filter but no matter what I do it always throw some errors (not enough args in the Process func for a start).

If its possible could you point out what needs to be removed in general? Also I resolved the missing util refs by simply copying the relevant functions which probably not the best solution (but I can totally live with it if it works).

Thanks in advance!

vult.sublime-syntax

It was quite easy to autoconvert the vult.tmLanguage to the new .sublime-syntax yaml-based format (there's an auto convert function in sublime text 3).

It works pretty well: once created, It's path should be $HOME/Library/Application Support/Sublime Text 3/Packages/User/vult.sublime-syntax

Included here for reference:

%YAML 1.2
---
# http://www.sublimetext.com/docs/syntax.html
name: Vult
file_extensions:
  - vult
scope: source.Vult
contexts:
  main:
    - match: '(fun|and|external)\s+([a-zA-Z_]\w*)'
      scope: meta.function.source.Vult
      captures:
        1: keyword.control.source.Vult
        2: entity.name.function.source.Vult
    - match: \b(fun|val|mem|return|if|else|while|then|type|table|external)\b
      scope: keyword.source.Vult
    - match: '\b((([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'
      scope: constant.numeric.source.Vult
    - match: \b(int|real|num|bool)\b
      scope: storage.type.source.Vult
    - match: '\b([a-zA-Z_]\w*)\b(\()'
      scope: storage.type.source.Vult
      captures:
        1: storage.type.source.Vult
        2: constant.character.source.Vult
    - match: (//).*$\n?
      scope: comment.line.double-slash.source.Vult
    - match: '"'
      captures:
        0: punctuation.definition.string.begin.source.Vult
      push:
        - meta_scope: string.quoted.double.source.Vult
        - match: '"'
          captures:
            0: punctuation.definition.string.end.source.Vult
          pop: true
        - match: \\.
          scope: constant.character.escape.source.Vult
    - match: /\*
      captures:
        0: comment.block.begin.source.Vult
      push:
        - meta_scope: comment.block.source.Vult
        - match: \*/
          captures:
            0: comment.block.end.source.Vult
          pop: true
        - match: \\.
          scope: constant.character.escape.source.Vult
    - match: '(=|:|;|<|>|,|!=|\+|\*|/|-|\||&|\(|\)|{|})'
      scope: constant.character.source.Vult
    - match: (true|false)
      scope: constant.language.source.Vult

pow, atan function?

Is there a reason why the generic exponentiation, like Math.pow in javscript, and arctangent, like Math.atan, are not supported? I guess they can be approximated (in the case of atan) or expressed in form of exp, but they're so useful.
For example, there's a blog post where you use Mathematica to calculate the exponent of e to implement the midi to freq formula - wouldn't it be nice to just have exponents? :)

MacOS puredata examples build fail

I built vult.native and also have vult in my path but the make part fails (see below)

$ mkdir build
$ cd build/
$ cmake ../
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Vult compiler found in $HOME/vult/vultc.native
-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/vult/examples/build
zod:build sa$ make
make[2]: *** No rule to make target `osc/phase.vult', needed by `phase.cpp'.  Stop.
make[1]: *** [CMakeFiles/phase_code.dir/all] Error 2
make: *** [all] Error 2
$ cmake ../
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Vult compiler found in $HOME/vult/vultc.native
-- Configuring done
-- Generating done
-- Build files have been written to: $HOME/vult/examples/build
$ make
make[2]: *** No rule to make target `osc/phase.vult', needed by `phase.cpp'.  Stop.
make[1]: *** [CMakeFiles/phase_code.dir/all] Error 2
make: *** [all] Error 2

v1 branch build error (cygwin/Windows)

Using latest commit. Previous build using dfdd25f was successful.

$ make -j4
which: no ocamlformat in (/usr/local/bin:/usr/bin:/cygdrive/c/Windows:/cygdrive/c/Windows/System32:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/WINDOWS/System32:/cygdrive/c/WINDOWS:/cygdrive/c/Program Files/dotnet:/cygdrive/c/Program Files (x86)/dotnet:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/130/DTS/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/130/DTS/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn:/cygdrive/c/_Projects/Csound6_x64/bin:/home/Steve/.opam/ocaml-variants.4.14.0+mingw64c/bin:/cygdrive/c/Ruby27/bin:/cygdrive/c/Python/Scripts:/cygdrive/c/Python:/cygdrive/c/Users/Steve/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Inkscape:/cygdrive/c/GNAT/2018/bin:/cygdrive/c/MongoDB/Server/bin:/cygdrive/c/Users/Steve/AppData/Local/.meteor:/cygdrive/c/Users/Steve/.dotnet/tools:/cygdrive/c/Users/Steve/AppData/Local/Yarn/bin:/cygdrive/c/Users/Steve/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/msys64/usr/bin:/cygdrive/c/Program Files/Faust:/cygdrive/c/Users/Steve/AppData/Roaming/npm:/cygdrive/c/Users/Steve/.dotnet/tools:/cygdrive/c/JetBrains/CLion 2022.2/bin:/cygdrive/c/JetBrains/CLion 2022.2/bin/mingw/bin:/cygdrive/c/Program Files/Faust/bin)
dune build src/vult.bc src/vult.exe
Error:
C:/cygwin/home/appveyor/.opam/4.14.0+mingw64c/lib/ocaml\Makefile.config: No
such file or directory
make: *** [Makefile:14: compiler] Error 1

Trummor2 bug / VCVRAck v2 Beta1 / OsX10.10.5

in a patch after saving and quitting Rack, when reopening the patch Trummor seems blocked, we have to put another in the patch and make the exchange, if I duplicate, I duplicate the bug with.
This is the "noise" party.
I made a little video.

trummor2-bug.VCVRack.v2.Beta1.mp4

web playground

Hi, I am testing Vult and I noticed, that even if you made mistake web playground still makes sound. It made me wondering why I am getting sinewave if I am trying to do saw.

Also - error message is somewhat hidden in the lower part of screen, it should be more prominent IMHO.

Dynamic Memory Allocation (making ESP32 external RAM work)

I'm running Vult generated code on my ESP32, but internal RAM is limited to 520K (minus WiFi Stack etc), so in order to use more, I need to use dynamic memory allocation to use the external PSRAM.

This is how I do it in non-vult DSP code.

	buffer = (float*) ps_malloc((MAX_DELAY_LEN + 1) * sizeof(float));
	memset(buffer, 0, (MAX_DELAY_LEN + 1) * sizeof(float));

ps_malloc allocates memory on external PSRAM.

Do I need to write a custom generator?

Create reference manual

Currently the only documentation of Vult is the tutorial but this does not cover all the functionality.

Range of output samples, [-1, 1] or [0, 1]

Sorry, this is silly, but I didn't find the answer anywhere in the docs.
I'm trying to write a simple waveshaper, like in here - I adapted the code to not use a waveshaping table (creating a 44k samples table kills the vult compiler, LMK if you want me to open an issue about that):

fun distortMdn(x: real) {
    val k = 20.;
    val n_samples = 44100.;
    val deg = 3.14159265358979323846 / 180.0;
    val out = ( 3. + k ) * x * 20. * deg / (3.14159265358979323846 + k * abs(x));
    return out;
}

It does almost nothing to my output, no matter how high the k is. The transfer function is like this.

I'm wondering if this could be due to the range of samples in vult being from 0 to 1 instead of -1 to 1? I couldn't find any reference to what the output range is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.