Skip to content

About

XML schema for DecentSampler preset files

Resources

Stars

6 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

136 Commits

Folders and files

Repository files navigation

DecentSampler Unofficial XML schema

💡 Check your presets right now with DSLint: dslint.fly.dev

Let's make .dspreset editing... Decent!

Making virtual instruments for DecentSampler eventually means some tedious editing of the XML-based .dspreset files by hand...

However, if you use a text editor that supports XML schemas, you can super-charge your editing experience:

  • Use context-aware code completion and suggestions: Code completion screencast

  • See documentation by hovering over a keyword: Code completion screencast

  • Spot errors with tags, attributes, structure, and incorrectly formatted values: Code completion screencast

How do I use this?

Option 1: GitHub Codespaces

Press this button on the GitHub page to create a new codespace:

GitHub Codespace creation button

You will receive a VS Code editor inside your browser. If you use Firefox and open local files, you might need to save the files to the codespace before the schema autocompletion kicks in.

Option 2: Setup in VS Code

Install Red Hat's XML editing extension.

Try it out!

Paste the following contents in a new text file:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://raw.githubusercontent.com/praashie/DecentSampler-schema/main/DecentSampler.xsd" ?>
<DecentSampler >
    <ui width="812" height="375">

    </ui>
    <groups>
        <group>

        </group>
    </groups>
</DecentSampler>

Place your cursor inside the <group> tag, and hit Ctrl+Space to trigger suggestions!

Edit an existing .dspreset with the schema

You can copy the <?xml-model ...?> line inside another .dspreset file to activate the schema. This will also work with some online XML validation tools.

Associate the schema with all *.dspreset files

⚠️ If you have trouble with this, use the previous section's xml-model line as a workaround.

Open your settings.json (instructions here), and copy the following settings inside it:

{
    "xml.fileAssociations": [
        {
            "pattern": "**/*.dspreset",
            "systemId": "https://raw.githubusercontent.com/praashie/DecentSampler-schema/main/DecentSampler.xsd"
        }
    ]
}

A ...schema? Huh?

An XML Schema Definition (XSD) is a standard way to describe the expected structure of an XML document.

engine-vocabulary.json

engine-vocabulary.json lists the names the Decent Sampler engine actually accepts: binding levels, types and parameters, seqMode values and note names. It's generated from the engine's source, so don't edit it by hand:

tools/generate-engine-vocabulary.py ../DecentSampler   # regenerate from a DecentSampler checkout
tools/check-xsd-vocabulary.py                          # fails if DecentSampler.xsd disagrees with it

The Decent Samples store's upload validator reads a copy of it, so the store and Decent Sampler's own Validate Preset check presets against the same names. Regenerate it, and copy it to the store (store/resources/decentsampler/engine-vocabulary.json), whenever the engine gains a binding parameter, type, level or seqMode value.

Credits

Thanks to David Hilowitz for his exciting DecentSampler project. This schema has been mostly based on the DecentSampler file format documentation: https://www.decentsamples.com/docs/format-documentation.html

This schema was kickstarted and edited with the VS Code extension XML by Red Hat. Impressive XSD-based code completion features are the main inspiration for developing this schema in the first place.

About

XML schema for DecentSampler preset files

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages