JSFX - CookDSP Library

Author: Olivier Belanger (belangeo@gmail.com)

Documentation Downloads Installation Tutorials Donation


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.

One must import the file cookdsp.jsfx-inc in the plugin before using any of the functions documented here. Importing a file is very easy with the import keyword:
import cookdsp.jsfx-inc


API documentation (version 0.4)

Documentation of functions and objects of the library.

Missing math functions

- tanh: Returns the hyperbolic tangent of the parameter.
- log2: Returns the logarithm (base 2) of the parameter.

Utility functions

- memalloc: Allocate a region of the local memory buffer.
- mtof: Midi to frequency conversion.
- mtot: Midi to transposition factor conversion.
- ftom: Frequency to midi conversion.
- ttos: Transposition factor to semitone conversion.
- dbtoa: Decibel to linear amplitude conversion.
- atodb: Linear amplitude to decibel conversion.
- wrap: Wraps-around an input value that exceeds the min and max limits.
- clip: Clips an input value that exceeds the min and max limits.
- scale: Maps an input value from an input range to an output range with power factor.

List management functions

- list: Create a list and fill it with the given arguments.
- set: Create a list and fill it with a single value.
- tmp: Fill the temporary memory with the given arguments.
- sumchnls: Mix down a list of `n` values to the desired number of channels.

Memory management objects

- buffer: Create a bloc of memory to store and manipulate audio samples.
- delay: Initialize a delay line for writing and reading audio samples.
- sdelay: Initialize an artifact-free delay line for writing and reading audio samples.

Filtering objects

- lop: First-order IIR lowpass filter.
- hip: First-order IIR highpass filter.
- bp: Second-order IIR bandpass filter.
- butlp: Second-order Butterworth lowpass filter.
- buthp: Second-order Butterworth highpass filter.
- butbp: Second-order Butterworth bandpass filter.
- butbr: Second-order Butterworth band reject filter.
- apass: Second-order phase shifter allpass.
- hilbert: Hilbert transform.
- biquad: A sweepable general purpose biquadratic digital filter.
- moog: 24dB/oct resonant lowpass filter.
- comb: Reverberates an input signal with a colored frequency response.
- allpass: Reverberates an input signal with a flat frequency response.
- eq: Equalizer filter.

Audio signal analysis objects

- follow: Initialize an envelope follower.
- zcross: Counts the number of zero-crossing inside a given time window.
- yin: Pitch tracker using the Yin algorithm.
- onset: Audio signal onset detection.

Oscillators objects

- phasor: Generate an ascending ramp with sharp corner (sawtooth wave).
- sine: Generate a sine wave oscillator.
- blosc: Band-limited oscillator with different wave shapes.

Pseudo-random generator object

- random: Generate a periodic pseudo-random generator.

Midi-related objects

- masr: Generate a Midi-triggered Attack-Sustain-Release envelope.
- notein: Retrieves information about midi note events.
- poly: Midi polyphony voice manager.

Dynamics objects

- compress: Compress an audio signal that rises above a given threshold.
- stcomp: Compress a stereo signal that rises above a given threshold.
- gate: Allows a signal to pass only when its amplitude is above a threshold.
- stgate: Allows a stereo signal to pass only when its amplitude is above a threshold.
- expand: Expand an audio signal that rises above or falls below given thresholds.

Special Effects objects

- disto: Arc tangent distortion.
- harmon: Generates harmonizing voices in synchrony with its audio input.
- vocoder: Applies the spectral envelope of a first sound to the spectrum of a second sound.
- wgverb: 8 delay lines mono FDN reverb.

Granulation objects

- grains: Simple granular synthesis generator.

Fast Fourier Transform objects

- fftin: Apply a Fast Fourier Transform analysis on an input signal.
- fftout: Apply an Inverse Fast Fourier Transform on an analysis signal.
- fftbrick: Apply a brickwall filter on a FFT analysis signal.
- fftband: Apply a bandpass filter on a FFT analysis signal.
- fftfilter: Filters an FFT-analysed signal according to the values in an array.
- fftgate: Passes only the bins whose amplitude is above a given threshold.

Phase Vocoder objects

- pvin: Apply a Phase Vocoder analysis on an input signal.
- pvout: Apply an Inverse Phase Vocoder Transform on an analysis signal.
- pvshift: Linearly moves the frequency components of a PV stream.
- pvtrans: Transpose the frequency components of a PV stream.
- pvverb: Spectral domain reverberation.

Polyphonic objects (multi-channel expansion)

- pobjects: Polyphonic objects.

Downloads

- Download the library: cookdsp_0.4_2017-03-13.zip

- Download all CookDSP examples as a zip archive: cookdsp_examples.zip

- Download all CookDSP tutorial examples as a zip archive: cookdsp_tutorials.zip

- Download the mono FFT plugin template: fft-mono-template

- Download the stereo FFT plugin template: fft-stereo-template

- Download the mono Phase Vocoder plugin template: pv-mono-template

- Download the stereo Phase Vocoder plugin template: pv-stereo-template

Installation

To install the CookDSP library, unzip the content of the download in the Reaper's Effects directory. The location of this directory is (where <username> should be replaced by the name of the user's home folder) :

Windows XP :
C:\Documents and Settings\<username>\Application Data\REAPER\Effects
Windows Vista/7/8 :
C:\Users\<username>\AppData\Roaming\REAPER\Effects
OSX :
/Users/<username>/Library/Application Support/REAPER/Effects 
linux :
~/.wine/drive_c/users/<username>/Application Data/REAPER/Effects 


Tutorials (Under development...)

A01_db_gain : Stereo amplifier controlled with decibel values
A02_cliping : Hard clipping distortion
A03_scaling : Scaling values from an input range to an output range

Donation

This project is developed by Olivier Belanger 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.


(c) Olivier Belanger - 2017 - belangeo@gmail.com