0 10 ②70 ③2 ④12 ⑨132¢¢Sound sampling: what it is, how it's done, and how to get the most out of it.¢¢By Dean Garraghty,N.D.¢¢¢ This article is split into two main parts. The first part will talk about sound sampling in general, and the second part will talk about samplers available for the Atari 8-bit, and how to get the most from them.¢¢¢PART 1 - SOUND SAMPLING IN GENERAL¢¢¢ Many people talk about sound sampling (or digitizing) without really understanding what it is, and how it is achieved. This part of the article will hopefully clear this up.¢¢ Sound sampling is a way of converting real sounds into a form that a computer can store, and replay. Natural sound is in analogue form. Analogue means that something is continually changing, or to put another way, that it has no definate value. Sound waves are a subject on their own, but you should know that sound has a frequency. This frequency dictates the pitch of the sound we hear. This frequency is measured in Hertz (Hz). If the sound oscillates at 50 times a second, then its frequency is 50Hz, and so on. The higher the frequency, the higher the pitch of the sound. If you don't understand this, then don't worry. It's not vital to the article.¢¢ Analogue is obviously no good for a computer, as a computer needs definate values. A computer is a digital device. This means that it needs definate values (0s and 1s in the case of a computer). So what we need to do is convert our analogue sound wave into a series of numbers for the computer. This is done by a device called an "analogue to digital convertor", or A/D convertor as they are usually known.¢¢ An A/D convertor works by "sampling" the wave at regular intervals (in this case the sound wave). At each sampling it samples the wave and turns it into a number for the computer. It does this a fixed number of times per second. This is called the sample rate. A high sample rate means that the wave is sampled more times per second than a low sample rate. E.g. a sample rate of 16KHz means the wave is sampled 16,000 times a second. The following simple graph will show how an analogue wave is converted into digital data:¢¢¢(I have a diagram of this in the form of a .PIC file on this disk. You can see it by running the program: SEEATOD.BAS from the menu)¢¢¢ This method of A/D coversion is called "successive approximation", because it keeps taking approximations of the wave.¢¢ Once the sound has been sampled, it can easily be stored in the computer's memory. How the sound is played back depeneds on the computer, but in general it works like this:¢¢ The computer takes the data for the sample, and very rapidly "puts it through" the computer's sound chip. By making the TV speaker vibrate at the correct rate, a fairly close representation of the sound can be played back. How good the quality is, depends on the sample rate at which it was sampled. The speaker vibrates at the frequency corresponding to the pitch of the sound. I will explain how it's done on the Atari in the second part of the article.¢¢¢PART 2 - SOUND SAMPLING ON THE 8-BIT ATARI¢¢¢ You should now know the principles of sound sampling, so I will now go on to talk about sampling on the 8-bit Atari.¢¢ You will now be wondering how sampled sound is played back on the Atari. Well, it uses a feature of the Atari's sound chip (Pokey) called "volume only sound generation". This is done by turning on bit 4 of AUDC1 (or 2,3,4). A speaker creates sound by moving a paper cone in and out. The force with which it does this determines the volume. Type the following from Basic:¢¢ POKE 53761,31¢¢ You will hear the TV speaker click. We have set bit 4 on, and set the volume to 15 (16+15=31). Now type:¢¢ POKE 53761,15¢¢ You will hear another click as the speaker retracts.¢¢ By using the volume, and bit-4, the computer can recreate the sound, by very quickly moving the speaker in and out.¢¢¢ Phew! That's got the heavy stuff out of the way! Now let's talk about some specific samplers for the Atari, and how to get the most out of them.¢¢ If you already own a sampler, then you should find the rest of the article of some use. If not, then you should consider getting one! (see later for details).¢¢ Quite a popular sampler for the Atari was "Replay" from 2-bit systems. I say "was" because it's not available any more. This is the sampler I use, and it creates good quality samples. If you own "Replay" then the following tips should come in useful:¢¢ A good sound source is essential (as with any sampler). Try and get one with a graphic equalizer (at least 5-band). Just keep adjusting each band until the quality of the sound is acceptable. Don't bother using the calibrate function. Just select Sample, and when the line comes on the screen, play your sound through for adjustments. The higher the volume you play the sound at, the more distortion will occur. So, keep volume as low as possible.¢ Replay will only allow you to sample as low as 6KHz. But what if you want more than 9 secs. of sample? The answer is easy. All you need is a tape recorder with a high-speed dubbing facility. Simply "pretend" your copying a tape, and select the high-speed dub. on your recorder, and sample the sound at the high speed using a sample rate of 6KHz from Replay. Then when you play it back from Basic, use a play rate of 14. You should get about 14 secs. worth of sample. Some recorders will have a different speed for high-speed dub. Mine seems to play it at about 1 and a half times normal speed. If your's does it at a different speed then you will just have to experiment with different play rates. But note that the quality will not be as good, but should be acceptable if you were careful with volume and the equalizer.¢ Another thing you may want to do, is to leave the screen on while the samples are playing. The screen has to be turned off to play the samples properly, but you can leave the screen on if you want (expect a severe drop in quality, though). You can do this by typing:¢¢ POKE 1597,10¢¢ after first loading the M/C player data into memory. The screen will now be left on during playing. If you want the screen to be turned off as normal, then just type:¢¢ POKE 1597,0¢¢¢ The following tips are for ASP users:¢¢ Antic magazine published the schematic diagrams for a digitizer in its Feb/March 1990 issue, and had the player and sampler software on its issue disk. It's called ASP (for Antic Sampling Processor). I haven't got around to building it yet, but the samples supplied with it sound of good quality. It comes with a Basic player routine, which can easily be altered to load Replay samples. You just have to take the bits out where it works out where to place it memory, and where it loads the header bytes from the sample file. Then just specify the length, etc. yourself. I have another tip for ASP users, but it won't seem of much use until you've read the next section on sound editing, so I'll tell you about it there.¢¢¢2.1 - GETTING THE MOST FROM YOUR SAMPLER¢¢¢ Many people just use their samplers for speech, or just to sample a few seconds of music from a tape. Of course, you are very limited by memory, but by editing what you can fit in memory, you can create a good, long tune. This will require a bit of work on your part, but the result is worth it! Here's how:¢¢ You will first need to find some music that is fairly repetative (Jean-Michel Jarre and Penguin Cafe Orchestra are good ones). This is because of the limited sample space you will have available. You will want the result to sound something like the original, so it's useless trying to re-create something like a rap, where every bit is completely different!¢¢ Having found your tune, you should listen to it a few times, so that you can decide which bits are to be sampled. Make a note of these.¢¢ Now you should sample the bits of the tune you want. By sampling several distinct phrases of the music/song, you can play them in different orders and pitches to create quite an interesting song.¢¢ Having sampled the bits of the music, you should now work out where they start and end in memory (don't forget that you will be playing the sounds back from Basic, or M/C if you're really good!) Make a list of these.¢¢ You should now work out in what order and pitch you're going to play these in to create your tune. After doing this, you can now go on to write your program to play them.¢¢ I have done loads of edited sound samples. See my current PD list for details of these disks.¢¢ Replay owners: to stop the screen from flashing on and off during playback, simply have POKE 559,0 at the start of the program.¢¢¢ ASP owners: here's the tip I mentioned earlier. To stop the screen from flashing on and off during playback you will need to modify the M/C player routine. On line 850 in the PLAY.BAS program, change the 34 to a 0. Then you should have POKE 559,0 at the start of your program.¢¢¢2.2 - SAMPLERS AVAILABLE¢¢¢ There are still a couple of samplers available. As mentioned earlier, ASP from Antic is by far the cheapest, but you have to build it yourself.¢¢ The other alternative is Parrot II. This is available from Gralin International. This is also a good sampler, and also has synthesizer capabilties. I haven't actually got this, but I have the PD demo disk for it, and it sounds impressive. Parrot is a little pricey, but should be worth it if you can afford it! I have the PD demo disk in my PD library. A copy will cost 2 pounds.¢¢¢PART 3 - SUMMING UP¢¢¢ You now know how samplers work, and should be able to get more out of them. If you have any questions about sampling, then feel free to write:¢¢Dean Garraghty, 62 Thomson Ave, Balby, DONCASTER, DN4 0NU.¢¢(Please enclose a SAE if you are not ordering at the time).¢¢¢