SFZ support

Hi all,

A few questions regarding SFZ format, i.e. LinuxSampler and its support on Zynthian.

  • I seems LinuxSampler supports SFZ instruments using FLAC format (through libsndfile library), right? If so, as LinuxSampler streams sample files as you play, I guess there’s some overhead compared to playing a SFZ using WAV files, due to decompressing dozens of FLAC streams on-the-fly. Correct? Any idea of the impact on polyphony (I have a RPi4)?
  • Now about adding SFZ instruments to Zynthian:
    • You can upload instruments using webconf, but for linuxsampler the interface only allows .gig and .zip (and other compressed formats) extension. Does this mean I should zip the SFZ file and all its audio file dependencies in a zip file, then upload the zip file? If so, what should the file structure inside the zip be? Everything at the root? How does this copy into the Zynthian: does everything go into a per-instrument directory? (I don’t want all the samples of all SFZ files mixed up in the same place). I tried to upload a zipped SFZ this way, but the main one I want to import is a 4GB piano, so the Zynthian was still stuck hours later I launched the upload and I eventually gave up
    • Is there an alternate method: I can imagine putting the SFZ+sample files on a USB stick, then copying from the stick to the SD card with command line using SSH, but it’s a bit of a pain. Would that work at least?
    • Is there yet another more user-friendly method? Would be nice to have a “file explorer” to navigate inside the Zynthian but I couldn’t find any way to do this.

Thanks in advance

If you already have an rpi4B I’d recommend putting zynthianos on an sd card and trying it with just normal rpi headphone out to begin with.

Yes you can stick the sfz file on a usb and use cli tools to copy it to the appropriate place. There is a terminal built into the web configuration page, you don’t even need to ssh.

ready to copy the files from the usb stick… but how do I get the path to the usb stick under linux CLI? should I mount the device first or something? sorry, my linux knowledge is quite limited…

USB flash is automounted at /media/usbX where ‘X’ is replaced by the partition number, e.g. /media/usb0.

I expected to see a method of uploading SFZ but as you say this is missing. I suggest adding an issue to the tracking system.

You can upload sfz files from your computer using ssh and scp. Here is my past post:

Put the .sfz in the same folder as the sample files. You might have to edit the sample path in the .sfz file.

BTW, The Zynthian build of Linuxsampler natively receives controllers. You do not have to “Learn” ccs if they are hard coded in a sfz file.

If you want to assign bend up to one step, bend down ` to octave, cc1 to pitch LFO, cc2 to Filter LFO, and cc4 to filter cutoff, add these lines to the sfz file at the group or global level:

bend_up=200 bend_down=-1200





You might have to delete a few lines if pitch or filter are coded at the region level.

Works for me. This should give you a general idea. I know, send a demo …



It is better not to use the RPi SD card for samples… it can’t timely loading samples while Linuxsampler is running, so large instruments will cause stuttering and sound interruptions.
A good way to get rid of artifacts in the work of Linuxsampler is to use a fast USB 3.x flash drive…

the structure of catalogues on a usb flash drive, formatted in fat32…

To download new samples to a USB flash drive, simply connect it to your computer…

Another undoubted plus to keep the sample library on a separate drive - you do not have to repeat the download of your samples to the SD card every time after reinstalling Zynthian…

The “sfizz” plugin is fine)) it works perfectly in MS Windows and Linux… I use it in new projects. When will it finally appear in Zynthian?


I’ve had a go. sfizz requires the gui to load samples. You need to use it in conjunction with the novnc.

1 Like

Hi there,
Some info essentially relating to SFZ on Zynthian that I eventually figured out and that I’m sharing here: my main Zynthian purpose was to use a big SFZ (namely Ivy Audio’s piano), knowing it’s using flac files.
I was wondering if it worked in the first place and if so, if flac decompression would affect polyphony.

So I transferred the instrument and samples to Zynthian and tried it. Result: the instrument did play, but I had a click on every note on/off and the notes also stopped abruptly though there was a smooth envelope release in the instrument.

In order to see if using flac was the cause of these issues, I converted all samples to wav (and even normalized them + converted them to 16 bit + trimmed the lowest level portions, all in order to keep the instrument size approximately the same as with flac), then created a SFZ using these wav files instead


  • Seems that flac decompression doesn’t seem to affect resources significantly: the processor load seems comparable with both instruments. BTW I start getting notes killed when the Zynthian reaches about 25% load, which I wasn’t expecting this early.
  • The abrupt note ends were still there
  • The clicks at note on/off were still

So, using flac files seems fine. As for the other two issues, I finally solved them:

  • Abrupt note ends: it seems LinuxSampler fails to decode opcodes that are on the same line as a header (or several opcodes on the same line?) Ivy Audio SFZ file looked like this:
<group>ampeg_release=1.1 ampeg_attack=.002 

if you simply change this to:


then the envelope is taken into account and the notes fade out smoothly

  • Clicks at note on/off: totally unrelated (I had this with all plugins, actually). I fixed it by opening alsamixer in a terminal and disabling the two Auto-mute switches of my IQAudio DAC+ board

So things are starting to work quite nicely, now…

In case this is of any use for someone else…


You should send feedback to LinuxSampler developers or open an issue on the their tracking system. This problem doesn’t looks like something difficult to solve. Anyway, if they don’t want to solve it or they are too slow, we could write a script for “sanitizing” the SFZ code and make it work on zynthian.


How are you measuring load? RPi 4 has 4 cores so some measurements will show 25% when one core is at full load.

I had a similar muting issue with Hifiberry. It is annoying and we should look to disable it by default.

The original SFZ format definition (The SFZ Format) states that opcodes must be separated by at least one space / tab / carriage return. Here the opcodes are separated by a space but the first opcode sticks to the header without anything in between

<group>ampeg_release=1.1 ampeg_attack=.002

…so it’s likely this SFZ file doesn’t comply with the SFZ format spec, which may be why LinuxSampler doesn’t read it properly. One could simply try to add a space after instead of a new line and see if it works as well:

<group> ampeg_release=1.1 ampeg_attack=.002

The instrument is easy to fix as it’s the only statement in the instrument (and only opcode not separated from a header), so this situation only happens once.

The samples are nice (Steinway B, 88 notes, 5 velocity layers and 2 round robin) but this SFZ isn’t very good anyway: no filter cutoff control by velocity for instance, so velocity layer transitions aren’t smooth, with a noticeable brightness change when switching layer for instance. I’m working on improving it a little…

I used the small VU meter in the Zynthian interface, which can be assigned to either audio out level or RPi load from the web interface. So it’s a very rough measurement, but it seemed about 25% total and couldn’t exceed this even when playing more notes simultaneouxly. So it may indeed mean that LinuxSampler runs within a single core, which can get fully busy.

One trying test case may be the free SalamanderGrandPiano Here and Here.
Comes in .wav and FLAC SFZs as well as single file SF2 using .wav samples.
(The second source has a OggVorbis SFZ totaling 82Mb)
The loFi .wav 44.1kHz 16bit version has 641 samples totaling 1.2 gig.
Might be a good case for a 4-8 gig Pi 4 and fast USB3 drive to store sample files.
It has 16 different velocity samples for each key along with 88 mechanical key release sounds.

And one more FYI, the Soundfonts 4U page has a variety of pianos and qualities, all SF2 some recently updated.
(The 47Mb Chateau Grand-SF-Lite-v1.0 is sufficient for my tin ear and lousy speakers)