LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
8k stars 993 forks source link

Is there a way to implement a .sfz file plugin? #3277

Open WrillicR opened 7 years ago

WrillicR commented 7 years ago

So far, to load .sfz files you have to download a vst and use the vst to load the .sfz file. Is there any way that somebody could make an lmms plugin for these files?

tresf commented 7 years ago

@Mark-Agent003 the more information you can offer about this file format the better. The wikipedia article helps and explains it as a text file format. https://en.wikipedia.org/wiki/Sfz_(file_format)

"SFZ is a royalty-free format and can be used by software developers for both free and commercial purposes. The SFZ Format is widely accepted as the open standard to define the behavior of a musical instrument from a bare set of sound recordings."

And then quoted from the (now dead, but cached version of the) rgc webpage:

What's sfz? sfz is a freeware high-quality multitimbral player. sfz was developed as a 'component' for rgc:audio's next synthesizer. However, we offer two versions of the raw component packed in an instrument: sfz (freeware) and sfz+ (commercial).

What can I do with it? You can play SoundFonts (.sf2 files) multitimbrally with high quality without spending any money. It can also play standard wave files (.wav) and ogg-vorbis compressed files (.ogg).

What platforms does it support? sfz can be loaded in any application capable of hosting VSTi plugins, on Microsoft Windows platforms.

What is a SoundFont? A SoundFont is a sample, instrument and performance data collection in a single file. The file format is very powerful: it allows unlimited keyboard regions, velocity switching, supports high samplerates (96k/192k) and stocking samples in a very convenient way.

What's not immediately obvious is the difference between the sfz VST instrument plugin and the sfz flat file. Any background on this would be appreciated.

tresf commented 7 years ago

... and from the KVR boards...

Cakewalk sfz and sfz+ have been abandoned for a long, long time. There are other sfz/sf2 readers which are living and very well living today: essentially Plogue Sforzando and TX16Wx. But Plogue Sforzando don't read directly the sf2 files, it converts them (automatically but heh) to the sfz format to read them.

Link is dead and I don't see it on Cakewalk's site. Is sfz officially gone?

It seems it is. I've got the free license still active, but there's no place to register new licenses.

WrillicR commented 7 years ago

I don't know a lot about them myself, but I have actually run into them more often than sf2 files.

miketurn commented 7 years ago

I think I have a little info I could share, which I hope is accurate. First off a SFZ Player would fit right in with the Soundfont Player and the GigaSampler Player as it cover all the bases of the three most common free instrument formats (SFZ, SF2 and GIG). As mentioned there are VST SFZ Players already, so it would be up to the programmers of LMMS to validate if they feel it is worth creating one or not.

I believe SFZ was created to replace SF2, offering more features and I believe greater quality. Every SFZ Instrument contains a SFZ file and samples (WAV files) The SFZ file is really just a text document that contains SFZ script language of how to control the sample files (WAV files) of the instrument, such as what midi key the samples will be linked to, etc.

The SFZ Player (usually a VST) reads the SFZ (text file) and gives you a GUI that allows you to use the samples as an instrument, often providing you with basic controls such as a master volume, ADSR envelope, etc.

I believe at the moment, SFZ is considered to be the best free instrument format, meaning that the format itself is not owned by any company (I think). The main downside to SFZ is that no one has really come up with a nice GUI based SFZ Creator, like other samplers have. There have been attempts of making SFZ Creators, mostly still in beta, but not sure if they will continue being developed. So in order to create SFZ files you have to type in a text file, how you want the samples to be handled, requiring you to learn a little SFZ coding language, depending on how in depth you want your instrument to be.

Anyways, hope this helps.

tresf commented 7 years ago

From what I read, SFZ is more of an instrument per-note preset format than an instrument bank. Do you have any SFZ downloads we can take a look at? How do they embed the actual samples?

Moth-Tolias commented 7 years ago

using samples from BpB, here is an .sfz patch that is also available at the aforementioned link:

<control>
set_cc21=0 label_cc21=Attack
set_cc22=0 label_cc22=Decay
set_cc23=127 label_cc23=Sustain
set_cc24=32 label_cc24=Release

<group>
ampeg_attackcc21=0.3
ampeg_decaycc22=5
ampeg_sustain=0
ampeg_sustaincc23=100
ampeg_releasecc24=2

<region> sample=Samples\Brutus\c1.wav
lokey=24
hikey=28
pitch_keycenter=24

<region> sample=Samples\Brutus\g#1.wav
lokey=29
hikey=34
pitch_keycenter=30

<region> sample=Samples\Brutus\c2.wav
lokey=35
hikey=40
pitch_keycenter=36

<region> sample=Samples\Brutus\g#2.wav
lokey=41
hikey=46
pitch_keycenter=42

<region> sample=Samples\Brutus\c3.wav
lokey=47
hikey=52
pitch_keycenter=48

<region> sample=Samples\Brutus\g#3.wav
lokey=53
hikey=58
pitch_keycenter=54

<region> sample=Samples\Brutus\c4.wav
lokey=59
hikey=60
pitch_keycenter=60

other .sfz patches would also be in the same folder as this file, and together they would make up the bank. i hope this clears up things for you.

i'm surprised you folks haven't heard of sfz before. i would definitely say it's the number-one format for sample-based instruments i see around the web that aren't kontakt.

if you do plan to make a builtin version, it might be worth looking at plogue's Sforzando plugin, and see how they do things; they're the industry standard for sfz and maintain the specs.

The SFZ Format is widely accepted as the open standard to define the behavior of a musical instrument from a bare set of sound recordings. Being a royalty-free format, any developer can create, use and distribute SFZ files and players for either free or commercial purposes. So when looking for flexibility and portability, SFZ is the obvious choice.

tresf commented 7 years ago

I don't see any binary data in this format.

it's the number-one format for sample-based instruments

It reads and sounds more like a common standard among multi-sample-based instruments, which we don't yet have. We'd first have to tackle an instrument version of https://github.com/LMMS/lmms/issues/1460. Chances are, we'd continue to use the existing preset format and offer an import for sfz, but I'm still not sure the value if the samples are all from a separate daw or plugin.

zonkmachine commented 6 years ago

We could maybe have an import filter and transform sfz to sf2 or gig.

tresf commented 6 years ago

@zonkmachine we'd have to hand-craft a new file from existing files to do it that way. I think #4075 is pretty close to supporting this without any crazy converting.

zonkmachine commented 6 years ago

http://polyphone-soundfonts.com/en/ https://github.com/davy7125/polyphone

From the Polyphone man page: sf2, sf3, sfz (import / export) and sfArk (import only) formats are supported. Conversions are possible via command lines.

think #4075 is pretty close to supporting this without any crazy converting.

I don't see a clear connection between #4075 and .sfz.

vlad0337187 commented 6 years ago

@Mark-Agent003 , Carla supports loading .sfz, it uses libsfz library from Linux Sampler project. (Carla - instrument host from KXStudio project, LMMS supports it)

I think, that it would be better to use Carla or to embed Linux Sampler into LMMS rather than to make separate .sfz player. (I like last variant more)

Disar commented 6 years ago

Upon looking for some sound banks in the past I came across this library

I use the Sforzando VST and everything loads up fine. Recently though I discovered that the VST doesn't support multitimbral for more than one instrument slot. The library I linked has some multilayered instrument file definitions ( ariax ). I tried Linux Sampler but that one seems to behave similar ( but perhaps I haven't fully understood how too utilize it), in fact it doesn't even know how to read the ariax files. . Getting those to work would actually be really great too.

vlad0337187 commented 3 years ago

Update:

trebmuh commented 3 years ago

sfizz would be a better move it seems (very actively developed).