Alby M.
2015-12-15 21:11:44 UTC
(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
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