Skip to content

Instantly share code, notes, and snippets.

@aike
Last active August 6, 2021 17:22
Show Gist options
  • Save aike/5b382f3e671cad953c7ef372e2227f28 to your computer and use it in GitHub Desktop.
Save aike/5b382f3e671cad953c7ef372e2227f28 to your computer and use it in GitHub Desktop.
sample outlier checker KONTAKT CREATOR TOOLS script
pitchThreshold = 0.2 -- semitone
loudnessThreshold = 6.0 -- dB
print(scriptPath)
print("=== pitch check ===")
pitchBatchData = mir.detectPitchBatch(scriptPath)
for filename, pitch in pairs(pitchBatchData) do
detune = pitch - math.floor(pitch)
if (detune > 0.5) then
detune = detune - 1.0
end
if (math.abs(detune) > pitchThreshold) then
nopath = filesystem.filename(filename)
print(" " .. nopath .. " " .. detune)
end
end
print("=== loudness check ===")
loudnessBatchData = mir.detectLoudnessBatch(scriptPath)
cnt = 0
meanLoudness = 0
for filename, loudness in pairs(loudnessBatchData) do
meanLoudness = meanLoudness + loudness
cnt = cnt + 1
end
meanLoudness = meanLoudness / cnt
for filename, loudness in pairs(loudnessBatchData) do
deviation = loudness - meanLoudness
if (math.abs(deviation) > loudnessThreshold) then
nopath = filesystem.filename(filename)
print(" " .. nopath .. " " .. deviation)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment