One common strategy when looping problematic organ samples is to employ a cross-fade. This is an irreversible audio modification that gradually transitions the samples leading up to the end of a loop to equal the samples that were leading into the start. The goal is to completely eliminate any sort of impulsive glitch and hopefully also create a “good spectral match”. While the ability to eliminate glitches is possible, creating a good spectral match might not be so simple.
We can think of an organ sample as being a linear combination of two signals:
- A voiced/correlated/predictable component (choose your word) which represents the tonal part of the sample. Strictly speaking, the tonal component is not entirely predictable – there are continuous subtle variations in the speech of a pipe… but they are typically small and we will assume predictability.
- An unvoiced/uncorrelated/unpredictable component which represents the pipe-noise of the sample.
Both of these components are necessary for realism in a sample.
The following image shows a cross-fade of two entirely correlated signals. The top picture contains the input signals and the cross-fade transition that will be used, the bottom contains the input signals with the cross-faded signal overlaid on top. There is nothing interesting about this picture: the two input signals were the same. The cross-fade transitions between two identical signals i.e. the output signal is equal to both of the input signals.
The next image shows a cross-fade of the same correlated signal with some uniform white noise overlaid on top. What is going on in the middle of output signal? It looks like it’s been attenuated a little bit and doesn’t appear to have a uniform distribution anymore.
This final image is a cross-fade purely consisting of two uniform random signals to add some more detail.
It turns out that summing two uniformly distributed random variables yields a new random variable with a triangular distribution (this is how noise for triangular dither gets generated). During the cross-fade, the distribution of the uncorrelated components of the signal is actually changed. Not only that, but the power of the signal is reduced in the middle of the transition. Here is an audio sample of two white noise streams being cross-faded over 2 seconds:
Listen for the level drop in the middle.
If the cross-fade is too long when looping a sample, it could make the pipe wind-noise duck over the duration of the cross-fade. While the effect is subtle, I have heard it in some samples and it’s not particularly natural. I suppose the TLDR advice I can give is:
- If you can avoid cross-fading – avoid it.
- If you cannot avoid cross-fading – make the cross-fade as short as possible (milliseconds) to avoid an obvious level-drop of noise during the transition.
Thanks for this posting – you’ve explained clearly but in better terms what I tried to get at in my blog posting on creating organs in Logic Pro X using the EXS24 sampler. I’m now studying the post in more detail to see if I can apply its techniques to my attempts to convert the venerable (but old!) Jeux-D’Orgues sound font file. My blog posting is at http://jusblad.blogspot.com/2016/09/creating-pipe-organ-instrument-in-logic_46.html – please excuse the lack of technical knowledge, but I’m sure the information in your post should allow me to finesse this organ attempt – and resolve some of the bloody looping issues I had! My biggest challenge was getting the organ sample loops correct, particularly where the stereo channels went out of phase (meaning the loop points would be different). I was tempted to convert to mono, but was never overly satisfied with the results. Thanks again for the post.
An update a couple of years on: in an effort for efficiency over precision, I’ve recently tried converting my organ sample (single pipe) sound files to mono (where they were originally recorded in stereo, using differently positioned microphones in a church that had moderate reverb qualities). For non-Hauptwerk quality pipe organ SoundFont files, I found that this rough technique allowed me to set my loop points far more easily – which was my main hold-up point. I was then able to use end-stage modulation to create more realistic sounds – the effort at this part of the process saved me far more time than trying to get stereo samples looped properly (using cross-fading). I’m sure the result is not quite as pure, or fidelity-rich, but it meant I was able to more quickly create a credible pipe-organ SoundFont that I wanted to make (a North German-style organ) that I can load into the various software products I use (just Polyphone, Logic Pro X and MuseScore – I’m an obvious amateur!). I’d love to have the time (let alone the technical understanding) to make these sounds a more reflective and accurate rendition of their natural environment, but it gave me what I needed in the time I had. Regardless, I still love reading your posts and can aspire to the mathematics one day.