Scoring Central

Full Version: SFZ: MW XF between layers?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
One of the most frustrating things about the SFZ format is that it's poorly documented. I really don't understand where people who are doing advanced things with SFZ get their information from. Weeks and months of trial and error, or is there some comprehensive SFZ resource around that I've somehow managed to miss?

Anyway, I'm trying to set up a patch that crossfades between layers using the mod wheel. From what I've gathered this should be possible but I haven't been able to find any examples of how it's done. Could someone pretty please with sugar on top point me to some instrument that uses this feature?
I've been thinking about this issue for a few months too. I want to add it to the auto-mapper, but I haven't yet figured out what the optimal settings for distribution are...

The devXchange is probably the most comprehensive resource that is left- Cakewalk purged a ton of pages from their site so they are now only accessible via wayback machine-
https://web.archive.org/web/200903190010...ge/sfz.asp

The way I view it, the first step is you have to map the two samples overlapping. I haven't had time to figure out if it's best at 25%, 50%, 75%, 100% overlap, but I guess start maybe 50% (like with two, the lower goes 0-95 and the upper goes 31-127 or something).

This is hypothetical, I've never done it before, but this is how I think it works. If you try it out, let me know how it works! Big Grin

Then you need two opcodes to make things work-
Quote:xfin_loccN
xfin_hiccN


Fade in control.

xfin_loccN and xfin_hiccN set the range of values in the MIDI continuous controller N which will perform a fade-in in the region.

The volume of the region will be zero for values of the MIDI continuous controller N lower than or equal to xfin_loccN, and maximum (as defined by the volume opcode) for values greater than or equal to xfin_hiccN.


Examples:
xfin_locc1=64 xfin_hicc1=127

and
Quote:xfout_loccN
xfout_hiccN


Fade out control.

xfout_loccN and xfout_hiccN set the range of values in the MIDI continuous controller N which will perform a fade-out in the region.

The volume of the region will be maximum (as defined by thevolume opcode) for values of the MIDI continuous controller N lower than or equal to xfout_loccN, and zero for values greater than or equal to xfout_hiccN.


Examples:
xfout_locc1=64 xfout_hicc1=127

(you can also use xfin_lovel & hivel & xfout_lovel & hivel if you wanted to do a velocity crossfade, such as on a piano or percussion instrument)

So you would give your higher sample an xfin_locc of 31 and hicc of 95, and the lower an xfout_locc of 31 and hicc of 95, as far as I can tell.

The 'N' is where you put the controller (1, 7, 11, etc.), so it would be xfin_locc1=31 and xfin_hicc1=95 for the first.

You also may want to set this-
Quote:xf_cccurve
MIDI controllers crossfade curve for the region. Values can be:

gain: Linear gain crossfade. This setting is best when crossfading phase-aligned material. Linear gain crossfades keep constant amplitude during the crossfade, preventing clipping.
power: Equal-power RMS crossfade. This setting works better to mix very different material, as a constant power level is kept during the crossfade.

I guess power is more useful if working with non-phase aligned samples, but gain is better for phase-aligned samples. You just type either gain or power (e.g. xf_cccurve=gain)

If you were to want three layers crossfaded, then you need to put xfout on the low one, both xfin and xfout on the second, and xfin on the third. If you wanted at this point to map it linearly with a little space around each one, then you would do the first one up to 54, the second down to 9 and up to say, 117, and the third down to 74, for example.

In theory, it would look like:
<region> //quiet sample
...
xfout_locc1=9
xfout_hicc1=54

<region> //medium sample
...
xfin_locc1=9
xfin_hicc1=54
xfout_locc1=74
xfout_hicc1=117

<region> //loud sample
...
xfin_locc1=74
xfin_hicc1=117


To do this with key-velocity, just change 'cc1' to 'vel'.

You can also do this with key ranges, which was a more common feature back in the 90's when samples were further apart. For that you use xfout_lokey/hikey and xfin_lokey/hikey, with key ranges being used instead (so if you have a note at 60 and a note at 68, you can use this to smooth over the transitions.

As far as I know, all three can be used simultaneously, haha, although maybe just modwheel xfade and key xfade together would be plenty.
THANK YOU! I have a vague memory of seeing this documented at some point, but I couldn't for the life of me find the resource. That cakewalk had removed it might indeed explain why. I found some listings of the relevant opcodes but no examples of how they're supposed to be used.

Well, this looks manageable enough. I've been creating a lot of XF patches in TX16Wx for moving between dynamic layers, and I wanted to give it a shot with SFZ as well.

Again, thanks!
The one thing I haven't figured out is what happens to key velocity... there has to be an opcode to remap key velocity to something else (maybe inverse attack time to allow flexible phrasing?) and map modwheel to do what key velocity typically does (you probably don't want both working at the same time, I guess... unless it does it automatically). I'll keep lookin' through the opcodes, haha. Let me know if you figure anything out on your end! I hope this works.
(08-03-2016, 12:47 PM)Mattias Westlund Wrote: [ -> ]is there some comprehensive SFZ resource around that I've somehow managed to miss?

Apparently, there is no significant online documentation for SFZ 2.0 (if that's what you are seeking). I keep reading that it can only be found here:

Official SFZ 2.0 specification in chapter 13 and Appendix of the book “Cakewalk Synthesizers: From Presets to Power User – 2nd Edition” by Simon Cann.
(08-03-2016, 11:41 PM)pbattersby Wrote: [ -> ]Apparently, there is no significant online documentation for SFZ 2.0 (if that's what you are seeking). I keep reading that it can only be found here:

Official SFZ 2.0 specification in chapter 13 and Appendix of the book “Cakewalk Synthesizers: From Presets to Power User – 2nd Edition” by Simon Cann.

Well that sucks Sad

Anyone up for grabbing all the details from the Wayback Machine and providing them as a free resource?
(08-04-2016, 12:07 AM)Mattias Westlund Wrote: [ -> ]Anyone up for grabbing all the details from the Wayback Machine and providing them as a free resource?

I don't know how much it helps but about a week and a half ago  I wrote a blog post with links to the SFZ resources I've been using here:

sfz soundfont building resources
I think there are a bunch of little tips hidden around the ARIA forum section for sfz programming. Perhaps if I have some time I'll strain through all of that and try to put it in a coherent document. I've tracked down as much of the original documentation as I can, but Paul pretty much got everything there.

The only one not on his list is the LinuxSampler SFZ reference doc-
https://docs.google.com/document/d/1UxPa...E6xino/pub
note- crossed out means 'not implemented in linux sampler', not 'deprecated'.
I don't know if this helps, especially this late but I just found this:

https://books.google.ca/books?id=rspvCgA...&q&f=false

It's a google preview of the book "Cakewalk Synthesizers: From Presets to Power User"

Specifically a section on cross fading.

I want to implement an automatic cross face between velocity layers so that the 2 velocity layers overlap, gradually transitioning from the low volume sample to the high volume sample.

I think the way to do that is as follows, assuming I want the mid point of the fade to be at a velocity of 64

use this on the high samples

xfin_lovel=44
xfin_hivel=84

use this on the low samples

xfout_lovel=44
xfout_hivel=84

This means that the low samples will be begin fading out between volumes 44 and 84 and the high samples will begin fading in between 44 and 84
This subject got my interest lately and I begun to looking for information and I have been testing various configurations. My goal is to build an ensemble string patch with the dynamics controlled by the modwheel. So here is my progress so far!

First, I create groups of each layer of dynamics and have them triggered simultaneously.

Then I add amp_veltrack=0 in order for the velocity to not have any effect on the amplitude of the sample.


In order to morph between the layers with the modwheel I utilize the xfin & xfout opcodes and decide where I want the samples to blend. So in my case I have 3 layers and I want them to crossfade at 2 middle points.

For the low dynamics group:
xfout_locc1=30
xfout_hicc1=50


for the medium dynamics group:
xfin_locc1=30
xfin_hicc1=50
xfout_locc1=70
xfout_hicc1=90


and for the high dynamics group:
xfin_locc1=70

xfin_hicc1=90

Now I can play the patch and indeed have the sound morph from low to high dynamics with the modwheel. However, I also need the volume to change.

So I use the opcode amplitude_oncc1=100.

And when I hit save on the text sforzando crashes. Big Grin  I am not sure but it might have something to do with opcodes amplitude and xf sharing cc1 because when I disable one of them it works fine.

It also works if I assign different CCs to the opcodes, ex. CC1 for xf and CC2 for amplitude. But then I have to somehow bind the modwheel to these 2 CCs and I don't know if I can do this to sfz level.

Or maybe it is something that has to do only with sforzando.
Pages: 1 2