Last active
March 3, 2025 20:34
-
-
Save dhilowitz/98f46b22f38d96f8a818e7fa62874c57 to your computer and use it in GitHub Desktop.
Kontakt 6 Creator Tools Export to Decent Sampler format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Check for valid instrument | |
if not instrument then | |
print("The following error message informs you that the Creator Tools are not ".. | |
"focused on a Kontakt instrument. To solve this, load an instrument in ".. | |
"Kontakt and select it from the instrument dropdown menu on top.") | |
return | |
end | |
print('<?xml version="1.0" encoding="UTF-8"?>') | |
print("<!-- DS file for Kontakt 6 instrument " .. instrument.name .. " -->") | |
print('<DecentSampler pluginVersion="1">') | |
print(' <groups>') | |
local count = 0 | |
for i,g in pairs(instrument.groups) do | |
local vol = g.volume | |
if vol < -144 then | |
vol = -144 | |
end | |
print(" <group name=\"" .. g.name .. "\" volume=\"" .. vol .. "dB\" tuning=\"" .. g.tune .. "\" ampVelTrack=\"1\">") | |
for n,z in pairs(g.zones) do | |
local regionText = " <sample path=\"Samples/" .. filesystem.filename(z.file) .. | |
"\" volume=\"" .. z.volume .. | |
"dB\" tuning=\"" .. string.format("%.2f",z.tune) .. | |
"\" rootNote=\"" .. z.rootKey .. | |
"\" start=\"" .. z.sampleStart .. | |
"\" end=\"" .. z.sampleEnd .. | |
"\" loNote=\"" .. z.keyRange.low .. | |
"\" hiNote=\"" .. z.keyRange.high .. | |
"\" loVel=\"" .. z.velocityRange.low .. | |
"\" hiVel=\"" .. z.velocityRange.high .. "\"" | |
if z.loops[0].mode == 0 then | |
else | |
regionText = regionText .. " loopEnabled=\"true\"" | |
local loopEnd = z.loops[0].start + z.loops[0].length - 1 | |
regionText = regionText .. " loopStart=\"" .. z.loops[0].start .. "\" loopEnd=\"" .. loopEnd .. "\" loopCrossfade=\"" .. z.loops[0].xfade .. "\"" | |
end | |
regionText = regionText .. " />" | |
print(regionText) | |
count = count + 1 | |
end | |
print(" </group>") | |
end | |
print(" </groups>") | |
print("</DecentSampler>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to use this without Creator Tools? Asking because I am on windows and unable to use Creator Tools.