Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Folve - seamlessly FIR convolving audio file fuse filesystem with gapless support.
C++ C Makefile
Branch: master
Failed to load latest commit information.
demo-filters o readme tweak.
img o focus on relevant part.
COPYING o legalese: add COPYING, provide "Appropriate Legal Notices" and o now really switch to PREFIX
Makefile o Fix some stray whitespaces at end of lines. o better wording. o Fix some stray whitespaces at end of lines.
buffer-thread.h o Fix some stray whitespaces at end of lines. o Allow to have a different amount of input vs. output channels.
conversion-buffer.h o Allow to have a different amount of input vs. output channels. o Fix some stray whitespaces at end of lines.
convolve-file-handler.h o Fix some stray whitespaces at end of lines. o Only have one pre-buffer thread to only use at most one more core
file-handler-cache.h o Only have one pre-buffer thread to only use at most one more core
file-handler.h o Fix some stray whitespaces at end of lines. o Set the default buffer size pretty small to not overwhel low-CPU
folve-filesystem.h o add include for off_t o Set the default buffer size pretty small to not overwhel low-CPU o Fix some stray whitespaces at end of lines.
pass-through-handler.h o Fix some stray whitespaces at end of lines. o Fix channel availability test.
processor-pool.h o Remove TODO: pass out detailed error msg when failing to o Fix some stray whitespaces at end of lines.
sound-processor.h o Fix some stray whitespaces at end of lines. o Write timestamp of last access with -D
status-server.h o Remove unused variables. o more include missing.
util.h o Fix some stray whitespaces at end of lines. o ..
zita-audiofile.h o add basic zita filter. o Fix some stray whitespaces at end of lines.
zita-config.h o Fix some stray whitespaces at end of lines. o legalese: add COPYING, provide "Appropriate Legal Notices" and o Fix some stray whitespaces at end of lines.
zita-sstring.h o add basic zita filter.

Folve - FUSE convolve

Folve is a FUSE filesystem that convolves audio files on-the-fly including gapless support.

Need to have precision-filtered audio adapted for your speakers and room (or just for effects), but your audio system doesn't have plug-ins for Finite-Impulse-Response filters and just can read files ? Folve is for you!

Filter selection and general status provided via web interface.

Folve screen


The Folve FUSE filesystem takes a path to a directory of FLAC files, and provides these files at a mount point. Other file formats than FLAC should work as well, but not all are working well for streaming yet (and before you ask: MP3 is not supported. Use Ogg/Vorbis as it is patent free and provides better quality than MP3).

When a FLAC file is accessed through the mount point, Folve automatically convolves its original counterpart on-the-fly with a Finite Impulse Response (FIR) filter. The FIR filter is based on the jconvolver convolution engine.

Folve can use the same filter configuration files that jconvolver uses. Folve requires a naming scheme, described later, for these files.

In essence, Folve provides a filesystem that convolves files as a media server or application reads them; many media servers or applications do not provide an independent convolve option, but they all can read files.

Filesystem accesses are optimized for streaming. If files are read sequentially, we only need to convolve whatever is requested, which minimizes CPU use if you do not need the full file. Simply playing a file in real-time will use very little CPU (on my fairly old notebook ~3% on one core). So this should work as well on low-CPU machines; on a Raspberry Pi 2, the CPU load to convolve a 44.1kHz/16 Bit file is about 22%. Folve can make use of multiple cores in parallel file accesses. Many NAS systems have enough CPU to transparently run folve even for sophisticated filters.

Because input and output files are compressed, we cannot predict what the relationship between file-offset and sample-number is; so skipping forward requires to convolve everything up to the point (the convolver is pretty fast though, so you'll hardly notice).

While indexing, some media servers try to skip to the end of the file (do not know why, to check if the end is there ?), so there is code that detects this case so that we do not end up convolving whole files just for this. Also, some media servers continually watch the file size while playing, so we adapt predictions of the final filesize depending on the observed compression ratio.

The files are decoded with libsndfile, convolved, and re-encoded with libsndfile. Libsndfile is very flexible in reading/writing all kinds of audio files, but the support for rich header tags is limited. To not loose information from the FLAC headers when indexing Folve-served files with a media server, Folve extracts and serves the headers from the original files before continuing with the convolved audio stream.

Folve has been tested with some players and media servers (and works around bugs in these). Please report strange observations with particular media servers or provide patches through github

This project is notably based on


Tested on Ubuntu (tested on > 11.10), various Debian versions and the common Debian version on the Raspberry Pi.

For compilation, we need some development libraries, easiest to install via the package manager:

sudo apt-get install libsndfile-dev libflac-dev libzita-convolver-dev \
                     libfuse-dev libmicrohttpd-dev
# Now just compile folve.
sudo make install

For hints on how to compile on older systems see

Sometimes, running folve complains that it can't access /dev/fuse. In that case, you need to put your user into that group sudo usermod -G fuse $USER (then open new shell or reboot). Or you can run folve as root.

(TODO: create a debian package)

Let's test it!

Folve requires at least two parameters: the directory where your original FLAC files reside and the mount point of this filesystem.

Also, do be useful, you need to supply the directory that contains filter directories with the -C <config-dir> option. Very useful is the -p <port> that starts a HTTP status server. Let's use some example filters from this distribution. If you are in the Folve source directory, you find the directory demo-filters/ that contains subdirectories with filters. If we pass this directory to folve, folve will search in this directory for named filters:

mkdir /tmp/test-mount
./folve -C demo-filters -p 17322 -f \
        /path/to/your/directory/with/flacs /tmp/test-mount

The -f option makes folve run in the foreground.

Now you can access the fileystem under that generated mount point /tmp/test-mount; it has the same structure as your original directory. So in another shell, you can now run any music player that reads files and point it to the new location:

mplayer /tmp/test-mount/foo.flac

Folve provides a HTTP status page; have a look at


(or whatever port you chose with the -p 17322 option) There you can switch the filter; after you changed it in the UI, re-open the same FLAC file with your media player: you'll hear the difference.

To terminate this instance of folve, you can just press CTRL-C as we've run it in the foreground (the -f option did this). In real life, you'd run it as daemon (without -f option), so then you can stop the daemon and unmount the directory with the fusermount command:

fusermount -u /tmp/test-mount

Filter Configuration

With the -C option, you give folve a directory in which it looks for subdirectories with named filter configurations.

Filters are WAV files containing an impulse response (IR). This is used by jconvolver's convolution engine to create a Finite Impulse Response (FIR) filter and process your audio.

Text configuration files refer to these WAV files and add parameters such as filter gain and channel mapping. These configuration files are read by Folve. See the samples in the demo-filters/ directory. The README.CONFIG in the jconvolver project describes the details of the configuration format.

Since the filter is dependent on the sampling rate, we need to choose the right filter depending on the input file we see. This is why you give Folve a whole configuration directory: it can contain multipe files depending on sample rate.

The files in the configuration directory need to follow a naming scheme to be found by Folve. Their naming is:

filter-<samplerate>-<channels>-<bits>.conf   OR
filter-<samplerate>-<channels>.conf          OR

So if you have FLAC files with 44.1kHz, 16 bits and 2 channel stero, you need a filter configuration named one of these (in matching sequence):

/filter/dir/filter-44100-2-16.conf            OR
/filter/dir/filter-44100-2.conf               OR

The files are searched from the most specific to the least specific type.

The Folve filesystem will determine the samplerate/bits/channels and attempt to find the right filter in the filter directory. If there is a filter, the output is filtered on-the-fly, otherwise the original file is returned.

(I am looking for filter construction tools on Linux; if you know some, please let me know.)

Gapless joining

In gapless playback the media players make sure that there is no audible gap between playing one file and the next, by joining the last waveform sample of the last file with the first of the next. (If you never heard this term, it is mostly useful for recording of concerts where there is one continuous recording that are logically separated in tracks, but there is no pause - or gap - between these tracks).

Gapless convolving in folve needs to do that as well; however it needs to predict what file the player is about to open. On the filesystem layer it can't definitiely know what that would be. However by common convention, files that are consecutive are alphabetically sorted in the fileysten (01-foo.flac, 02-bar.flac..). With that heuristic, folve can provide reliable gapless convolving.

You can switch it on with the -g option:

./folve -C demo-filters -p 17322 -g \
        /path/to/your/directory/with/flacs /tmp/test-mount

Of course, you need to make sure to use players that can do gapless playback. In our simple example with the mplayer, you need to use the --gapless-audio option; in your audio player you need to look what that equivalent is (some support it right out of the box).

 mplayer --gapless-audio /tmp/test-mount/*

In the folve web-frontend, you see the gapless joining with little arrows ->. You also see that folve already startes pre-buffering the beginning of the next file while it still plays the previous one:

Gapless joining

General usage:

usage: ./folve [options] <original-dir> <mount-point-dir>
Options: (in sequence of usefulness)
    -C <cfg-dir> : Convolver base configuration directory.
                   Sub-directories name the different filters.
                   Select on the HTTP status page.
    -p <port>    : Port to run the HTTP status server on.
    -r <refresh> : Seconds between refresh of status page;
                   Default is 10 seconds; switch off with -1.
    -g           : Gapless convolving alphabetically adjacent files.
    -b <KibiByte>: Predictive pre-buffer by given KiB (64...16384). Disable with -1. Default 128.
    -O <factor>  : Oversize: Multiply orig. file sizes with this. Default 1.25.
    -o <mnt-opt> : other generic mount parameters passed to FUSE.
    -P <pid-file>: Write PID to this file.
    -D           : Moderate volume Folve debug messages to syslog,
                   and some more detailed configuration info in UI
    -f           : Operate in foreground; useful for debugging.
    -d           : High volume FUSE debug log. Implies -f.
    -R <file>    : Debug readdir() & stat() calls. Output to file.

If you're listening to classical music, opera or live-recordings, then you certainly want to switch on gapless convolving with -g. If a file ends with not enough samples to fill the FIR filter input, the gap is bridged by including the first samples of the alphabetically next file in that directory -- and the result is split between these two files.

The buffer size -b flag tells folve how much it should attempt to pre-convolve a file if CPU permits. The default setting is pretty minimial; you typically want this to be at or above 1024, in particular if your player reading from the filesystem does not do a good job of pre-buffering itself.


To manually switch the configuration from the command line, you can use wget or curl, whatever you prefer:

wget -q -O/dev/null http://localhost:17322/settings?f=highpass
curl http://localhost:17322/settings?f=SantaLucia

The parameter given to f= is the name of the subdirectory in your base configuration directory. An empty string is no filter, i.e. 'pass through'. (And no, there is no security built-in. If you want people from messing with the configuration of your Folve-daemon, do not use -p <port> :)).

Something went wrong with that request. Please try again.