VOL. 8, NO. 8 / FEBRUARY/MARCH 1990 / PAGE 11
By Steven Lashower
Build yourself a sampling processor for under $15 - and create sound samples for your own BASIC programs. This slick, machine-language software can be used on 8-bit Atari computers with at least 48K memory.
This issue 's Super Disk Bonus is the Antic Sampling Processor, a
high-powered audio digitizer written in fast machine language by Steven
Lashower, who programmed the very popular Antic Music Processor which appeared
in the December 1989 and July 1990 issues of Antic. Antic Sampling Processor
requires a bit of hardware construction, with some basic knowledge of
electronics and soldering, but the results are well worth the effort. To hear
just how good these results are, you can play the music samples included on this
month's Antic Disk. No special digitizer hardware is required for playing back
the sounds recorded into your 8-hit Atari by the Antic Sampling Proessor.
Lashower also provided a very well-documented player utility written in
BASIC, for use with your ownprograms. We are looking forward to your Disk Bonus
submissions which employ digitized speech and sound effects, created with The
Antic Sampling Processor.
DIGITIZING AND MIDI
The Antic Sampling Processor (ASP) is a sophisticated combination of Atari 8-bit software and hardware audio digitizing technology. Written in MAC/65 assembly language, ASP captures pure digital sound (through a process called sampling or digitizing) from any stereo or amplifier source.
In the July 1983 issue of Antic, an article called Talk Is Cheap by Ed Stewart gave specifications for an 8-bit Atari digitizing circuit on which the ASP hardware is loosely based. The new circuit was designed by John Shook and Jim Burgess of the Disneyland Sound Department. The software is written in MAC/65 with core digitizing routines for recording and playback based on the old 1983 routines.
Once the sound, or sample is stored in the computer's memory, you can play it back at any speed -- forward or backward. Some commercial recordings have various sounds and vocals recorded in reverse. Since Antic Sampling Processor has a back-masking feature that allows you to play your samples backwards, you will be able to hear those special parts of the Beatles' notorious "Revolution #9" without ruining your phonograph.
No sampler is complete without MIDI support -- Antic Sampling Processor is compatible wit Hybrid Arts' MIDI interface and any MIDI-capable synthesizer. With a synthesizer, you can actually "play" the sound samples, thus turning your Atari into a low-cost high quality, digital sampling work-station. For the programmer, Antic Sampling Processor comes with some easy-to-use routine's written in Atari BASIC that load and play Antic Sampling Processor samples.
RUNNING ASP
To record your own samples, you will need to build the digitizer as shown below. However, you can run Antic Sampling Processor and play pre-recorded files without a digitizer.
Use DOS command [C] to copy ASP.COM to another disk that contains the DOS.SYS file (DOS 2 or 2.5). Then use command [E] to rename "ASP.EXE" to "AUTORUN.SYS". Turn your computer off, remove all cartridges, and turn your computer on again (XL/XE users hold down [OPTION]. Antic Sampling Processor will load and run automatically.
SAMPLE TEST RUN
With the ASP Main Menu onscreen, insert your copy of this issue's Antic Disk in drive 1 with Side B up. Press [L] to load a file, and at the prompt type D:SLOOPJB.ASP [RETURN]. Once the file loads, press [P] to play.
To see the color display during playback, press [C], then play the sample again. Press [B] to play it backwards. Press [O] to change the playback rate -- enter 20 and then press [RETURN] to play the sample faster.
HOW IT WORKS
Every sampler needs a hardware A/D (Analog to Digital) converter that enables it to translate speech (analog information) to data that the computer can understand (digital information). We are indeed in luck because the Atari joystick ports are actually A/D converters. The Atari paddle controllers are analog input devices.
As the controller (or paddle) is turned, the converter generates a count in response to circuit resistance the time it takes for a capacitor inside the computer to charge up. Turning the knob to the right lowers the resistance, so the capacitor charges up quickly. Turning the knob to the left increases the resistance and the charging time. If these resistance changes are recorded fast enough, and if they have a direct relationship to the sound waves produced by speech, then we can read these numeric values from a paddle port and store them in the computer as speech patterns.
A simple hardware circuit is required to convert the voltage produced by any audio source into a variable resistance that the computer reads. These values are read at very high speeds (approaching 5,000 times per second, the sampling rate) and stored in memory. Then they are sent to the video speaker to produce a voltage which is in direct propertion to paddle resistance. The result is a pretty good reproduction of whatever sounds were played through the circuit. Admittedly, the higher the sample rate the less distortion during playback. But saved samples are notorious RAM hogs.
Item Description Radio Shack Part# Price 9-pin female cbnnector 276-1428 $1.19 Hood for 9-pin connector 276-1539 $1.19 Phono Plug to Stripped Wire 42-2370 $1.69 1.0 uF capacitor 272-1434 $ .59 NPN transistor (NTE 123AP) 276-2058 $ .49 1M Ohm potentiometer 271-229 $ .69 100K Ohm potentiometer 271-220 $ .69 100K Ohm fixed resistor 271-045 $ .19 IC-Spacing Perfboard 276-1365 $1.79
BUILDING THE CIRCUIT
The ASP circuit can be built for about $3 and all parts are available at almost any electronics store, including Radio Shack. One of each of the following items is required to build the circuit shown in Figure 1.
Note that Radio Shack 9-pin female connectors will not work directly with the Atari 130XE and XEGS computers because the shield surrounding the connector is too large. You can solve this problem with a joystick extension cable, available from Radio Shack or from just about any toy store or department store that sells video game accessories for the Atari and Sega game systems. Plug the female end of the joystick cable into the XE computer, and the male end into the connector for this digitizing circuit. The "ears" in the Radio Shack connector do not interfere with this setup.
The small AC current sent to the digit circuit from your audio source causes the base current to change through the transistor. This in turn varies the effective resistance presented to the paddle port. The computer believes that a paddle controller is connected and is being turned back and forth at a very high rate. The 1M pot is used as the circuit's gain control to get rid of most unwanted noise during program execution. The 100K pot is used to control input volume into the circuit.
A patch cable can be used to connect the RCA phono plug to any receiver/amplifier. I have found that the best sampling results can be obtained by recording from a small, portable cassette deck with a MINI (1/8 inch) earphone output. To do this, you will need a PHONO to MINI converter plug (Radio Shack #274-330 - $1.69.) Make sure that the volume level on the cassette is turned almost all the way down, assuring as little distortion as possible.
USING ASP
Start the Antic Sampling Processor program as outlined above. To sample any new sounds of your own you must plug the digitizer circuit into the second joystick port. Select from ASP's nine functions on the Main Menu by typing the highlighted letter that appears just to the left of the function name.
[P] Playback Sample. Use [P] to play a sample stored in memory.
[R] Record Sample. Use [R] to record a new sample storing it in memory.
[T] Test Microphone. With this option, ASP digitizes audio for an unlimited period of time, echoing the data it receives through the computer speakers so you can adjust volume and noise control potentiometers. The sample is not stored in memory. Press [RESET] to return to ASP's main menu.
[L] Load Sample. This command loads in a digital sample file from the disk drive specified (Dn:filename.ext). Drive 1 will be used if no drive number is specified. (You may use a RAMdisk of 40K or larger.) The sample is loaded into the same area of memory from which it was saved. Please see [O] Set Options for more information on memory management.
[S] Save Sample. Save a digital sample in memory to a disk. Type [S], then enter a filename. If you do not specify a drive, the file will be saved to drive 1. Please note that sample files can get quite large (over 32K, or 250 sectors). Disks fill up quite fast.
[C] Color Display. Use [C] to toggle the Color Display option ON or OFF. When the color option is enabled, a graphic display flashes different colors on the screen in response to the audio data. This visual effect only works during playback. [B] Back-Masking. Plays your sample backwards. Use [B] to toggle the Back-Masking option ON or OFF.
Using Back-Masking, you can really experience some weird and unusual sounds. Some major rock-and-roll groups use backmasking to record special audio effects. For example, try sampling the Beatles' "Revolution #9" from their White Album or the Electric Light Orchestra's "Fire on High" from their album, Face the Music. The voices that seemed to be speaking gibberish will speak in pure and clear English once played back with ASP's Back-Masking feature.
[M] MIDI Playback. Plays the sample through an attached MIDI device. Use [M] to toggle the MIDI Playback option ON or OFF.
MIDI Playback requires a MIDI compatible synthesizer (the Casio CZ series instruments are great, low-cost, full featured MIDI synthesizers) and a Hybrid Arts (or compatible) MIDI interface. A MIDI cable connected from MIDI-OUT on the synthesizer to MIDI-IN connector on the Hybrid Arts box is also necessary. ASP requires that the synthesizer transmit data through MIDI Channel 1.
Once MIDI Playback is ON and a sample is in memory, type [P] for playback, and then play some notes on your synthesizer's keyboard. Since Antic Sampling Processor acts as a monophonic sampler (a synthesizer that can play only one note at a time), make sure that you only press one key at a time on your synthesizer. On my 61-key synthesizer, I have found that the upper two keyboard octaves yield the best results for actual playing. For extra fancy sounds, try Back-Masking in conjunction with MIDI-Play.
(We are not equipped to test MIDI operation with ASP. -- ANTIC ED)
[O] Set Options. Use this to change the sampling rate for playback and record, as well as sample length and location in memory. A flashing cursor appears on the second status line located in the upper half of the screen. Change the sampling rate for playback [P] and recording [R] by using the [LEFT & RIGHT ARROW KEYS]. Note that ASP uses hexadecimal values for these settings. Press [RETURN] to save the new values in memory and return to the Main Menu. Press [ESC] to return to the Main Menu without saving any changes.
More advanced users will appreciate the ability to change the length of the sample and its memory location. If you're familiar with the way data is stored in the computer, you may use this function to change the address where the sample is stored in memory. Multiple samples can be stored in memory. Antic Sampling Processor allocates the area of memory from $2B00 to $BC00 for sample storage.
BASIC ROUTINE
How would you like to use some of the samples in your own BASIC programs? Well, its no problem because Antic Sampling Processor comes with some easy-to-use routines that you can implement in your own programs. Extensive REMarks make PLAYER.BAS easy to follow. You could use it to try to make a Battleship-type game where the computer actually calls out coordinates, hits, and misses, for example. The possibilities are endless.
Steven Lashower studies Computer Science at California State University, Fullerton, and works at Disneyland. His Antic Music Processor appeared in the December 1988 issue of Antic, and the new, improved AMP, Version 2.0 with lyric editor ran in June 1989.
Listing1:ASP.COM
Listing2:PLAYER.BAS
Listing3:PLAYER.M65
Listing4:GBUSTER.ASP
Listing5:JACKSON.ASP
Listing6:RPALMER.ASP