New Plugin: SimSam, a simple (re)sampler based on SFZ

Hello,

Here is my first plugin for the MOD: SimSam, by ēffē

It is a sampler based on SFZ files, which also resamples notes that are not available as WAV, as long as their lower/upper 4th/5th are available.

My initial goal was to fill up the need of having a MIDI piano, for which I’m using the Salamander Grand Piano samples. The ones recorded from a Francis Bacon are also included.

The WAV files have been converted to mono, PCM16 in order to reduce the memory footprint. The padding zeros at the end have been trimmed.

ADSR envelopping is supported, though for the piano samples, the fadeout parameters should be enough. If attack, release and decay are left to 0ms, the sustain level acts as a simple gain and the complete WAV note is played as long as it is ‘on’.

This plug-in depends on libsndfile.

Velocity interpolation is currently ongoing, though the GUI control is already there. The idea is to interpolate the velocity gain based on the ones defined on the SFZ. This is particularly relevant when there are very few velocity groups available (for example, the Francis Bacon piano).

I tested on Linux and on my MODEP setup. I’m still trying to build it for the DUO, which I have, but so far I’ve had some difficulties.

The code is available here: https://gitlab.com/edwillys/simsam

Any feedback is welcome :slight_smile:

screenshot-sfz-player

10 Likes

Currently the WAV files are stored in the same git repo as the code. I’m thinking about putting them in a different one with references to them as individual submodules.

I’ve found quite a few more free piano samples here:

This would take a few GB of flash though. Any ideas on this could be integrated into the MOD, with an option to select which samples to include?

1 Like

Wish i had the technical language and know how to make this a reality

As it is not yet on the plugin store, the only way would be to manually copy the files via ssh to your MOD. It is not hard, but if you’ve never dealt with ssh before it is also not very straightforward. If you’re interested I can try to help.

Wow, this would be huge! To have a high quality piano on the Mod would be incredible. I’m excited for my Dwarf, as I’m sure it can handle the CPU load… I try to keep my Duo at 70%-80% as it starts clipping if there are too many effects.

I cleaned up the repo so that it is no longer bloated with the WAV samples. Now it references them as submodules, which can be updated individually. I added the details to the readme as well. The indexing of the instruments are hard coded for the time being, as there is currently no way to dynamically inform the GUI. If the samples are not present, the GUI will simply show “Failed to load samples…”

And, as a bonus, I added the Steinway & Sons samples based on this link. It was actually a bit painful, as the samples needed quite a lot of filtering and trimming.

Regarding CPU load, it shouldn’t take much actually. It depends on the number of samples that are loaded vs the missing ones that are resampled. The more resampled ones, the higher the load is. Of course the polyphony also plays a role here. I’ll try to build it for the Duo to get the real numbers.

2 Likes

really looking forward to this Ed

This is a very dope plugin!

Just slightly off-topic, but we have sfizz already working. (a great fit for the file handling feature. the plugin does disk-streaming, so memory is kept reasonably low)
I am glad that exists, since the other big/decent sfz player, linuxsampler, would be a pain in terms of licensing.

EDIT: working internally, obviously file handling is not here yet.

1 Like

Nice to hear that sfizz is working!

SimSam is currently not fully SFZ compliant and only supports basic tags. I focused more on the resampling and ADSR. In a near future also the velocity modulation. I’m adding the SFZ features as they deem necessary and am trying to make it simple.

Regarding the memory footprint, that is of course one drawback. To compensate for that, the supported samples are mono 16 bits. For the DUO this might become a bottleneck though, maybe if some reverb and delay is added on top. It might make sense to adapt the SFZ just to load the “base” samples to make most use of the resampling. Streaming directly from the file was not really an option for me as I was testing with MODEP quite a lot and there is reads from the SD card.

2 Likes

LV2 has the capability to have separately bundled presets. So you could just have a folder with the samples and the TTL describing the preset and the plugin it belongs to. If the mod store is set up for it then people can just choose which presets they want to install.

1 Like

Exactly, that is the way it is done now :wink:

2 Likes

Is this plugin available on mod duo x mow?

No, it has not been pushed to the store.
The way it handles files makes it quite peculiar.

I might be wrong here @edwillys but this is only meant to be used with specially crafted sfz files, correct?
Would be interesting to push this as a beta plugin at least.
Are you interested on keeping up development to add file loading support?
Basically what is needed is lv2 patch parameter of type atom:path, with mod:fileTypes set as “sfz”. See mod-lv2-data/sampler.ttl at master · moddevices/mod-lv2-data · GitHub for a working example.

Got the plugin running…

With just a few tweaks I am able to make this work with v1.10, still leaving the 3 hand-picked and refined SFZ files as-is but allowing them to be uploaded by the user with the new file manager stuff.
So the plugin loads whatever possible. It is great to have the feedback on loading vs load error vs load ok. Even better would be if this is extended to display % of loading status.

Now… while I have this working on the slowest possible unit (kickstarter Duo, with nand) and the plugin actually works, it takes a looooong time.
The plugin reports

Finished loading 85 notes in 340993ms

Which is around 5 and a half minutes.
Uploading all the samples also takes a long time (it is 700Mb upload after all), and only 1 instrument fits on the kickstarter Duo. But indeed all works after everything is in place.

Compared to the most powerful MOD device that exists at the moment (Duo X production units), uploading the 700Mb pack takes around 30s, and loading the full thing in the plugin around 5. :scream: :rocket: :rocket:

Maybe worth to push as beta plugin for the community to try?

4 Likes

Clearly, Mod Devices is going to another dimension! :heart_eyes:

OH SHooots. THis is great. @falkTX whats that midi file plugin?

Yeah I recently trying sfizz. And want the function of ADSR. Although it is possible to write code on the notepad, instead of writing one by one of ADSR of sample, that function of simsam would be nice.

The one I did and pushed to the store recently. there is a whole discussion about it on the audiofile plugin thread.
requires 1.10, but already available.

We are maintaining a list of plugins that support file handling at File handling - MOD Wiki, which includes an audiofile and midifile player yes

Hello,
SimSam was written when there was still no support for file handling. The WAV files are stored in fixed locations and loaded into the plugin at will. Now, as we all know, things have improved :slight_smile:

The loading takes quite a long time as the entire WAV samples are read into RAM. Though this has this obvious memory penalty, it allowed the plugin to play in in a RPi MODEP, where reading from SD card in realtime wasn’t really working. To compensate for the long loading time, I simply deleted some samples :smiley: The 4ths and 5ths are calculated in realtime via resampling from existing ones.

The SimSam support of SFZ is limited, but is not meant to apply only to specially crafted SFZ. Instead, if need be it can be extended to whatever SFZ functionality is missing. Proper SFZ parsing is an art per se and most likely it won’t compare to existing stuff that is already available.

If there is interest here, I can bind the sfizz library now that file handling is in place. Goal would be to have it playing directly from flash as long as the file comes from the file manager, hence reducing their loading time and memory footprint to almost nothing.

4 Likes

While I understand that swapping the sfz library under the hood for a more spec-complete one would be nice, what you have already in place already works today as-is for a few sfz files.
I have been closely following sfizz development, and while it is progressing quite well, I cannot say in confidence that we will have it reliably working on the units in the short-term or middle-term.
As you have experienced with MOD-EP and sdcards, read operations can be terribly slow, so relying on disk-streaming for a realtime target is going to be difficult to achieve. Even for Duo, the mmc vs nand has quite difference disk-read performance, so the plugin will need to adjust itself during runtime. Easier said than done… :sweat_smile:

I think leaving SimSam for a couple of known, good-to-work and hand-crafted SFZ files is okay. Once sfizz stabilizes, then we can use it for more generic SFZ usage.
Since we are dealing with custom/hand-crafted SFZ files, we can make the sfz and wav files be together in the same folder, making it much easier to upload. Then all the user would have to do is to download a zip file (gitlab provides that too like github, right?), unzip the contents and upload the stuff into a specific subfolder.

btw, regarding the changes that I needed to do in order to make the plugin work for me, here is a patch