-
-
Save dhilowitz/98f46b22f38d96f8a818e7fa62874c57 to your computer and use it in GitHub Desktop.
-- 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>") |
That is great, thanks @dhilowitz 🙏
This is such a powerful tool and I so appreciate the work that has brought it to us. I am really new at this but trying to learn.
One of the things I am doing is converting older Kontakt libraries that have their samples in a folder structure.
Is there a way to do the conversion and preserve the original sample folders?
This way you can load the Kontakt preset and the Decent Sampler presets while pulling from the same sample resource folders.
Thanks so much for the help,
Simeon
@praisetracks Sure, this should work. But you might have to adjust the paths in the created file afterwards, you should be able to do this with Search&Replace in any editor.
Is it possible to use this without Creator Tools? Asking because I am on windows and unable to use Creator Tools.
That is great, thanks @dhilowitz.
Just a reminder for myself, as I keep forgetting it each time. How to use it:
Lua Script
tab in the lower windowLua Script
tabplay
iconCtrl
+Alt
+C
*.dspreset
file.