COOKDSP


COOKDSP

DSP library for Reaper’s plugin language JS

 

The CookDSP library is a set of functions and objects to help the creation of plugins inside the Reaper software with the built-in JS language. JS is a scripting language which is compiled on the fly and allows you to modify and/or generate audio and MIDI processes, as well as draw custom vector based UI and analysis displays.

The CookDSP library provides tools for managing buffers, delay lines, filters, audio signal analysis, oscillators, MIDI synth, effects and spectral domain processing (Fast Fourier Transform and Phase Vocoder).

 

What’s new…

 

Changes for version 0.5:

  • waveguide : basic waveguide model.
  • flanger : swept delay line comb filter.
  • chorus : 8 modulated delay lines chorus processor.
  • Fixed bug in FFT mono template.
  • Fixed missing args in buffer_gen10 functions.

Changes for version 0.4:

  • Better and faster distortion algorithm.
  • Fixed repeated functions in pobjects.jsfx-inc.
  • Improved performance of FFT computation. Fixed a bug that cause phase vocoder effet to reallocate memory when unneeded.
  • Added an additional import to use polyphonic objects in order to accelerate to loading time of the standard library. User should add “import cookdsp/pobjects.jsfx-inc” at the beginning of the plugin.

Changes for version 0.3:

  • moog : resonant lowpass filter.
  • comb and allpass : reverberation building units.
  • blosc : band-limited oscillator with various wave shapes.
  • eq : equalizer filter.
  • grains : simple granular synthesis generator.
  • Added missing math functions : log2 and tanh.

Changes for version 0.2:

  • Fixed some broken examples
  • Added list management functions (list, set, tmp, sumchnls)
  • Added multi-channel expansion, see Pobjects in the documentation.
  • Added multi-channel expansion examples in the example folder.

 

Download and documentation

 

For download, installation, documentation and tutorials, visit this page.

You can take a look to the slides (in french) I used in a workshop session given at the Université de Montréal in may 2015. Here are the examples written during this session.

 

Source code

 

The GIT repository at https://github.com/belangeo/cookdsp is used to keep track of the source code and for bug reports.

 

Examples

 

The CookDSP library is very simple to use. Here is a couple of plugin examples.

– Create an Auto-Wah effect :

/************************************************
Auto-Wah: Bandpass filter controlled by the
input signal gain envelope. 
(c) belangeo - 2014
************************************************/
desc: Auto-Wah

import cookdsp.jsfx-inc

slider1:5<1,10>Filters Q 
slider2:5000<500,8000>Max Frequency
slider3:20<1,100>Follower Responsiveness

@init
// Initialize the envelope follower.
fol.follow(10);
// Initialize a stereo bandpass filter.
bpL.bp(1000, slider1);
bpR.bp(1000, slider1);

@slider
// Set the filter's Q.
bpL.bp_set_q(slider1);
bpR.bp_set_q(slider1);
// Set the follower responsiveness.
fol.follow_set_freq(slider3);

@sample
// Follow the input signal's gain.
input = (spl0 + spl1) * 0.707;
amp = fol.follow_do(input);
// Conversion gain to frequency
freq = scale(amp, 0, 1, 50, slider2, 2);
// Set the filter frequencies.
bpL.bp_set_freq(freq);
bpR.bp_set_freq(freq);
// Filter the input signal.
spl0 = bpL.bp_do(spl0);
spl1 = bpR.bp_do(spl1);

– A simple delay line with feedback :

/************************************************
Stereo Delay with Feedback:
(c) belangeo - 2014
************************************************/
desc:Delai Stereo + Feedback

slider1:250<1,1000>Delay Time (ms)
slider2:0<-1,1>Feedback

import cookdsp.jsfx-inc

@init
// Initialize two 1 second delay lines
d0.delay(srate);
d1.delay(srate);

@slider
// Conversion ms to samples
samps = slider1 * 0.001 * srate;

@sample
// Read the delay lines with cubic interpolation
val0 = d0.delay_read3(samps);
val1 = d1.delay_read3(samps);

// Write signals in the delay lines
d0.delay_write(spl0 + val0 * slider2);
d1.delay_write(spl1 + val1 * slider2);

// Mix and output
spl0 = (spl0 + val0) * 0.5;
spl1 = (spl1 + val1) * 0.5;

 

Donation

 

This project is developed by Olivier on his free time to provide  a complete dsp library to ease the plugin creation within Reaper. If you feel this project is useful to you and want to support it and it’s future development, please consider donating money. I only ask for a small donation, but of course I appreciate any amount.