Page 1 of 1

SFZ Automatic Creator

Posted: Wed Oct 18, 2017 5:15 pm
by frostfall
Hello,

I would like share a small python script I made to automatically create a sfz with the wave files of a folder. You have to specify the sfz filename as first parameter, and the wave folder as the 2nd parameter.

Here is the script :

Code: Select all

#!/usr/bin/python
import sys,glob
if (len(sys.argv)<3):
    print "Usage sfzcreator.sh name.sfz folder"
    sys.exit(0)
keyCounter=36
handle = open(sys.argv[1], "w");
allfiles=glob.glob(sys.argv[2]+'*.wav')
allfiles.sort()
for filename in allfiles:
    handle.write("<region>\nsample="+filename+"\nkey=" +str(keyCounter)+"\n")
    keyCounter+=1
handle.close();
I find it always useful to auto create a sfz when I download a bunch of wave sounds :)

Re: SFZ Automatic Creator

Posted: Thu Oct 19, 2017 5:51 am
by Lyberta
So how does it assign notes?

Re: SFZ Automatic Creator

Posted: Thu Oct 19, 2017 9:16 am
by frostfall
Lyberta wrote:So how does it assign notes?
The notes are created from key 36 (check this website : http://www.mildon.me/apps/oneshot, put your mouse on the keyboard and it will show in the corner which note is which key) and then every new wave file has a number ++ (37, 38 etc...)

it is interesting when you have a lot of waves effect. Of cours if your goal is to create an instrument (1 wave = multiple notes), it's not the good tool.