# Sfzformat - documenting SFZ and how to use it



## DSmolken (Sep 5, 2018)

For a couple of months now, I've been documenting the sfzformat.com wiki with information on all the listed opcodes, and also added a couple of guides on mapping basic drums and sustained instruments. I've collected the information published in other places, documented SFZ 2 and ARIA extensions opcodes, and tried to make the explanations and examples more meaningful to musicians instead of being dry and programmerly and forcing the reader to figure out what something might actually be useful for.

I'm gonna keep this going, planning to document the modeling I've done for things like vibrato, snare drum stirs, guitar feedback, Peter Jones' hierarchical hi-hat muting scheme etc. which should contain a lot of information that's applicable cross-format too.

So, if anybody would like to give making SFZ instruments a try, there's now one site that should document all the opcodes and hopefully serve as a one-stop information store. If any info's still missing, do let me know.


----------



## David Cuny (Nov 16, 2018)

The resource looks nice, thanks! 

Do you know if there any public information available for creating a GUI for Aria instruments? Based on this enhanced Aria skin for the EWI I've got a pretty good idea of how to create a GUI using XML. But I'm not sure what the XML file should be called (*my_instrument.xml*, perhaps), or how the *param* and *slot* parameters might interact with the SFZ parameters.

For my purposes, that's overkill anyway. I'm mostly interested in being able to show which MIDI keys work as keyswitches.

Any clue how to do that?


----------



## DSmolken (Nov 17, 2018)

The GUIs, that's not public, and the main XML for each instrument bank needs to be digitally signed by Plogue, but they'll do that for free for non-commercial instruments which are half-decent. You can contact them if you want the documentation and example files.

For keyswitches, though, sw_low, sw_high and sw_label are the opcodes.


----------



## David Cuny (Nov 17, 2018)

DSmolken said:


> The GUIs, that's not public, and the main XML for each instrument bank needs to be digitally signed by Plogue, but they'll do that for free for non-commercial instruments which are half-decent. You can contact them if you want the documentation and example files.
> 
> For keyswitches, though, sw_low, sw_high and sw_label are the opcodes.


Thanks!


----------



## DSmolken (Dec 14, 2018)

I have documented hierarchical hi-hat muting and limiting cymbal polyphony. It's pretty long and dense reading, but I go through simpler cases at first, so you don't have to implement everything at once. The principles will mostly apply to any sampler, not just ones that use SFZ.

Here's the article:






Cymbal muting - SFZ Format







sfzformat.com





Edit: fixed the splash muting rules, so now it mutes everything else, too.


----------



## DSmolken (Feb 26, 2019)

https://sfzformat.com/tutorials/legato and https://sfzformat.com/tutorials/vibrato added to the SFZformat page. Not much there yet, just the Meatbass settings for envelope legato and LFO vibrato. I'll expand those later, wiht all the stuff like different sax vibrato types, and also true sampled legato. But I figured that these, as simple as they are, are enough to be useful to people looking to do simple, basic stuff.

When it's done, the vibrato page is probably gonna be bigger and more complicated than the cymbal muting, but the simple stuff will still be simple, and I'll also add a proper explanation of what does what.


----------



## DSmolken (May 2, 2019)

Major update to the http://sfzformat.com site - moved to Github pages which are more mobile-friendly, cleaned up a whole lot of small errors in the process, and also made the LinuxSampler opcode support information a whole lot more accurate. The page repository is at https://github.com/sfzformat/sfzformat.github.io and we also have a Discord server for page update and general SFZ discussions.

Also put my open-source instruments on Github at https://github.com/sfzinstruments and will upload other developers' open-source stuff there later.


----------



## rrichard63 (May 2, 2019)

Thank you for this invaluable resource!


----------



## DSmolken (Aug 1, 2019)

Added some tutorials... the brush stirs one I mentioned in another post, which isn't really all that SFZ-specific just uses SFZ as an example, and these two explaining the modulations possible under the SFZ1 and SFZ2 specs:






SFZ1 modulations - SFZ Format







sfzformat.com










SFZ2 modulations - SFZ Format







sfzformat.com





The second includes a simple way to make sax vibrato that goes below the main note's pitch, and also using LFOs to modulate other LFOs and achieve humanization.

We could use more contributions, if somebody wants to help out. We could use someone who knows Jekyll plugins so we can reorganize the opcode info into a proper data structure and generate pages and tables from it. We could also use code examples of things we haven't posted yet. Examples of piano-specific stuff like release noises, pedal noises and half-pedaling would be great, as would true sampled legato, or a subtractive synth. I know all those things are possible but haven't really done them so I don't really have anything handy.


----------



## DSmolken (Sep 17, 2019)

And an in-depth desription of implementing vibrato, including different ways to humanize it, asymmetrical vibrato for saxes and guitars, and filter wobble.






Vibrato - SFZ Format







sfzformat.com





As usual, code examples are in SFZ, but the principles will apply anywhere. And, as this is an open-source project and hosted on Github as such, feel free to adapt this and port the code examples to Kontakt, HISE or whatever.


----------



## DSmolken (Nov 21, 2019)

Legato in SFZ explained, with simulated legato code examples by me, and true sampled legato examples by a name familiar from this forum.






Legato - SFZ Format







sfzformat.com





We got a few more active contributors recently who are working on new SFZ players of their own, so this might be slowly turning into something much bigger.


----------



## DSmolken (Feb 19, 2020)

Got a new tutorial explaining how to do typical subtractive synth filters, envelopes, vibrato, unison, and some fancy variations thereof, basically using my recent Caveman Cosmonaut freebie as the example and explaining how I've done all the modulations there. I might later add things that aren't in that particular instrument, such as series highpass and lowpass filters, separate envelope for noise oscillator etc.

https://sfzformat.com/tutorials/subtractive_synths

Also various updates here and there. Devs working on new SFZ players and editors have been doing a lot of testing of how ARIA and Dimension Pro works, so now opcodes which were just sort of vaguely documented are being documented with a lot more precision. We've also "discovered" more extended ARIA CCs 150 and above, which we need to write down. So the documentation is very much constantly growing. For example, I learned that it's possible to have multiple global headers in an instrument, which sure does make a lot of things easier...


----------



## DSmolken (Apr 4, 2020)

Got a new tutorial explaining the transposition trick, plus other ways of doing unison, including doubletracking guitars without transposition and humanizing each voice in your fake section separately.






Unison - SFZ Format







sfzformat.com





Plus lots of minor updates to incorrect opcodes, missing aliases, effects controls in the old Cakewalk synths etc. We got people working on new sfz players who really need the spec to be specified specifically, so they've done a lot of very useful testing.

Edit: added round robin neighbor borrowing at the end. Not really unison, but as someone already proceeded to use this doc as a guide to fake some RRs, I figured I might as well describe it explicitly.


----------



## davetbass (Jun 2, 2020)

Thanks so much for all these, I'm familiar with synth programing, but am trying to dig into sampled instruments and this is a great help, thanks!


----------



## DSmolken (Jun 3, 2020)

Thanks. Still making changes as people test stuff and SFZ player developers especially want things specified as much as possible. Just updated polyphony and note_polyphony today to explain how note_selfmask only applies to the latter.


----------



## DSmolken (Feb 22, 2021)

A small tutorial about something pretty basic, but covering a couple of ways to make it more complicated.






Range extension - SFZ Format







sfzformat.com


----------



## DSmolken (Aug 20, 2021)

Couple of new tutorials again.

https://sfzformat.com/tutorials/modular_instruments - SFZ-specific, how to make instruments modular and reuse chunks of SFZ instead of copy-pasting them.

https://sfzformat.com/tutorials/epic_drums - can also be adapted to other samplers, basically explains the trick of layering drums with a transposed versions of themselves for sonic embiggenment.


----------



## dore_m (Oct 17, 2021)

Hi @DSmolken. You really seem like the guy to ask this question...

I'm working on some piano libraries and have successfully implemented half-pedaling in Kontakt. Do you have any clue about how to do this in SFZ format? I'm not asking for a comprehensive how-to, just some general strategies so I can have a try. If I'm successful I'll definitely share.


----------



## DSmolken (Oct 17, 2021)

I do know Garritan CFX supposedly has half-pedaling and uses SFZ, so it seems it should be possible. But my understanding of piano-specific stuff is pretty vague. All I know is what it says under https://sfzformat.com/opcodes/sustain_lo.html, and also that you could map things (amplitude release time?) to the pedal CC if you set ampeg_dynamic=1, so the amp envelope durations will be recalculated live as the CC changes.


----------



## dore_m (Oct 17, 2021)

That is already enough to get me started.... Thanks.


----------



## DSmolken (Oct 18, 2021)

Great, if you figure it out and want to share the files, we'll be happy to turn this into a tutorial.


----------



## dore_m (Oct 19, 2021)

I have some basic partial pedaling working. I can get the release time to change according to the CC64 value, and it continuously changes using ampeg_dynamic=1 as you suggested. That's cool!

Now, I need to set three ranges, for example when CC64 is: range 0-32, normal 0.8 second release. Range 33-64, variable depending on number. Range 65-127, full sustain (or we can just set to a full 10 or 12 seconds).

Can this be done with custom curves? "locc64=33 hicc64=64" doesn't seem to filter out below 33 and above 64.


----------



## dore_m (Oct 19, 2021)

I figured it out. ampeg_release_curvecc64 and define a curve with curve_index


----------



## benwiggy (Nov 1, 2021)

DSmolken said:


> The GUIs, that's not public, and the main XML for each instrument bank needs to be digitally signed by Plogue, but they'll do that for free for non-commercial instruments which are half-decent. You can contact them if you want the documentation and example files.


Just to necro-post on this: I've modified the GPO5 instrument bank XML file, and everything seems to work. I've added extra instruments that I've created, and changed which GUI xml files the instruments are assigned.


----------



## DSmolken (Nov 1, 2021)

Interesting! Maybe the GPO ones are signed differently. I know a couple of my older freebies broke when uploaded to Github which either added or stripped out a linefeed from three older XMLs edited using some specific editor years ago... so they can be real sensitive.


----------

