Discussion:
[Linuxsampler-devel] SFZ 2.0 Headers and Macros Patch
Alby M.
2015-12-15 21:11:44 UTC
Permalink
(Note: I sent this into the list once before, but it got caught up in some
strange moderation review queue because of the size of the attachments. If
a second version of this shows up at some point, sorry!)

Hi All,

I've been planning on using LinuxSampler for some music production
projects, and discovered that support for some simple features (not audio
synthesis related) of the SFZ format was missing. Specifically, support for
the SFZ 2.0 headers (`<global>`, and the ARIA specific `<master>`) and
`#define`d macros was lacking, so I've put together a small patch to
"libsfz" (sfz.cpp and sfz.h).

`<master>` is docuemnted here:
http://plogue.com/phpBB3/viewtopic.php?f=14&t=4389&sid=7b41e5de2121982e95e5781cebd7a77e

I couldn't find any actual documentation of the SFZ format's parsing rules,
so this whole thing is based on some assumptions I made that seemed
reasonable:
- Each header lasts until the next header of equal or higher level. E.g.,
a <master> lasts until the next <master> or <global>.
- Multiple <global>s are fine. It was easier not to add any special
cases, and it's not like this would brake anything that just uses one
<global>.
- Macro names must start with `$`, and can contain alphanumerics and
underscores.
- Macro values can contain alphanumerics, spaces, underscores, periods,
and forward and backward slashes. I'm not quite sure, but this seemed
sensible. If not, it's always possible for the macro value to be anything
until end of line, but that seemed like it might throw the rest of the
parsing code too much.
- Macros can be used anywhere in an opcode value, and can be used for CCs
in `cc` and `_oncc` opcodes.
- Multiple macros can occur in one opcode value.
- When used in a value, a macro's name is assumed to go from (and
including) the `$` to the first character that is invalid in a macro name.
For example, in `default_path=$sample_dir/Drums`, the macro name is assumed
to be `$sample_dir`.

I did the best I could to follow the coding conventions of libsfz (braces
on next line, space before parens, etc.).

The mailing list is having trouble with the size of the patch (~35kB), so
here it is in my Dropbox:
https://www.dropbox.com/s/2ksct5d0h1s3lxy/headers-macros-patch.patch?dl=0

If you just want the new `sfz.cpp` and `sfz.h`, I can send those too.

You can also test this using the Free Sounds for ARIA Engine pack (
http://ariaengine.com/forums/index.php?p=/discussion/5783/free-sounds-for-aria-engine/p1).
You have to add something like `#define $sample_dir ../../Samples` though.
The ones that use mostly supported features seem to work pretty well, and
these are some of the most complex SFZs I've seen.

Thanks for all of your work on LinuxSampler!

Sincerely,
Alby
Christian Schoenebeck
2015-12-17 12:11:32 UTC
Permalink
Post by Alby M.
The mailing list is having trouble with the size of the patch (~35kB), so
https://www.dropbox.com/s/2ksct5d0h1s3lxy/headers-macros-patch.patch?dl=0
If you just want the new `sfz.cpp` and `sfz.h`, I can send those too.
Hi Alby,

I am currently on the road. I will check your patch when I am back in about a
week.

If anybody else got the chance to check and apply Alby's patch to SVN in the
meantime, very much appreciated!

CU
Christian

------------------------------------------------------------------------------
Alby M.
2015-12-18 06:46:02 UTC
Permalink
Hi Christian,

Great! Looking forward to hearing from you.

- Alby

On Thu, Dec 17, 2015 at 5:55 AM Christian Schoenebeck <
Post by Alby M.
Post by Alby M.
The mailing list is having trouble with the size of the patch (~35kB), so
https://www.dropbox.com/s/2ksct5d0h1s3lxy/headers-macros-patch.patch?dl=0
Post by Alby M.
If you just want the new `sfz.cpp` and `sfz.h`, I can send those too.
Hi Alby,
I am currently on the road. I will check your patch when I am back in about a
week.
If anybody else got the chance to check and apply Alby's patch to SVN in the
meantime, very much appreciated!
CU
Christian
Andreas Persson
2016-01-06 10:04:09 UTC
Permalink
Post by Alby M.
Hi Christian,
Great! Looking forward to hearing from you.
- Alby
Hello! I've reviewed the patch and committed it to svn. Nice work! Sorry
for taking so long.

/Andreas
Post by Alby M.
On Thu, Dec 17, 2015 at 5:55 AM Christian Schoenebeck
Post by Alby M.
The mailing list is having trouble with the size of the patch
(~35kB), so
https://www.dropbox.com/s/2ksct5d0h1s3lxy/headers-macros-patch.patch?dl=0
Post by Alby M.
If you just want the new `sfz.cpp` and `sfz.h`, I can send those too.
Hi Alby,
I am currently on the road. I will check your patch when I am back in about a
week.
If anybody else got the chance to check and apply Alby's patch to SVN in the
meantime, very much appreciated!
CU
Christian
------------------------------------------------------------------------------
_______________________________________________
Linuxsampler-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
------------------------------------------------------------------------------
Alby M.
2016-01-06 16:16:01 UTC
Permalink
Hi Andreas,

Great!

Thanks for all your work on LinuxSampler.

- Alby M.
Post by Andreas Persson
Post by Alby M.
Hi Christian,
Great! Looking forward to hearing from you.
- Alby
Hello! I've reviewed the patch and committed it to svn. Nice work! Sorry
for taking so long.
/Andreas
Post by Alby M.
On Thu, Dec 17, 2015 at 5:55 AM Christian Schoenebeck
Post by Alby M.
The mailing list is having trouble with the size of the patch
(~35kB), so
https://www.dropbox.com/s/2ksct5d0h1s3lxy/headers-macros-patch.patch?dl=0
Post by Alby M.
Post by Alby M.
If you just want the new `sfz.cpp` and `sfz.h`, I can send those
too.
Post by Alby M.
Hi Alby,
I am currently on the road. I will check your patch when I am back in about a
week.
If anybody else got the chance to check and apply Alby's patch to SVN in the
meantime, very much appreciated!
CU
Christian
------------------------------------------------------------------------------
Post by Alby M.
_______________________________________________
Linuxsampler-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
------------------------------------------------------------------------------
_______________________________________________
Linuxsampler-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel
Loading...