What's new

Arranging samples in Kontakt based on note names?

Tod

Senior Member
How do you Kontakt users do this? I've tried the the "automap" functions but all they did is set the root notes for all the samples to "C-2". I've done this in both Kontakt 5.5 and Kontakt 5.7 and got the same results.

I usually number the samples, but I didn't create or edit these samples so I'm at a lose. I know, or at least thought, that Kontakt could do this.

Any help would be appreciated.
 
Yes using negative octaves kinda breaks Kontakt's automapper. You can either rename the samples or use Creator Tools to create a Lua script for automapping.
 
Thanks Mario, I got the Creator Tools a short while back but haven't really checked it out yet. I also have not yet familiarized myself with Lua so it might be a challenge.

I can renumber them but there are close to 6,000 samples. :grin:
 
You could use this nifty Python script to do your file renaming. Just make sure that note names in the sample are following C3 = 60 spec, and that there's no Bb but A# instead.

Code:
import collections
import os
import re

notenames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
repldict = collections.OrderedDict()

for i in range(128):
    repldict.update({notenames[i % 12] + str(int(i / 12) - 2) : str(i)})

def replfunc(match):
    return repldict[match.group(0)]

regex = re.compile('|'.join(re.escape(x) for x in repldict))
for root, dirs, files in os.walk('.'):
    for filename in files:
        if filename.endswith(('.wav', '.ncw', '.aif', '.aiff')):
            src = os.path.join(root, filename)
            dest = regex.sub(replfunc, src)
            os.rename(src, dest)
            print(src + '\n' + dest + '\n')

Save the code in a file with extension .py, place it in your Samples folder, open it in Sublime, then press Ctrl+B and let it rip.
 
You could use this nifty Python script to do your file renaming. Just make sure that note names in the sample are following C3 = 60 spec, and that there's no Bb but A# instead.

Code:
import collections
import os
import re

notenames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
repldict = collections.OrderedDict()

for i in range(128):
    repldict.update({notenames[i % 12] + str(int(i / 12) - 2) : str(i)})

def replfunc(match):
    return repldict[match.group(0)]

regex = re.compile('|'.join(re.escape(x) for x in repldict))
for root, dirs, files in os.walk('.'):
    for filename in files:
        if filename.endswith(('.wav', '.ncw', '.aif', '.aiff')):
            src = os.path.join(root, filename)
            dest = regex.sub(replfunc, src)
            os.rename(src, dest)
            print(src + '\n' + dest + '\n')

Save the code in a file with extension .py, place it in your Samples folder, open it in Sublime, then press Ctrl+B and let it rip.
Wow Mario, I'll check this out, there is one problem, the person who edited and created these samples use flats (b), could I change the #s to flats like C# to Db?
 
Okay, gave this a try but what I got in Sublime is this:

"'python' is not recognized as an internal or external command,"

Any ideas?

I created the file in Notepad++ and placed it in the sample folder at the top with a name starting with 001.
 
Thanks Patrik, I've actually got 4 different versions of Python. Do I need to somehow direct Sublime to my latest version?
 
Thanks Patrik, I've actually got 4 different versions of Python. Do I need to somehow direct Sublime to my latest version?
Are you on Windows? My next guess would be that you don't have Python included in your PATH. This can be found in Control Panel by searching "Advanced System Settings" -> Environment Variables -> PATH (user variables).
This is the ending of PATH regarding Python:

Screenshot_4.png

...(other paths)...;C:\Users\Patrik\AppData\Local\Programs\Python\Python37-32\Scripts\;C:\Users\Patrik\AppData\Local\Programs\Python\Python37-32\

If you have it included in PATH or you are using a mac, I'm sorry, this is beyond my knowledge :/
 
Thanks again Patrik, this is what I got but not sure where to go from there.

Pict%20for%20VI-Control.png
 
Great! Now all you have to do is to:
  1. Find the main Python folder (check the message I wrote above, the path should be similar unless you specified a specific python installation folder); copy this path
  2. Open Notepad, paste the path, add a semicolon, paste the path, add \Scripts\ - then copy everything in Notepad
  3. Add a new user variable, the name should be Path (or PATH, I'm not sure), paste the contents of Notepad and click OK


The best solution would probably be to reinstall Python and check "Add Python to PATH", but this is a manual solution. I hope this works!
 
Thanks much Patrik, I decided to just update to the latest version of Python. I know where the paths are now so I'll give all this a try.

Incidentally, it might be a bit before I get back, VI-Control is offline on me right now.
 
Okay, so I pasted the path into "New User Variable" into Variable name:, but now it wants a variable and I'm not sure what to put there.

1569184305556.png
 
Please check the video I posted above - there are two little mistakes you made :) I hope you'll have it right after this comment!
1. "Variable name" should be "Path". Paste the long string to "Variable value" instead.
2. By adding "\Scripts\" I meant to literally connect it with the folder path. Let's say my folder path is

C:\Users\Patrik\AppData\Local\Programs\Python\Python37-32

Then, my overall string would be

C:\Users\Patrik\AppData\Local\Programs\Python\Python37-32\;C:\Users\Patrik\AppData\Local\Programs\Python\Python37-32\Scripts\

So what I did is that I added "\;" + the same folder path + "Scripts\"
Also, the S in "Scripts" should be uppercase. Do you see what I did?

Please send me your folder path so I can make sure it is correct :)
 
Last edited:
I think I got it, I'll give it a try as soon as I can. This is the path I used. Does it look right?

"C:\Users\Owner\AppData\Local\Programs\Python\Python37-32;add\scripts\"
 

Attachments

  • 1569191633671.png
    1569191633671.png
    1,018 bytes · Views: 1
Okay, I still get this message in sublime.

"'python' is not recognized as an internal or external command,"
 
At home, on an Apple computer, I save the code with IDLE application in Python 3.7 folder .
Then, I load this file with Sublime Text 3, without problem .

For the rest, I'm not in the same configuration ... (just my 2 cents)
 
I think I got it, I'll give it a try as soon as I can. This is the path I used. Does it look right?

"C:\Users\Owner\AppData\Local\Programs\Python\Python37-32;add\scripts\"
No :) It should look like this:
"C:\Users\Owner\AppData\Local\Programs\Python\Python37-32\;C:\Users\Owner\AppData\Local\Programs\Python\Python37-32\Scripts\"

If this doesn't help, try reinstalling python, as this would be beyond my knowledge
 
  • Like
Reactions: Tod
Top Bottom