How to make SFZ files

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

Moderators: MattKingUSA, khz

User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

How to make SFZ files

Post by AnthonyCFox »

I'm ready to start making my first SFZ instrument but the problem is the damn samples!

I've about given up on trying to find good quality samples with friendly licenses online. What about synthesizers? I wouldn't mind a nice collection of synth samples but I hate the endless twiddling of knobs (which is why I prefer sampled synths); so what OSS synths have nice presets? I've messed around a bit with Zyn/Yoshimi and Hexter; I might try those but neither of them blow me away. What else is there?

Well, the title of this post promises to explain how to create sfz's and it's pretty easy, but why rewrite what's been well written; I'll just link to it: :wink:

In it's most basic form SFZ files are extremely simple, just a few lines of easy to understand text. Here's an introductory tutorial, aptly named 'SFZ Tutorial Part 1: Hello World!' http://www.youtube.com/watch?v=bTFs524KrGc

After watching that, going on to read, Sound on Sounds - 'Customising Sonar's SFZ Files' http://www.soundonsound.com/sos/apr08/a ... h_0408.htm is an excellent step to getting a bit deeper into the subject.

For the most complete description, online anyway, of the SFZ standard and a reference list of the open opcodes, Cakewalk has published 'The sfz Format: Basics' http://www.cakewalk.com/DevXchange/article.aspx?aid=108

Of course there's more to it than just editing text files, the samples themselves need to be generated and optimised and here's how that works: 'Garritan Aria SFZ tutorial' http://www.youtube.com/watch?v=dNoQo01mr7g

Finally, when you've got a basic understanding of how it works @varpa has this advice:
varpa wrote:Another aid to writing SFZ is to find some existing SFZs to use as an example.
These together form a nice gradient to understanding the process and there doesn't seem to be much more to it from the text file side of the operation. Creating the samples themselves is another story...
Last edited by AnthonyCFox on Thu Oct 24, 2013 5:53 pm, edited 1 time in total.
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
User avatar
raboof
Established Member
Posts: 1855
Joined: Tue Apr 08, 2008 11:58 am
Location: Deventer, NL
Has thanked: 50 times
Been thanked: 74 times
Contact:

Re: How to make SFZ files

Post by raboof »

AnthonyCFox wrote:why rewrite what's been well written; I'll just link to it: :wink:
Sure! This might be a good starting point for a wiki reference page!
varpa
Established Member
Posts: 509
Joined: Fri Feb 25, 2011 6:40 pm
Been thanked: 13 times

Re: How to make SFZ files

Post by varpa »

Another aid to writing SFZ is to find some existing SFZs to use as an example. For example jeffg has posted many SFZ instruments (see other post in this subforum) which are are good starting places. Of course, getting decent samples is completely non-trivial. Also you really want not just notes, but also release samples (like when you stop playing a note on a guitar), maybe noise (e.g. string scrapes). The SFZ standard supports some pretty sophisticated options if you dig into it.

Concerning synths you should check out amsynth - check out http://www.amsynth.com/index.html which actually covers a wide range of linux synths.
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: How to make SFZ files

Post by AnthonyCFox »

varpa wrote:Another aid to writing SFZ is to find some existing SFZs to use as an example.
You're right, of course. I should have included that but I found the links because I started with the idea of editing an existing file and quickly got lost. I'll edit the OP and add that, thanks.
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
ThomasStepheny
Posts: 1
Joined: Fri Oct 25, 2013 12:50 pm

Re: How to make SFZ files

Post by ThomasStepheny »

I have checked almost all the tricks...But can't help me..What is the other alternatives of it? :) :)
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: How to make SFZ files

Post by AnthonyCFox »

ThomasStepheny wrote:I have checked almost all the tricks...But can't help me..What is the other alternatives of it? :) :)
I don't understand your question. What do you need help with?

Or are you just building backlinks to your, currently, empty website? I would never have guessed "google group permissions" was a hot keyword, how do you plan on monetizing it? Do you have an e-book you're going to sell, or is it just a cheap, turn and burn, adsense site?
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
Kati Maya
Established Member
Posts: 9
Joined: Sat Nov 16, 2013 7:45 am

Re: How to make SFZ files

Post by Kati Maya »

I'm trying to figure out the SFZ format as well, specifically to take advantage of the Philharmonia sample library:
http://www.philharmonia.co.uk/explore/make_music/

I've written a bunch of code that indexes all of the instruments, lengths, dynamics, and default pitch from all of the sample files. It then downloads the mp3 samples and converts them into WAV format, then re-organizes them into a file structure. Everything gets stored locally into a sqlite database.

For a given instrument, I have 1 to N lengths which each have 1 to N dynamics. There is a 1 to 1 relationship between the instrument's combined length-dynamic and the articulation. The samples are split out by pitch and also have a 1 to 1 relationship to the instrument's length-dynamic.

Can someone please explain to me conceptually how this works? Something basic, like a structural example of what an XML file or OOP interface of what an actual instrument might look like using the data I've indexed.

I tried attaching the database here but I guess the file has to be less than 256kb so I uploaded it here:
http://www.mediafire.com/download/28136 ... _maker.zip

I'm going to go thru Anthony's links to see if I can make sense of this. My shortcoming is a lack of understanding of sound design theory and terminology, but the code is pretty easy if I can understand logic. I'm going to go thru Anthony's links an see if I can make some sense out of what the end result is supposed to look like.
varpa
Established Member
Posts: 509
Joined: Fri Feb 25, 2011 6:40 pm
Been thanked: 13 times

Re: How to make SFZ files

Post by varpa »

Rather impressive that you have made an SQLite out of all the Philharmonic metadata. To make an SFZ I suggest downloading one of jeffg's (see other threads) and looking by example how he sets up the sfz file. The basic idea is rather simple - you tell which file to play for which midi note. For example you can have something like:
<group>
lovel=0 hivel=20
<region> lokey=c0 hikey=e2 sample=CG_L1A_01.flac pitch_keycenter=e2
<region> key=f2 sample=CG_L1A_03.flac pitch_keycenter=f#2
...

Here I've set up a "group" of notes to play when the midi velosity is between 0 and 20.
The first "region" covers keys c0 to e2 which all use the same sample. You have to say the pitch keycenter so the sampler knows how to scale the pitch to over the range.
The second region just plays a certain file when key f2 is hit, but scaling from f#2 (which is the pitch of the file).

So you have to make up some rule to decide which velocity range is covered by which samples. However, sfz supports quite a few opcodes, most of which I do not understand, which allow a lot more control than the example above. At any rate the above is the basic idea.
Kati Maya
Established Member
Posts: 9
Joined: Sat Nov 16, 2013 7:45 am

Re: How to make SFZ files

Post by Kati Maya »

I guess I've been doing it right, just the attack/release is funky, and I haven't had a chance to really figured out how to correct that.

Here is an example...

Code: Select all

//================================================================================================
// Generated By: SFZ Instrument Maker (for Philharmonic Orchestra) Version 0.117 (beta)
// Instrument: Banjo
// Length: very-long
// Total Samples: 74
//================================================================================================




// Dynamic: piano (normal)
<group>
lovel=0
hivel=63
<region> pitch_keycenter=57 lokey=57 hikey=57 sample=/Instruments/Banjo/piano/A3.wav
<region> pitch_keycenter=69 lokey=69 hikey=69 sample=/Instruments/Banjo/piano/A4.wav
<region> pitch_keycenter=81 lokey=81 hikey=81 sample=/Instruments/Banjo/piano/A5.wav
<region> pitch_keycenter=58 lokey=58 hikey=58 sample=/Instruments/Banjo/piano/A#3.wav
<region> pitch_keycenter=70 lokey=70 hikey=70 sample=/Instruments/Banjo/piano/A#4.wav
<region> pitch_keycenter=82 lokey=82 hikey=82 sample=/Instruments/Banjo/piano/A#5.wav
<region> pitch_keycenter=59 lokey=59 hikey=59 sample=/Instruments/Banjo/piano/B3.wav
<region> pitch_keycenter=71 lokey=71 hikey=71 sample=/Instruments/Banjo/piano/B4.wav
<region> pitch_keycenter=83 lokey=83 hikey=83 sample=/Instruments/Banjo/piano/B5.wav
<region> pitch_keycenter=48 lokey=48 hikey=48 sample=/Instruments/Banjo/piano/C3.wav
<region> pitch_keycenter=60 lokey=60 hikey=60 sample=/Instruments/Banjo/piano/C4.wav
<region> pitch_keycenter=72 lokey=72 hikey=72 sample=/Instruments/Banjo/piano/C5.wav
<region> pitch_keycenter=49 lokey=49 hikey=49 sample=/Instruments/Banjo/piano/C#3.wav
<region> pitch_keycenter=61 lokey=61 hikey=61 sample=/Instruments/Banjo/piano/C#4.wav
<region> pitch_keycenter=50 lokey=50 hikey=50 sample=/Instruments/Banjo/piano/D3.wav
<region> pitch_keycenter=62 lokey=62 hikey=62 sample=/Instruments/Banjo/piano/D4.wav
<region> pitch_keycenter=74 lokey=74 hikey=74 sample=/Instruments/Banjo/piano/D5.wav
<region> pitch_keycenter=51 lokey=51 hikey=51 sample=/Instruments/Banjo/piano/D#3.wav
<region> pitch_keycenter=63 lokey=63 hikey=63 sample=/Instruments/Banjo/piano/D#4.wav
<region> pitch_keycenter=75 lokey=75 hikey=75 sample=/Instruments/Banjo/piano/D#5.wav
<region> pitch_keycenter=52 lokey=52 hikey=52 sample=/Instruments/Banjo/piano/E3.wav
<region> pitch_keycenter=64 lokey=64 hikey=64 sample=/Instruments/Banjo/piano/E4.wav
<region> pitch_keycenter=76 lokey=76 hikey=76 sample=/Instruments/Banjo/piano/E5.wav
<region> pitch_keycenter=53 lokey=53 hikey=53 sample=/Instruments/Banjo/piano/F3.wav
<region> pitch_keycenter=65 lokey=65 hikey=65 sample=/Instruments/Banjo/piano/F4.wav
<region> pitch_keycenter=77 lokey=77 hikey=77 sample=/Instruments/Banjo/piano/F5.wav
<region> pitch_keycenter=54 lokey=54 hikey=54 sample=/Instruments/Banjo/piano/F#3.wav
<region> pitch_keycenter=66 lokey=66 hikey=66 sample=/Instruments/Banjo/piano/F#4.wav
<region> pitch_keycenter=78 lokey=78 hikey=78 sample=/Instruments/Banjo/piano/F#5.wav
<region> pitch_keycenter=55 lokey=55 hikey=55 sample=/Instruments/Banjo/piano/G3.wav
<region> pitch_keycenter=67 lokey=67 hikey=67 sample=/Instruments/Banjo/piano/G4.wav
<region> pitch_keycenter=79 lokey=79 hikey=79 sample=/Instruments/Banjo/piano/G5.wav
<region> pitch_keycenter=56 lokey=56 hikey=56 sample=/Instruments/Banjo/piano/G#3.wav
<region> pitch_keycenter=68 lokey=68 hikey=68 sample=/Instruments/Banjo/piano/G#4.wav
<region> pitch_keycenter=80 lokey=80 hikey=80 sample=/Instruments/Banjo/piano/G#5.wav


// Dynamic: forte (normal)
<group>
lovel=64
hivel=127
<region> pitch_keycenter=57 lokey=57 hikey=57 sample=/Instruments/Banjo/forte/A3.wav
<region> pitch_keycenter=69 lokey=69 hikey=69 sample=/Instruments/Banjo/forte/A4.wav
<region> pitch_keycenter=81 lokey=81 hikey=81 sample=/Instruments/Banjo/forte/A5.wav
<region> pitch_keycenter=58 lokey=58 hikey=58 sample=/Instruments/Banjo/forte/A#3.wav
<region> pitch_keycenter=70 lokey=70 hikey=70 sample=/Instruments/Banjo/forte/A#4.wav
<region> pitch_keycenter=82 lokey=82 hikey=82 sample=/Instruments/Banjo/forte/A#5.wav
<region> pitch_keycenter=59 lokey=59 hikey=59 sample=/Instruments/Banjo/forte/B3.wav
<region> pitch_keycenter=71 lokey=71 hikey=71 sample=/Instruments/Banjo/forte/B4.wav
<region> pitch_keycenter=83 lokey=83 hikey=83 sample=/Instruments/Banjo/forte/B5.wav
<region> pitch_keycenter=48 lokey=48 hikey=48 sample=/Instruments/Banjo/forte/C3.wav
<region> pitch_keycenter=60 lokey=60 hikey=60 sample=/Instruments/Banjo/forte/C4.wav
<region> pitch_keycenter=72 lokey=72 hikey=72 sample=/Instruments/Banjo/forte/C5.wav
<region> pitch_keycenter=84 lokey=84 hikey=84 sample=/Instruments/Banjo/forte/C6.wav
<region> pitch_keycenter=49 lokey=49 hikey=49 sample=/Instruments/Banjo/forte/C#3.wav
<region> pitch_keycenter=61 lokey=61 hikey=61 sample=/Instruments/Banjo/forte/C#4.wav
<region> pitch_keycenter=73 lokey=73 hikey=73 sample=/Instruments/Banjo/forte/C#5.wav
<region> pitch_keycenter=85 lokey=85 hikey=85 sample=/Instruments/Banjo/forte/C#6.wav
<region> pitch_keycenter=50 lokey=50 hikey=50 sample=/Instruments/Banjo/forte/D3.wav
<region> pitch_keycenter=62 lokey=62 hikey=62 sample=/Instruments/Banjo/forte/D4.wav
<region> pitch_keycenter=74 lokey=74 hikey=74 sample=/Instruments/Banjo/forte/D5.wav
<region> pitch_keycenter=86 lokey=86 hikey=86 sample=/Instruments/Banjo/forte/D6.wav
<region> pitch_keycenter=51 lokey=51 hikey=51 sample=/Instruments/Banjo/forte/D#3.wav
<region> pitch_keycenter=63 lokey=63 hikey=63 sample=/Instruments/Banjo/forte/D#4.wav
<region> pitch_keycenter=75 lokey=75 hikey=75 sample=/Instruments/Banjo/forte/D#5.wav
<region> pitch_keycenter=87 lokey=87 hikey=87 sample=/Instruments/Banjo/forte/D#6.wav
<region> pitch_keycenter=52 lokey=52 hikey=52 sample=/Instruments/Banjo/forte/E3.wav
<region> pitch_keycenter=64 lokey=64 hikey=64 sample=/Instruments/Banjo/forte/E4.wav
<region> pitch_keycenter=76 lokey=76 hikey=76 sample=/Instruments/Banjo/forte/E5.wav
<region> pitch_keycenter=88 lokey=88 hikey=88 sample=/Instruments/Banjo/forte/E6.wav
<region> pitch_keycenter=53 lokey=53 hikey=53 sample=/Instruments/Banjo/forte/F3.wav
<region> pitch_keycenter=65 lokey=65 hikey=65 sample=/Instruments/Banjo/forte/F4.wav
<region> pitch_keycenter=77 lokey=77 hikey=77 sample=/Instruments/Banjo/forte/F5.wav
<region> pitch_keycenter=54 lokey=54 hikey=54 sample=/Instruments/Banjo/forte/F#3.wav
<region> pitch_keycenter=66 lokey=66 hikey=66 sample=/Instruments/Banjo/forte/F#4.wav
<region> pitch_keycenter=78 lokey=78 hikey=78 sample=/Instruments/Banjo/forte/F#5.wav
<region> pitch_keycenter=55 lokey=55 hikey=55 sample=/Instruments/Banjo/forte/G3.wav
<region> pitch_keycenter=79 lokey=79 hikey=79 sample=/Instruments/Banjo/forte/G5.wav
<region> pitch_keycenter=56 lokey=56 hikey=56 sample=/Instruments/Banjo/forte/G#3.wav
<region> pitch_keycenter=68 lokey=68 hikey=68 sample=/Instruments/Banjo/forte/G#4.wav
User avatar
AnthonyCFox
Established Member
Posts: 393
Joined: Mon Apr 22, 2013 3:50 pm
Been thanked: 1 time

Re: How to make SFZ files

Post by AnthonyCFox »

Maybe you've seen this, but the Amplifier EG section of the opcode list http://www.cakewalk.com/DevXchange/article.aspx?aid=108 has codes for attack, sustain, release, etc.

It's great you're doing this, good luck.
War, crime, disease, starvation, extreme poverty; these are serious things.
Music? Not so serious. Have some fun! :D
Kati Maya
Established Member
Posts: 9
Joined: Sat Nov 16, 2013 7:45 am

Re: How to make SFZ files

Post by Kati Maya »

AnthonyCFox wrote:It's great you're doing this, good luck.
Hey thanks, I have been going thru that. I'm going to publish the first version of the app on kvr audio hopefully today, however I probably won't post it here since it's windows-based at the moment, and I haven't figured out a good cross-platform solution yet, although I'm thinking Qt Creator would work well. But hopefully by posting everything there I can get enough feedback to figure this out, and get it working on linux too.
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: How to make SFZ files

Post by Capoeira »

antiesen
Established Member
Posts: 165
Joined: Sat Aug 27, 2011 3:36 pm

Re: How to make SFZ files

Post by antiesen »

:wink: seven years later
This was made to end all partys - Einstürzende Neubauten 1985
User avatar
Capoeira
Established Member
Posts: 1321
Joined: Tue May 12, 2009 1:01 pm
Location: Brazil
Has thanked: 3 times
Been thanked: 2 times

Re: How to make SFZ files

Post by Capoeira »

antiesen wrote::wink: seven years later
I'm contribuiting to a better world lol
This pops up in google if you search for it.
Though Polyphone only seams to create sf2 though, it works nice
tavasti
Established Member
Posts: 2047
Joined: Tue Feb 16, 2016 6:56 am
Location: Kangasala, Finland
Has thanked: 369 times
Been thanked: 208 times
Contact:

Re: How to make SFZ files

Post by tavasti »

Capoeira wrote:
antiesen wrote::wink: seven years later
I'm contribuiting to a better world lol
This pops up in google if you search for it.
Though Polyphone only seams to create sf2 though, it works nice
Doesn't polyphone create also sfz nowdays?

Linux veteran & Novice musician

Latest track: https://www.youtube.com/watch?v=ycVrgGtrBmM

Post Reply