You are here

Sampling Basics: Part 1

Tips & Techniques By Paul White
Published January 1996

Having come a long way from its humble beginnings in the early n‑n‑n‑n‑nineteen eighties, sampling is now an integral part of music making. Paul White explains what samplers do and how they can be used. This is the first article in a three‑part series.

Just about every musician has heard of sampling, but unless you have a sampler and use it, you may not be clear about exactly what they can and can't do. A sampler is essentially a tapeless, digital recording device. At its most basic level, you need know no more about how sampling works; this series will leave an explanation of the principles behind digital recording to a future article.

Once a sound has been digitally recorded (into RAM — Read Only Memory) by your sampler, the sound can be played back at varying pitches under the control of a MIDI keyboard or sequencer. To play a sample back at a higher pitch than it was first recorded, the sampler has to speed up the sound, with the result that the sample also plays back faster. Exactly the same thing happens with tape — if you double the tape speed, everything happens twice as quickly, and the pitch goes up by one octave. Conversely, if you drop the pitch by slowing down the sample, the sound will go on for longer. Because RAM memory only works when power is supplied, most samplers forget everything when you switch them off, which means that some form of permanent sound storage is required. Most samplers use floppy disks, with the more serious models also offering the option of hard disk storage. Before we go on, it will be helpful to look at the two main ways people use samplers.

Samplers: What Are They Good For?

If you sample single musical notes, such as strings or organ sounds, you can use the sampler very much like any other synthesizer — though you're not restricted to the manufacturer's own internal sounds, as with many synths. And absolutely any sound can be sampled and used as a musical instrument — even everyday household objects. Indeed, most people, when they get their first sampler, go around the house hitting and scraping things to see what sounds good (for more on this curious side‑effect of buying your first sampler, see the article on Off The Wall Sampling back in SOS June '94).

The other popular way of using samplers is to record not just individual notes but whole musical or rhythmic phrases, and this way of working forms the cornerstone of modern dance music construction. Typically, you might sample a four‑bar drum rhythm, for example, and then trigger this on the first beat of every bar to provide a continuous rhythmic backing.

RAM‑Ifications

Soon after buying a sampler, you'll discover that you can always use more sample memory. Because sampled sounds are held in RAM, the maximum sampling time is always limited by the amount of memory you have, and on a basic sampler you may get a maximum of only 10 seconds or so of sampling time. This may seem like quite a lot, but if you're using your sampler multitimbrally, the available sample memory is divided up between the various sounds loaded into the sampler at any one time. A fully expanded, top‑of‑the‑range sampler could hold several minutes of samples, but you may find the cost of filling the sampler with RAM is greater than the initial cost of the machine itself.

Because RAM memory is such an expensive commodity, various strategies are routinely adopted to make the most of it:

  • Mono sampling: At a full audio bandwidth of 20kHz, using a 44.1kHz sampling rate, one minute of stereo sound takes up around 10Mb of RAM. If you can make do with mono samples, this immediately doubles the amount of sampling time available.
  • Lower sample rate: If you can tolerate a lower audio bandwidth, setting a lower sampling rate can extend your sampling time by a factor of two or more.
  • Looping: The other time‑saving strategy used when sampling sustained musical sounds such as strings or flutes is to 'loop' the sample (not to be confused with sampling the loop, which I'll come onto later). Most sustained sounds have a distinctive attack portion, but as they start to decay, the sound becomes more consistent. Listen to something like a flute or a string section playing a sustained note and you'll notice that very little about the sound changes after the initial attack. This being the case, there's no reason to sample the whole sound being played — you simply sample the first few seconds, then use the sampler's editing facilities to create a loop so that the middle part of the sample repeats itself continually until you release the key. Obviously, there's little point in trying to loop short or percussive sounds — they probably wouldn't sound right anyway — but you can loop long percussive sounds, such as the decay of a cymbal.

More On Looping

There's another good reason for looping sounds, and that's to get around the fact that the length of a sample changes as you play higher or lower on the keyboard — and anyway, the length of this original sound will probably be too short if you want to hold a string pad down for the next 24 bars. Once a sound is looped, its level never has to decay to zero because the same section of sound is being continuously looped around, as shown in Figure 1.

To recreate the effect of the sound's own natural decay, some samplers have envelope shapers, just like those found in synths, to allow you to modify the envelope of your sampled sounds. In most cases, the attack of the original sound can be left as it was, but a new decay has to be created to prevent the sound stopping abruptly when you release the key. If you've sampled an organ sound, of course, an abrupt stop is OK, but most instruments have a slower decay time which can easily be duplicated by using the Release phase of the envelope shaper. At its simplest, this will mean that the sound will remain constant in level while you're holding down a key, and then fade out at your chosen release rate when the key is released. Of course you can use the envelope generator more creatively to set up any envelope you like, just as you can in a conventional synth (some samplers even offer complex, multi‑section envelope generators, and may be able to generate two or more different loops within the same sample).

Consider a sound that plays through from start to finish without looping: you'll find that samplers offer different ways of triggering that sound. For example, if you hit the same key twice, and you want the original sample to carry on to its natural conclusion while the newly triggered one plays over the top, you need to select the so‑called 'one‑shot' trigger mode. On the other hand, if you want the original sound to stop and then trigger again from the beginning, for that cliched 'n‑n‑n‑n nineteen' effect, you need 'retrigger' mode. Most samplers support these basic triggering modes, though there may be slight differences in the terminology used.

Finding Loop Points

The basic idea behind looping is pretty straightforward, but finding the best‑sounding loop points can be tricky for a whole variety of reasons. Firstly, unless the waveform shapes at the beginning and end of the loop match up in level, shape and phase, you're quite likely to end up with a click at the sample loop point. Clicks can be minimised by looping at 'zero‑crossing' points (the point where the electrical signal crosses over from being positive to negative or vice versa), but if the waveform levels and shapes don't match pretty closely, you may still hear a glitch.

If you take too long a section of sample to form your loop, you may find that the sound's own natural decay results in a different level between the loop start and loop end, which will be audible as an unnatural modulation. This might lead you to believe that the shorter the loop, the smoother the result will be. The reality of the situation is that even apparently steady sounds are constantly evolving in their harmonic texture, and if you take too short a section to a loop, you end up with something that sounds more like an electronic tone than a real instrument. Part of the skill in getting good loops is choosing the optimum loop length, and that's something that really needs practice and experience.

Some sounds refuse to loop without a glitch, and in these cases 'crossfade' looping is an option. This technique involves fading out the end of the loop and overlapping it with a fade‑in of the start of the loop, and it's a facility provided by virtually all samplers. This avoids the possibility of a sharp glitch — but you're still not off the hook, because if the start and end of the loop are badly matched, you'll hear a change in timbre at the crossfade point, and if the loop is short, this will take on an irritating, cyclic quality. Slowly decaying sounds can sometimes be looped more successfully if they are compressed before being sampled, as this will maintain a more consistent level.

Finally, stereo sounds can be very difficult to loop because a good waveform match on one channel may not correspond to a good match on the other channel. Where stereo looping is essential, crossfade looping may be necessary to hide the join, so wherever possible you should keep looped samples in mono and reserve stereo for longer musical sections such as drum loops.

Multisampling

So far, I've covered the rudimentary idea behind sampling, but I haven't touched upon the fact that sounds become very unnatural when transposed far from their original pitch. Sometimes you can use this unnatural quality creatively, but when you're trying to capture a real instrument such as a piano, you only have to move a few semitones to either side of the note's original position and the sample starts to sound quite strange. This is where the concept of 'multisampling' makes an entrance.

If a sampled piano sounds natural for, say, only a couple of semitones either side of its original pitch, the only way to maintain a natural sound is to take several samples of the original instrument at different pitches and use each sample over a limited part of the keyboard. This is what we mean by multisampling.

The zones of the keyboard covered by each sample are known as 'keygroups'. The more keygroups you have, the more accurate the sound will be — but the more memory you'll need to hold all the samples. Pianos tend to be close to the top of the list of instruments which need this kind of critical sampling, while strings, flutes and brass can be stretched a little further before they start to sound artificial. Figure 2 shows how a keygroup may be built up.

Related to keygroups is the idea of 'velocity switching' or 'velocity crossfading', which involves taking two samples (a loud one and a quiet one), and using key velocity to control which one plays. Velocity switching is the most efficient option, as it doesn't affect your overall polyphony. Crossfading to a louder sample as you play harder sounds more convincing, as you get a more gentle transition, but it also halves your polyphony, because two samples are playing at the same time.

Samplers As Recorders

When samplers first came onto the scene, the main aim was to sample individual notes or sounds so that they could be played in much the same way as any other keyboard instrument. Now that longer sampling times are available, it has become popular to sample whole musical phrases, which can be played back from a single key. Probably the first application of this idea was the sampling of whole sections of vocals, allowing the engineer to copy a good chorus, for example, from one part of a song and then 'fire' it into the mix at the appropriate point when the next chorus came around. However, it was quickly realised that there was enormous creative potential in working in this way — if you sampled several complete drum rhythms at the same tempo, for example, then assigned each one to a different key on the keyboard, you could effectively play your whole drum part just by holding down the appropriate keys.

Samplers usually allow you to loop your drum parts so that they play continuously, but when you're working with a sequenced backing, there's a strong likelihood that the drum loop's timing will drift away from the tempo of the sequencer over a period of time. A far better option is not to loop your drum rhythm at all, but simply to retrigger it every bar (or every two, three, or four, depending on how long the pattern is) by using a note from the sequencer, quantised to the first beat of the bar. You can match up the sequencer tempo to the drum beat tempo pretty easily, and if there is a tiny discrepancy, it doesn't really matter because every time the drum rhythm is retriggered, it's brought back into perfect sync. The same is true of other rhythmic elements such as guitar riffs, and even with long vocal sections, it can be better to break them down into shorter phrases, then trigger each phrase independently. Figure 3 shows how timing errors can occur if you don't trigger your rhythmic sample loops from the sequencer.

Final Words

Because this is a basic series, I've covered only the essentials of sampling, without becoming entangled with the technicalities of how it works. And of course, once you get into it, you'll discover a lot more for yourself. One fact you'll soon discover is that life is too short to make your own grand piano samples, so standard orchestral and instrumental sounds are best obtained from a sound library. If you have a sampler that can read CD‑ROMs, this makes life much easier. There are also hundreds of excellent sample CDs on the market to provide you with drum loops, instrument and drum sounds, sound effects, ethnic and world sounds — in fact, just about any kind of sound you can imagine. Don't feel that it's cheating to use these — everyone else does it — but don't go sampling material from other people's records without permission, or you'll be in trouble if you try to put out a commercial release.

Great though sample libraries are, you shouldn't neglect sampling your own sounds entirely: even the most innocent everyday objects can yield interesting results when played back at different speeds. Once you've got past the obvious blown bottles and pinged kitchenware, you start to find that steel garage doors make great snare drums, bouncing balls can be tuned down into monster kick drums, and innocent wooden banister rails can sometimes blossom into very organic marimbas. As I said when analysing the SOS 1995 Reader Survey results, there's still a lot of you out there with no sampler. Think about what you could do with one, and you might find a sampler getting closer to the top of your 'must‑buy‑next' list.

Veto Vibrato: The Naked Sample

Sounds should always be sampled without vibrato or any other form of modulation, because the modulation rate will change depending on what note you play — and it's harder to loop a sample with vibrato, because not only do you have to match up the basic waveforms, you also have to ensure that you've looped a whole number of complete modulation cycles, otherwise you end up with a repeating 'hiccup' in the vibrato.

Slightly Techie Corner: Nyquist, Sample Rates And Resolution

Sampling is just like any other digital recording system, in that the higher the sampling rate, the higher the bandwidth of the sampled signal. The rule of thumb when sampling is that the bandwidth of the sampled signal is around half the sampling rate, so if you sample something at 16kHz, you end up with an 8kHz audio bandwidth. This is simply due to the maths of sampling, first worked out by a guy called Nyquist, which states that you need to sample at least two points on a cycle of your highest frequency waveform to recreate it accurately. If you drop below two samples per cycle of waveform, dissonant frequencies not actually present in the original signal are recreated, an effect known as 'aliasing'.

Most modern samplers work at 16‑bit resolution, which gives a signal‑to‑noise ratio of around 90dB, though Akai's older S900s and S950s (for example) work with just 12 bits, yielding a lower S/N ratio. Note that the number of bits doesn't affect the frequency response, only the noise and distortion performance. Akai's 12‑bit machines actually sound very good, and the S950 in particular is subjectively as clean as some 16‑bit machines, due to its filtering capabilities.

To extend your sample memory, you can opt to use a lower sampling rate, but it isn't always easy to decide what can be successfully sampled at a lower bandwidth, because of the differing harmonic structure of various sounds. For example, you may be interested to note that the harmonics in an acoustic bass drum sound extend right to the top of the audio spectrum, and any attempt to drastically reduce the bandwidth will result in a sound with less attack and definition. On the other hand, a bright, searing lead guitar can usually be sampled with a bandwidth of 8kHz, or even less, because a typical guitar speaker produces very little above 5kHz or so. The key is to try it and see. Don't worry about the technicalities — if it sounds good in a musical context, it's OK.

Another point to note is that because sampling is a digital process, you need to sample signals at the highest possible level to get the best signal quality and the lowest noise. However, if you go too far and 'clip' the signal, the chances are that it will sound pretty dreadful — digital recording has no margin of safety, unlike an analogue recorder, when it comes to distortion. If the sound you're trying to sample isn't repeatable, it may be better to record it to tape first and then sample it, so that you have the chance to try again if it doesn't work out first time. It may also be worth using a compressor/limiter to increase the average level of your signal prior to sampling.