Geraint's JSFX repository
This is a collection of audio effects I have written in REAPER's JSFX language.
- PadSynth - a synth that produces thick sounds, including per-note effects and modulators
- Spring-Box - an echo/chorus effect
- Bad Connection - flips between two volumes to simulate poor connection or dropouts
- Sandwich Amp - distortion module with a before/after filter pair, width control and secondary input
- Warble - a basic pitch-editing effect
- Spectrum Matcher - analyse the difference between an input and a model, and optionally correct with EQ
- Smooth Limiter - a limiter that aims to have the correction curve as smooth as possible
- Panalysis - visualise and manipulate the stereo field of the audio
- Learning Sampler - a basic sampler that records incoming audio and plays it back
- Hammer And String - a monophonic string resonator/synth with portamento
- Hammer And Chord - a polyphonic string resonator/synth
- MIDI Gate - a MIDI-note-controlled gate (audio passes through only when MIDI note is down)
Presets (RPL) for these effects can be downloaded from GitHub.
You can find more information and demos for this synth on its main project page.
The per-note effects can re-ordered and renamed, and the modulators can modulate any later effect in the chain, including other modulators.
Spring-Box is a chorus/echo effect based on a matrix of 4 delay lines feeding back into each other. The delay lines vary in length according to the chorus parameters, so you can create a range of sounds from choruses and ambiences to space-like reverb effects. (audio demo)
Early echoes can be suppressed to get a smoother sound (the "late bias" control), by using two parallel delay structures with different feedback ratios, and subtracting the results.
Sandwich Amp is a distortion effect with a set of paired filters on either side, to provide a range of timbres. (audio demo)
The underlying distortion function is
tanh() (which is a fairly "soft" distortion, as opposed to a hard clip), but it can be driven quite hard, and an offset can be added to get asymmetrical response.
The "width" parameter widens the sound before distortion and narrows it afterwards, so that the distortion sounds stable and central while preserving the stereo feel of the sound. Similarly, the "filter" section applies a filter before the distortion, and then applies the inverse filter afterwards, which can provide distinctive distortion timbres.
It is also possible to supply a secondary input to the effect (channels 3 and 4) - this audio is added in before the distortion, but then subtracted again afterwards.
Warble is a relatively basic pitch-editing plugin. It analyses incoming audio, stores and displays it on a zoomable graph (middle mouse and scroll wheel). (demo: original, minor correction, major alterations, formant LFO)
There are three tools: nudge, erase and smooth. You use these tools with the mouse (left/right buttons do different things) to define how much it should be shifted. The current change amount is displayed in red.
The formant-correction on the shifting algorithm isn't perfect, so major corrections (e.g. 5 semitones or more) won't sound completely natural.
It doesn't (currently) separate notes from each other, or support automatic correction. I haven't figured out how to make "undo" work properly, so that's something to look at in the future.
Spectrum Matcher is a tool for comparing the spectrum/timbre of an input against a model, and optionally applying a correction filter.
The bottom half of the screen shows the short-term spectrum (green), the long-term spectrum (yellow), and the long-term reference spectrum (blue).
The top half of the screen shows the current difference between the long-term spectrums (red). If correction is enabled, it shows the correction curve (white) and phase (dotted brown). If the correction is frozen, it shows the frozen correction values in blue.
To disable correction and re-start/clear the long-term spectrum measurements, hit "Reset". To start correction, hit "Correct". Once correction is enabled, hit "Freeze" to set or update the fixed correction values.
It can learn new models from the incoming audio, and save this as a preset for later use:
This effect is quite CPU-intensive, so if you're not using it it could be good to bypass it.
This is a brick-wall limiter that aims to keep the correction curve smooth while remaining responsive.
It will recover completely from any peak in a fixed amount of time. Both the attack and release follow a curve that is similar to a sinusoidal segment (
1 + cos(x)), with the goal of reducing cross-modulation.
The "distortion" parameter changes the correction mode - at 0%, the correction is applied by scaling the output signal. At 100%, the correction is applied using a non-linear distortion (smooth, not a hard-clip), which can sound good for some applications such as drums. The display in the bottom-left shows the current correction response.
This effect draws the incoming audio on a 2D plot, so you can visualise the stereo field. You can also alter the width/pan using the controls.
- Centre-panned (mono) sounds will draw vertically
- Left-panned sounds will draw angled to the left, right-panned will draw to the right
- If the L+R channels are independent, the graph will have no defined clear direction (may appear round)
It's possible to rotate the field such that hard-left or hard-right inputs will output "inside out" (opposite phase in both output channels). In this case, the Width dial will turn red - double-click the dial to reset it to the maximum "safe" width:
This sampler records samples from the incoming audio when in learning mode (selected by a controller switch), and plays them back when in playback mode.
To record the samples, set the appropriate controller to a value of 64 or above. While this controller is down, when you play a MIDI note the sampler will remember the start/end positions in the buffer. When you have recorded all the samples, reset the controller to 0, and it will enter playback mode.
Samples are scaled according to velocity - if you record at velocity 100 and then play back at velocity 110, the output will be louder than the original input.
It currently does handle sample-rate changes.
Hammer And String
This effect is a monophonic string resonator. It can provide its own impulse (to act as a synth) as well as resonating the incoming audio. (audio demo)
The portamento affects how quickly the resonator changes pitch. The "Anticipation" control starts the portamento before the actual note (this adds latency), which can give more natural movement. To produce a legato effect for the synth, provide a note with low velocity to change the resonator pitch without an audible impulse.
Hammer And Chord
This effect is a polyphonic string resonator. It can provide its own impulse (to act as a synth) as well as resonating the incoming audio (e.g. a drum loop). (audio demo)
This effect is a simple MIDI-controlled gate. When a MIDI note is down (any MIDI note), the audio is passed through. Note velocity controls the amplitude, with the loudest value (unit gain) being determined by the "Max Velocity" control. (audio demo)