Version 1.15.0 of DecentSampler introduces three powerful new features that expand what’s possible when creating sample libraries: built-in oscillators for synthesis without samples, line elements for visual design, and rectangle elements for custom UI layouts. These features open up exciting new possibilities for both sound design and visual presentation.
Oscillators
One of the most significant additions in version 1.15.0 is support for built-in oscillators. Previously, DecentSampler was purely sample-based, but now you can create synthetic sounds using waveform generators. This is particularly useful for creating sub-bass layers, lead synth sounds, or even entirely sample-free instruments.
Using oscillators is straightforward. Instead of using <sample> elements, you place an <oscillator/> element inside a <group>. The waveform type is specified using the waveform attribute on either the sample or the parent group. Here’s a simple example:
<DecentSampler minVersion="1.15.0">
<groups>
<group>
<oscillator waveform="sine"/>
</group>
</groups>
</DecentSampler>
Code language: HTML, XML (xml)
The available waveform types are:
sine– Pure sine wave with no harmonics, ideal for sub-basssaw– Sawtooth wave with rich harmonics, great for bright soundssquare– Square wave with odd harmonics, useful for hollow tonestriangle– Triangle wave with fewer harmonics, produces mellower tonesnoise(orwhite_noise) – White noise generator, useful for percussion and textures
You can combine oscillators with regular samples for layering effects. For example, you might add a sine wave sub-bass underneath acoustic piano samples to add depth and weight to the low end.
Here’s a more complete example showing how to create a simple synth with waveform selection:
<DecentSampler minVersion="1.15.0">
<ui>
<tab>
<menu x="10" y="10" width="150" height="30" value="1">
<option name="Sine">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_WAVEFORM"
translation="fixed_value" translationValue="sine"/>
</option>
<option name="Saw">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_WAVEFORM"
translation="fixed_value" translationValue="saw"/>
</option>
<option name="Square">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_WAVEFORM"
translation="fixed_value" translationValue="square"/>
</option>
<option name="Triangle">
<binding type="general" level="group" position="0"
parameter="OSCILLATOR_WAVEFORM"
translation="fixed_value" translationValue="triangle"/>
</option>
</menu>
</tab>
<keyboard/>
</ui>
<groups>
<group waveform="saw" volume="0.5" attack="0.01" decay="0.3"
sustain="0.7" release="0.5">
<oscillator/>
</group>
</groups>
</DecentSampler>
Code language: HTML, XML (xml)
An example of using oscillators can be found in the DecentSampler Sample Library Examples repository here.
Rectangle Elements
Rectangle elements allow you to create custom backgrounds, panels, borders, and decorative elements in your UI. They support fill colors, border colors, and border thickness, giving you fine control over the visual design of your presets.
Adding a rectangle to your UI is simple:
<rectangle x="10" y="20" width="200" height="100"
fillColor="#FF3366FF"
borderColor="#FF000000"
borderThickness="2" />
Code language: HTML, XML (xml)
Colors use the 8-character hex format #AARRGGBB (alpha, red, green, blue), so #FF3366FF is fully opaque blue with a touch of green.
What makes rectangles particularly powerful is that they support bindings. You can dynamically control their position, size, and visibility using knobs, buttons, or other controls. Here’s an example that uses a knob to control a rectangle’s width:
<ui>
<tab>
<labeled-knob x="10" y="10" width="90" label="Width"
type="float" minValue="10" maxValue="400" value="100">
<binding type="control" level="ui" position="1" parameter="WIDTH"
translation="linear" translationOutputMin="10" translationOutputMax="400"/>
</labeled-knob>
<rectangle x="10" y="100" width="100" height="50"
fillColor="#FF0066FF"
borderColor="#FF000000"
borderThickness="2" />
</tab>
<keyboard/>
</ui>
Code language: HTML, XML (xml)
The binding parameters available for rectangles are:
X– X position in pixelsY– Y position in pixelsWIDTH– Width in pixelsHEIGHT– Height in pixelsVISIBLE– Visibility (true/false)
These dynamic capabilities open up possibilities for creating animated UI elements, progress bars, visualizations, and more.
Line Elements
Line elements complement rectangles by allowing you to draw lines for dividers, borders, connectors, or decorative elements. Lines are defined by their start and end points:
<line x1="10" y1="20" x2="200" y2="20"
lineColor="#FF000000"
lineThickness="2" />
Code language: HTML, XML (xml)
Like rectangles, lines also support dynamic control through bindings. You can create interactive visual elements by binding their endpoints to controls:
<ui>
<tab>
<labeled-knob x="10" y="10" width="90" label="End X"
type="float" minValue="0" maxValue="400" value="200">
<binding type="control" level="ui" position="1" parameter="X2"
translation="linear" translationOutputMin="0" translationOutputMax="400"/>
</labeled-knob>
<line x1="50" y1="100" x2="200" y2="100"
lineColor="#FFFF0000"
lineThickness="3" />
</tab>
<keyboard/>
</ui>
Code language: HTML, XML (xml)
The binding parameters for lines are:
X1– Start X position in pixelsY1– Start Y position in pixelsX2– End X position in pixelsY2– End Y position in pixelsVISIBLE– Visibility (true/false)
Together, rectangles and lines give you a complete toolkit for creating sophisticated custom UIs. You can build complex layouts, create visual feedback systems, or even make artistic designs entirely from geometric shapes.
Examples of using rectangles and lines can be found in the DecentSampler Sample Library Examples repository here. The examples include demonstrations of static layouts, dynamic binding controls, and even an artistic rendering of the Mona Lisa created entirely with rectangles!
Getting Started
To use any of these new features, make sure your preset specifies minVersion="1.15.0":
<DecentSampler minVersion="1.15.0">
<em><!-- Your preset content --></em>
</DecentSampler>
Code language: HTML, XML (xml)
All of these features are documented in the DecentSampler Developer’s Guide, and complete working examples are available in the DecentSampler Sample Library Examples repository.
Definitely let me know if you run into any issues with these new features. They represent a significant expansion of DecentSampler’s capabilities, and I would love to hear your feedback and see what creative uses you come up with.
All the best,
Dave