SFZ Automatic Creator

Link to good samples/soundfonts at http://wiki.linuxaudio.org/wiki/free_audio_data

Moderators: MattKingUSA, khz

Post Reply
frostfall
Established Member
Posts: 14
Joined: Tue Oct 10, 2017 9:10 am

SFZ Automatic Creator

Post 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 :)
Lyberta
Established Member
Posts: 681
Joined: Sat Nov 01, 2014 8:15 pm
Location: The Internet
Been thanked: 1 time

Re: SFZ Automatic Creator

Post by Lyberta »

So how does it assign notes?
frostfall
Established Member
Posts: 14
Joined: Tue Oct 10, 2017 9:10 am

Re: SFZ Automatic Creator

Post 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.
Post Reply