Version 1.15.2 of DecentSampler introduces a cool new oscillator type that brings physical modeling synthesis capabilities to the platform: the pluck oscillator. This new waveform uses the Karplus-Strong algorithm to simulate the sound of plucked strings, adding a powerful new tool for creating realistic and expressive string instruments without requiring any audio samples. The pluck oscillator has also been open-sourced under the MIT license here.
What is the Pluck Oscillator?
The pluck oscillator implements the classic Karplus-Strong algorithm, a physical modeling technique that simulates the behavior of a vibrating string. When you trigger a note, the oscillator generates a burst of noise (the “pluck” or excitation) which is then fed through a delay line with feedback. As the sound circulates through the delay, it gradually loses high frequencies, creating the characteristic warm, decaying tone of a plucked string.
Using the Pluck Oscillator
Using the pluck oscillator is straightforward. Simply set the waveform attribute to "pluck1" on either an <oscillator> element or its parent <group>:
<DecentSampler minVersion="1.15.1">
<groups attack="0.005" decay="0.1" sustain="1" release="10.0">
<group>
<oscillator waveform="pluck1" damping="0.5" pluckType="0.5"/>
</group>
</groups>
</DecentSampler>Code language: HTML, XML (xml)
As you can see, the oscillator has two new parameters The pluck oscillator responds to standard ADSR envelope parameters, but the release time is particularly important as it controls how long the string continues to resonate after you release the key.
Controllable Parameters
The pluck oscillator exposes two key parameters that can be controlled via bindings:
Damping (OSCILLATOR_DAMPING)
The damping parameter controls how quickly high frequencies decay from the sound. This simulates the effect of damping on a real string:
- Lower values (0.0 – 0.3): Very bright sound with slow decay, like a lightly-touched string
- Medium values (0.3 – 0.7): Balanced tone with natural decay
- Higher values (0.7 – 1.0): Darker, heavily damped sound that dies out quickly
You can bind damping to a knob like this:
<labeled-knob x="20" y="20" width="80" height="100" label="Damping"
value="0.5" minimum="0" maximum="1">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_DAMPING"
translation="linear"
translationOutputMin="0"
translationOutputMax="1"/>
</labeled-knob>Code language: HTML, XML (xml)
A useful technique is to also map damping to the release time, so that heavily damped sounds die out faster:
<binding type="amp" level="group" position="0"
parameter="ENV_RELEASE"
translation="table"
translationTable="0,0.5;0.5,6.0;1.0,10.0"/>Code language: HTML, XML (xml)
Pluck Type (OSCILLATOR_PLUCK_TYPE)
The pluck type parameter controls the excitation signal—the initial “burst” that triggers the string vibration:
- Value 0.0: Pure triangle wave excitation, producing a softer, more rounded tone
- Value 0.5: Blend of triangle and noise
- Value 1.0: Pure white noise excitation, producing a brighter, more percussive attack
<labeled-knob x="120" y="20" width="80" height="100" label="Pluck Type"
value="0.5" minimum="0" maximum="1">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_PLUCK_TYPE"
translation="linear"
translationOutputMin="0"
translationOutputMax="1"/>
</labeled-knob>Code language: HTML, XML (xml)
Creative Applications
The pluck oscillator opens up many creative possibilities:
String Instruments: Create harps, guitars, basses, and other plucked instruments with just a few lines of XML. The physical modeling approach means the sound will respond naturally to different playing dynamics.
Hybrid Sounds: Layer the pluck oscillator with acoustic samples to add extra body and sustain to string sounds, or use it as a sub layer for bass guitars.
Experimental Textures: Push the damping and pluck type parameters to extremes to create otherworldly metallic tones, percussive hits, or evolving pads.
Complete Example
Here’s a complete preset that demonstrates both controllable parameters:
<?xml version="1.0" encoding="UTF-8"?>
<DecentSampler minVersion="1.15.1">
<ui height="375">
<tab>
<labeled-knob x="20" y="20" width="80" height="100"
label="Damping" value="0.5"
minimum="0" maximum="1">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_DAMPING"
translation="linear"
translationOutputMin="0"
translationOutputMax="1"/>
<!-- Also control release time -->
<binding type="amp" level="group" position="0"
parameter="ENV_RELEASE"
translation="table"
translationTable="0,0.5;0.5,6.0;1.0,10.0"/>
</labeled-knob>
<labeled-knob x="120" y="20" width="80" height="100"
label="Pluck Type" value="0.5"
minimum="0" maximum="1">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_PLUCK_TYPE"
translation="linear"
translationOutputMin="0"
translationOutputMax="1"/>
</labeled-knob>
<label x="20" y="130" width="300" height="20"
text="Pluck Oscillator Example" fontSize="16"/>
<label x="20" y="155" width="300" height="40"
text="Use Damping knob to control decay time Use Pluck Type knob to blend excitation (triangle → noise)"
fontSize="11"/>
</tab>
</ui>
<groups attack="0.005" decay="0.1" sustain="1" release="10.0"
ampVelTrack="1" pitchKeyTrack="1">
<group damping="0.5" pluckType="0.5">
<oscillator waveform="pluck1" />
</group>
</groups>
</DecentSampler>Code language: HTML, XML (xml)
Getting Started
To use the pluck oscillator, make sure your preset specifies minVersion="1.15.2":
<DecentSampler minVersion="1.15.2">
<!-- Your preset content -->
</DecentSampler>Code language: HTML, XML (xml)
A complete working example can be found in the DecentSampler Sample Library Examples repository here.
The pluck oscillator is documented in the DecentSampler Developer’s Guide, along with all the other oscillator types and parameters.
I’m really excited to see what creative uses the community comes up with for this new physical modeling capability. As always, if you find bugs, make sure to report them here. I do read all of the emails, even if I don’t always have time to respond to them. 🙂
Have fun!
– Dave