SFZ format documentation

Sampler and Sampling discussion (techniques, tips and tricks, etc.)
RELATED
PRODUCTS
Bjoerns Sample Mapper

Post

Perfect! That's exactly the kinds of things I want to know! Thank you!

Edit: The SFZFormat documentation says that the loop_crossfade opcode is not used much. For maximum compatibility, it it best to alter the sample to have good loop points like suggested here:

https://www.frontiersoundfx.com/how-to- ... udio-file/

Or is there a easier way, using a different opcode?
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

Best way is, indeed, to prebake the crossfade into the sample, especially if you're after compatibility. I know sforzando doesn't implement loop_crossfade, and that's probably the most widely used sfz player.

Post

Thank you so much for your help, DSmolken!!!!

One last question............for now. :) Do I actually need to assign a default path? If I want to have my samples located in a folder next to my sfz file, doesn't the player look for a folder of the same name in the directory by default?

For example:

my_pad_1.sfz
my_pad_1 <-------folder
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

You don't need a default path, no. You can just make the path using whatever folder the SFZ is in as a starting point... so something like sample=my_pad_1/my_pad_1_c4.wav in your example.

Post

Thank you again so much!! You have been so very helpful! :)
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

Windows and Linux use different syntax for their file structures. Windows uses a backward slash \ to designate child directories and Linux uses a forward slash / for child directories. It seems to me that the relative file path, in an sfz file will similarly have a different format, depending upon whether the file is hosted in a Linux or Windows environment.

How does everyone keep the relativepath in their sfz files compatible with both Windows and Linux when creating SFZ files?

An example might be:
Windows: .\sfz\tuba\
Linux: ./sfz/tuba/

How do I make my sfz files as compatible with both oses as possible?
Last edited by audiojunkie on Wed Jul 27, 2022 5:50 pm, edited 1 time in total.
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

In practice, use forward slashes - newer versions of Windows accept those.

Post

Thank you again! :)
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

BTW, how does this look as a generic sfz file?

//===========================================================================
//
// Instrument Name:
//
//===========================================================================
//
// Description:
//
//===========================================================================
//
// Credits:
//
//===========================================================================


<control>
// Default_path is the relative default path under which the samples should be found.
// Example: For an instrument named violin_sustain, use: default__path=./violin_sustain/
// In this example, the sfz instrument will look for the samples in a folder named
// a that should be located in the same folder where the violin_sustain.sfz
// is located.

default_path=

//===========================================================================

<global>
// Trigger Range: attack, release, first, legato, release_key
// Default: attack -- Region plays on note-on

trigger=

// Loop_mode Range: no_loop, one_shot, loop_continuous, loop_sustain
// Defaults: no_loop -- For samples without a loop defined
// and loop_continuous -- For samples with defined loops

loop_mode=

// ADSR Envelope settings. Type: Floating point. Range: 0 to 100 Seconds
// Example: ampeg_attack=0.5 Assigns a .5 second attack to the samples in this
// instrument.

ampeg_attack= ampeg_decay= ampeg_sustain= ampeg_release=

//===========================================================================

<group>
// lovel= and hivel= sets the velocity range for this group of samples
// If a note with velocity value equal to or higher than lovel AND equal to or lower
// than hivel is played, the region will play. Velocity Range is 1 to 127
// Example: lovel=60 hivel=127

lovel= hivel=

//============================================================================

// Sampling C#, E, G, A# per octave for 5 octaves
//
<region> // 1
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 2
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 3
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 4
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 5
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 6
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 7
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 8
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 9
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 10
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 11
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 12
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 13
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 14
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 15
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 16
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 17
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 18
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 19
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=
<region> // 20
sample= loop_start= loop_end= pitch_keycenter= lokey= hikey=

//===========================================================================
// If more velocity groups are needed, repeat the group and regions sections as needed
// adding in the new information for the new velocity group.
//===========================================================================
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

Yes, that looks pretty good. :tu:

What strikes me: Under <region> you always have "loop_start" and
"loop_end" for each sample. I wouldn't define that in the sfz file
like you do here. Instead I would define the loop area in the WAV
file. Each sfz player then automatically(!) takes this loop area.

The advantage is: The sfz definitions are even clearer - and the
loop areas are located where they belong: with the WAV files
themselves.
free mp3s + info: andy-enroe.de songs + weird stuff: enroe.de

Post

enroe wrote: Wed Jul 27, 2022 6:17 pm Yes, that looks pretty good. :tu:

What strikes me: Under <region> you always have "loop_start" and
"loop_end" for each sample. I wouldn't define that in the sfz file
like you do here. Instead I would define the loop area in the WAV
file. Each sfz player then automatically(!) takes this loop area.

The advantage is: The sfz definitions are even clearer - and the
loop areas are located where they belong: with the WAV files
themselves.
Maybe I'm wrong, but my understanding was that not all SFZ instrument players can read the loop metadata in the loop file. Maybe I'm incorrect about that?

I'm trying to set up a complete basic generic template that anyone can use for a pitched instruments regardless of the SFZ player they use and regardless of what platform it is being run on. I'm seeking maximum compatibility.

Maybe I'm mistaken? :(

Edit: My intended target SFZ players (opcode compatibility): Linuxsampler, Sfizz, liquidsfz,
// SFZero, and Sforzando. Do all of these read the loop metadata from the wav file? If so, maybe I don't need to worry about it. :-)
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

OK, hopefully this is all fixed. Please let me know of anything that needs to be added or removed to maintain normal functionality in a basic SFZ instrument. Thanks!



//=======================================================================
// This is a generic sfz pitched instrument template
// designed for 20 samples per velocity layer
// (The intention is to sample 4 notes per octave
// for 5 octaves).
// The purpose is to make an easy "fill in the blank"
// template .SFZ file for easily creating pitched
// instruments in the SFZ format.
//=======================================================================
// Intended target SFZ players (opcode compatibility): Linuxsampler,
// Sfizz, liquidsfz, SFZero, and Sforzando
//=======================================================================

//=======================================================================
//
// Instrument Name:
//
//=======================================================================
//
// Description:
//
//=======================================================================
//
// Credits:
//
//=======================================================================


<control>
// Default_path is the relative default path under which the samples
// should be found. Example: For an instrument named violin_sustain,
// use: default_path=./violin_sustain/ In this example, the sfz
// instrument will look for the samples in a folder named
// a that should be located in the same folder where the
// violin_sustain.sfz is located.

default_path=

//=======================================================================

<global>
// Trigger Range: attack, release, first, legato, release_key
// Default: attack -- Region plays on note-on

trigger=

// Loop_mode Range: no_loop, one_shot, loop_continuous, loop_sustain
// Defaults: no_loop -- For samples without a loop defined
// and loop_continuous -- For samples with defined loops
// The loops start and end data is usually pulled from the sample
// metadata built into the sample, but can also be manually assigned
// with the loop_start= and loop_end= opcodes, measured in how many
// samples to the loop point.

loop_mode=

// ADSR Envelope settings. Type: Floating point. Range: 0 to 100 Seconds
// Example: ampeg_attack=0.5 Assigns a .5 second attack to the samples
// in this instrument.

ampeg_attack= ampeg_decay= ampeg_sustain= ampeg_release=

//========================================================================

<group>
// lovel= and hivel= sets the velocity range for this group of samples
// If a note with velocity value equal to or higher than lovel AND equal
// to or lower than hivel is played, the region will play. Velocity
// Range is 1 to 127
// Example: lovel=60 hivel=127

lovel= hivel=

//========================================================================

// Sampling C#, E, G, A# per octave for 5 octaves
//
<region> // 1
sample= pitch_keycenter= lokey= hikey=
<region> // 2
sample= pitch_keycenter= lokey= hikey=
<region> // 3
sample= pitch_keycenter= lokey= hikey=
<region> // 4
sample= pitch_keycenter= lokey= hikey=
<region> // 5
sample= pitch_keycenter= lokey= hikey=
<region> // 6
sample= pitch_keycenter= lokey= hikey=
<region> // 7
sample= pitch_keycenter= lokey= hikey=
<region> // 8
sample= pitch_keycenter= lokey= hikey=
<region> // 9
sample= pitch_keycenter= lokey= hikey=
<region> // 10
sample= pitch_keycenter= lokey= hikey=
<region> // 11
sample= pitch_keycenter= lokey= hikey=
<region> // 12
sample= pitch_keycenter= lokey= hikey=
<region> // 13
sample= pitch_keycenter= lokey= hikey=
<region> // 14
sample= pitch_keycenter= lokey= hikey=
<region> // 15
sample= pitch_keycenter= lokey= hikey=
<region> // 16
sample= pitch_keycenter= lokey= hikey=
<region> // 17
sample= pitch_keycenter= lokey= hikey=
<region> // 18
sample= pitch_keycenter= lokey= hikey=
<region> // 19
sample= pitch_keycenter= lokey= hikey=
<region> // 20
sample= pitch_keycenter= lokey= hikey=

//=======================================================================
// If more velocity groups are needed, repeat the group and regions
// sections as needed adding in the new information for the new velocity
// group.
//=======================================================================
Last edited by audiojunkie on Thu Jul 28, 2022 5:45 pm, edited 2 times in total.
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

My goal is that anyone should be able to copy & paste the above generic pitched instrument SFZ template and be able to easily make SFZ instruments.
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post

Yes, as far as I can see this is a good template! :tu:

We could maybe even put it on "sfzformat.com" as a second
template (there is already a first template there). :wink:
free mp3s + info: andy-enroe.de songs + weird stuff: enroe.de

Post

You have my absolute permission to to add the template to sfzformat.com!! I finally have something to give back to the community!! :) Make it whatever license you think is best for everyone's future use so that it can be edited, corrected, or improved. Do you need me to email a copy to you, or will a copy/paste from the post above work?
Last edited by audiojunkie on Thu Jul 28, 2022 5:47 pm, edited 1 time in total.
C/R, dongles & other intrusive copy protection equals less-control & more-hassle for consumers. Company gone-can’t authorize. Limit to # of auths. Instability-ie PACE. Forced internet auths. THE HONEST ARE HASSLED, NOT THE PIRATES.

Post Reply

Return to “Samplers, Sampling & Sample Libraries”