Skip to content

Instantly share code, notes, and snippets.

@aike
aike / chorddetector.ksp
Created May 3, 2024 00:47
Chord detection KONTAKT script
{ Chord detection KONTAKT script by aike }
{ This program is licensed under MIT License. }
on init
set_ui_height_px(470)
set_ui_width_px(970)
make_perfview
set_script_title("main")
set_control_par_str($INST_WALLPAPER_ID, $CONTROL_PAR_PICTURE, "panel")
set_skin_offset(0)
@aike
aike / FingerDrumMapping.ksp
Created December 28, 2023 11:04
Finger drum mapping for Maschine MIDI mode / KONTAKT multi script
on init
declare %map[128]
declare $n := 0
while($n < 128)
%map[$n] := $n
inc($n)
end while
%map[13] := 36 { BD }
%map[14] := 36 { BD }
@aike
aike / sample_file_loader.lua
Created November 3, 2023 18:00
KONTAKT sample file loader for CREATOR TOOLS
-- KONTAKT sample file loader for CREATOR TOOLS
local path = "C:/work/Samples"
for _, file in filesystem.directoryRecursive(path) do
if filesystem.isRegularFile(file) then
if filesystem.extension(file) == ".wav" then
print(file)
local z = Zone()
z.file = file
instrument.groups[0].zones:add(z)
end
@aike
aike / exclusive_key_switch.ksp
Created June 17, 2023 15:52
Radio button like keyswitch written in KONTAKT KSP
{
Radio button like keyswitch
The pressed key indicates selected state.
}
on init
set_key_pressed_support(1)
declare $n := 48
while ($n < 60)
set_key_color($n, $KEY_COLOR_RED)
inc($n)
@aike
aike / wavetable.ksp
Last active May 28, 2023 05:49
KONTAKT KSP Wavetable UI example
on init
message("")
set_ui_height_px(250)
make_perfview
declare ui_knob $X(-1000000,1000000,1)
move_control_px($X, 500, 140)
$X := 600000
declare ui_knob $Y(-1000000,1000000,1)
@aike
aike / PerlinNoise1D.ksp
Created May 17, 2023 11:50
1D Perlin Noise for KONTAKT KSP
{
1D Perlin Noise for KONTAKT KSP
reference:
http://adrianb.io/2014/08/09/perlinnoise.html
https://gist.github.com/Flafla2/f0260a861be0ebdeef76
example:
~pn_ax := 0.1
call perlin
@aike
aike / DontBelieveAI.js
Last active March 12, 2023 12:21
Don't Believe AI - Chrome Extension
//
// Don't Believe AI
// Chrome Extension
//
window.onload = function() {
const stickynote = document.createElement("div");
Object.assign(stickynote.style, {
position: "absolute",
top: "10px",
right: "40px",
@aike
aike / PerlinNoise3D.ksp
Created February 23, 2023 16:19
3D Perlin Noise for KONTAKT KSP
{
3D Perlin Noise for KONTAKT KSP
reference:
http://adrianb.io/2014/08/09/perlinnoise.html
https://gist.github.com/Flafla2/f0260a861be0ebdeef76
example:
~pn_ax := 0.1
~pn_ay := 0.0
@aike
aike / sample_check.lua
Last active August 6, 2021 17:22
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
@aike
aike / random_bench.nkp
Last active August 3, 2021 21:15
KSP random function benchmark / 10000 loop result: random() 827microsec, LCG 857microsec, MT 11498microsec
{==========================================
random function benchmark
==========================================}
on init
set_ui_height_px(120)
make_perfview
set_script_title("random function benchmark")
declare ui_label $label1(1, 1)