Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Performance

This page reports how much memory a sampled organ needs, how long it takes to open, and what each of Masterpiece’s engine settings gains. Every figure is measured on a real sample set, and the method is at the end.

Summary

BaselineMasterpieceGain
Sample memory, 24-bit as recorded21.6 GB16.2 GB1.3x less
Sample memory, 24-bit compressed, releases streamed21.6 GB3.6 GB6.0x less
Sample memory, 24-bit compressed, shortest release streamed21.6 GB2.8 GB7.6x less
Time to open the organ, from the sample cache43.2 s3.8 s11x faster
Memory added by drawing all 44 stopsnoneflat

The baseline is the conventional approach: every sample decoded to 32-bit floating point and held in memory. For the opening time, the baseline is the first load at the same settings, decoded from the files.

Test bed

InstrumentFriesach: 44 stops, three manuals and pedal
Sample set17.0 GB, 12,148 WAV files, 24-bit / 48 kHz / stereo
Machine15.9 GB RAM, Windows
BuildMasterpiece 0.3.3, Release

The figures are the project’s own measurements, made with Masterpiece 0.3.3. The storage formats, release streaming, mono folding, the cache and rate conversion they measure work the same in 0.9.0; lossless compression, added since, is described below with its own figures.

Techniques

The settings are on the Loading tab of Organ settings, and each takes effect at the next load of the organ.

TechniqueSettingWhat it does
Release streamingStream releases from diskA release tail is several seconds of room sound, played once from its start and never looped. Masterpiece keeps only its first frames in memory and streams the rest from disk into a per-voice ring buffer while it sounds. Attacks and sustain loops stay in memory.
24-bit storageResident format: As recorded - 16 or 24-bit, as each file isThe source files are 24-bit. Samples are held as 24-bit integers, so the audio in memory is bit-for-bit identical to the file. A 16-bit file is held as 16-bit integers, also bit-for-bit. The 32-bit float baseline widens every sample.
20-bit storageResident format: 20-bit - a sixth less than the sourceSamples are requantised to 20 bits against each file’s own peak and packed so two samples take five bytes: two and a half bytes a sample.
16-bit storageResident format: 16-bit - two thirds of that, inaudibleSamples are requantised to 16 bits against each file’s own peak, so a quiet stop still uses every bit.
Lossless compressionLossless compression in memory16-bit and 24-bit samples are held split Rice coded and decoded as they play, bit for bit what the file holds. See Compression. Greyed out for 20-bit and 32-bit float storage.
Mono foldingLoad in mono (halves memory, gives up the stereo image)A stereo sample set is folded to mono as it loads.
Sample cacheSample cacheThe decoded, converted samples are written to one file, so the next load of the same organ with the same settings is one sequential read in place of 12,148 decodes.
Load-time rate conversionSample rateSamples are converted to the chosen rate as they load (As recorded, 48 kHz or 44.1 kHz), so playback needs no per-voice rate conversion.

The Quality list sets several of these at once:

QualityWhat it sets
Best: as recorded, all in memoryAs recorded, every sample in memory
High: as recorded, compressed, releases streamedAs recorded, compressed, release tails streamed
Recommended: 16-bit, releases streamed16-bit, release tails streamed
Compact: 16-bit, compressed, releases streamed16-bit, compressed, release tails streamed
Small: 16-bit mono, compressed, releases streamed16-bit mono, compressed, release tails streamed
Smallest: as Small, short releases onlyAs Small, with the shortest release of each pipe alone
CustomShown when the settings below it match none of the above

Compression

With Lossless compression in memory on, each sample is cut into blocks of 4,096 frames, each block predicted and its residuals Rice coded, and the voices decode the blocks they play as they play them. The samples a voice plays are bit for bit the file’s samples. Measured on a tenth of the Friesach set on a two-core Intel Core i3, the coded samples take a third of the bytes of plain 24-bit storage, and they decode at 224 million frames a second. On the whole Friesach set with the 0.9.0 build, the coded samples take 5,394.5 MB at 24 bits (0.333 of plain), 3,301.5 MB at 16 bits (0.306) and 1,661.9 MB at 16 bits mono (0.308).

The decoding is done on the render threads, so a compressed organ takes more processor time per voice than a plain one. The benchmarks perf.voice.coded-playback and perf.codec.split-rice-decode measure it on the machine they run on. See Architecture.

Memory

ConfigurationHeld in memoryLeft on diskMemory savedReduction
32-bit float, resident (baseline)21,606.5 MB
24-bit, resident16,204.9 MB5,401.6 MB1.3x
24-bit, streamed6,976.0 MB8,891.9 MB14,630.5 MB3.1x

Release streaming is the largest single saving: it leaves 56% of the sample data on disk. The settings multiply, and each step is an exact ratio of the one before.

StepBeforeAfterRatio
32-bit float to 24-bit21,606.5 MB16,204.9 MB0.750

The exact ratio confirms that the accounting measures the sample data itself.

Memory while loading and playing

Each run opens the organ, then walks the registration from a single Principal 8′ to full organ in eight steps. At each step it plays the same 15-second passage: notes build up to sixteen held voices, then all are released together, so every voice is in its release tail at once.

Memory rises only while the organ loads. After that it stays level through every registration step and every chord, including sixteen simultaneous release tails streaming from disk.

Memory against registration

Every rank is loaded whether its stop is drawn or not, so full organ costs the same memory as a single stop. Peak process memory at each step:

Configuration1 stop44 stopsChange
24-bit, streamed8,270 MB8,268 MB−2 MB

Drawing a stop waits for no samples, and a registration change allocates nothing.

Load time

ConfigurationTime to openSpeed-up
32-bit float, resident (baseline)77.1 s
24-bit, resident55.8 s1.4x
24-bit, streamed28.9 s2.7x

Holding less also opens faster: a streaming load reads no release tails, and they are more than half the data on disk.

Sample cache

24-bit, compressed, releases streamedDecoded from WAVRead from cacheSpeed-up
Sample loading42.7 s3.3 s13x
Whole organ43.2 s3.8 s11x

Measured with Masterpiece 0.9.0 on a 4-core Debian 13 machine with an NVMe disk, every stop loaded, the source files already in the system’s file cache. The cache file is 3,617 MB.

The cache is keyed to a fingerprint of everything that changes the bytes in memory: the organ definition’s size and modification time, storage width, mono folding, load rate, preload head, loop selection, release streaming and the ranks requested. Any change is a cache miss that rebuilds the cache, so a stale cache is never read. This was verified on a five-rank load: a cache is reused at the settings it was written with, and rebuilt to exactly the expected size when the storage width or the channels change.

By default Masterpiece keeps a single cache file and replaces it when the organ or settings change, so the cache stays the size of one organ. The Sample cache list offers One cache, replaced as organs change, One cache per organ (uses more disk) and Off.

Sample-rate conversion

Memory falls in exact proportion to the load rate: a 96 kHz sample set played through a 48 kHz device takes half the memory. Verified on Friesach (five ranks) by converting from its native 48 kHz:

Load rateHeld in memory
48 kHz, as recorded1,599.7 MB
44.1 kHz1,469.8 MB
24 kHz799.9 MB

Pitch and level are unchanged at every rate. A converted attack joined to a converted streamed release tail matches a fully resident render to 0.0 dB across the whole release.

The Sample rate list offers As recorded, 48 kHz and 44.1 kHz.

Audio fidelity

Measured on the sample data directly, applying exactly what the loader applies, to 60 files chosen at random from the 12,148:

StorageCompared with the source file
24-bitBit-for-bit identical
16-bit78.1 dB signal to quantisation noise (median), 75.2 dB lowest

Method

  • Held / left on disk. The sample library’s own accounting, logged at the end of each load: residentBytes() sums the sample buffers actually held, streamedBytesSaved() sums what streaming left on disk.
  • Process memory. The process’s private bytes, sampled from outside it every 250 ms.
  • Load time. From the start of the load to the organ being ready to play, as logged by the application.

Friesach is a freely published sample set by Piotr Grabowski and is not part of this repository. See ATTRIBUTION.md in the repository root.