From A2wiki
Jump to: navigation, search

From: tdiaz-a(in_a_circle)-apple2-dotsero-org (Tony Diaz)
Newsgroups: comp.sys.apple2,comp.answers,news.answers
Approved: news-answers-request@MIT.EDU
Followup-To: comp.sys.apple2
Subject: Apple II Sound & Music Frequently Asked Questions (FAQ)

Archive-name: apple2/cdrom
Posting-Frequency: monthly
Last-modified: August 21 2007
Version: 1.7

Apple II Sound & Music FAQ

An introduction to music and sound on computers.

Music and sound have been a computerized pursuit since at least the 1960s, when enterprising hackers discovered that by programming the large mainframes of the time to do different operations, different tones could be generated on a common AM radio from the interference (this is still a problem today :-).

Early synthesizers developed at the time (known as Mellotrons) consisted of a huge bank of tape loops, with each key playing a different tape. Primitive analog tone generators were also in use. These early synthesizers first got wide industry exposure via Walter aka Wendy (never mind) Carlos' "Switched-On Bach" album. At this time (mid to late 60s), Robert Moog developed the direct ancestors of today's synthesizer. Moog's synthesizers were programmed via 'patch bays', wherein the user would connect a series of jacks in a specific configuration via patch cords to get a certain tone. This use of the word 'patch' for a sound setting on a synthesizer persists, despite that today a 'patch' is usually a data file stored on disk or in ROM.

The Moog's debut in a Top 40 song was Del Shannon's "Runaway". A Moog was used along with a tube-based analog synthesizer called a theremin in the Beach Boys' classic "Good Vibrations". The possibilities of synthesizers weren't really exploited until the onslaught of 70s 'art-rock' bands such as the Who, Supertramp, ELP (Emerson, Lake, and Palmer), Genesis, Yes, Pink Floyd and Rush. Synthesizers have continued to advance to the point where they are now the only instrument needed to make a typical Top 40 or rap album. This was foreseen somewhat by Boston, who included a "No Keyboards!" logo on one of their early albums despite the obvious inclusion of a Hammond organ on several songs.

Computer control of music developed somewhat later, however. Several companies in the early 1980s had competing systems for allowing electronic synthesizers to interface to computers and each other, Roland's "CV-Gate" system being among the most popular. Around 1983 or so, a group of companies developed the now ubiqitous MIDI (Musical Instrument Digital Interface) standard. It is now very difficult to find a synthesizer without MIDI capabilities, and all popular computers can be interfaced to MIDI instruments, including the Apple II.

The first development after MIDI was introduced was the "sequencer" program, a program which allowed the recording and playback of MIDI data streams, as well as sophisticated editing functions. This allowed perfect playback of songs every time, as well as more advanced functionality such as the ability to synchronize MIDI data with SMPTE (Society of Motion Picture and Television Engineers) time code, a fact which made it very simple to add MIDI-based music to television shows and theatrical films and synchronize to a resolution finer than 1 frame. SMPTE and MIDI were used heavily in the production of the soundtrack for the recent blockbuster "Jurassic Park" for example.

At about the same time as the first sequencers were arriving, computers began to get sound chips with some semi-decent capabilities. Machines such as the TI-99/4A and Atari 800 had chips capable of playing at least 3 independent tones at any one time. However, the tones were preset, usually to a square wave, which has very little musical interest. This went to the next step when a young engineer developed the SID sound chip for the Commodore 64 computer. The SID chip could play 3 tones at once [plus 1 channel devoted to 'white noise' percussive sounds], and each of the tones could be selected from a range of several waveforms. In addition, advanced effects such as "ring modulation" were avalible on this chip. The C=64 soon allowed many to compose some amazing tunes, but the best was yet to come.

The engineer who designed the SID went on to join a company called Ensoniq, where he designed the DOC (Digital Oscillator Chip) which powered the company's now legendary Mirage synthesizer. The Mirage was unique in that it was the first major synthesizer to offer sampling, wherein you could digitally record any sound you wanted, from trumpets to snare drums to water dripping, and use it as an instrument. Best of all, the DOC chip could play up to 32 samples at any one time, making it useful to emulate a whole orchestra with one Mirage. The DOC chip also powered Ensoniq's ESQ-1 and SQ-80 synthesizers.

Now, to get some Apple II-ish relevance. During the design of the Cortland (aka IIgs), Apple was planning on using a chip not unlike the one on the Mac II series. This chip played 4 samples at once, but was limited in it's stereo capabilities (you got 2 samples on the left, and 2 on the right, and that's it) as well as overall flexibility (it's limited to 1 fixed sampling rate of 22,050 Hz). Luckily, Ensoniq sent a sample of the DOC chip to Apple, and it ended up in the hands of a music enthusiast working on the IIgs project. This engineer fought with management until they decided to use the DOC chip for the IIgs. However, up until nearly the last minute, the DOC and it's 64k of RAM were to be an extra-cost feature, which would have killed the GS music software market dead. Luckily, price drops on components allowed the DOC to be standard, so all IIgs owners could hear great sound.

Back to generalized things, the next development was to combine sampling and sequencing software on capable computers. This resulted in the *Tracker genre on the Amiga, as well as Music Construction Set, Music Studio, and other programs on many platforms. These programs typically had a sequence file and a series of sample files used as instruments, with some notable exceptions (the *Tracker series on the Amiga had all-in-one 'modular' files, hence the name MOD).

8-bit music and sound

The 8-bit IIs are quite underpowered in the sound department compared to the IIgs. However, anyone who's played Dung Beetles or Sea Dragon knows that some pretty sophisticated stuff is still possible. The 8-bit sound normally consists simply of an ability for programs to make the speaker click. If a program toggles the speaker very fast, tones are generated. And using other techniques beyond the scope of this FAQ, you can even play digitized samples on the speaker, although the quality isn't very good unless you can somehow hook up external speakers. You can hear for yourself with Michael Mahon's Sound Editor 2.2, which is currently available from his web page at:

There have also been a variety of sound expansion boards available for the 8-bit IIs, but the only one to really catch on was the venerable Mockingboard. The Mockingboard was available in several packages. The Mockingboard "A" was the base card, which added 6-voice music and sound synthesis to to any alotted II. The Mockingboard "B" was a daughterboard that worked with the "A" and added speech synthesis capabilities. The Mockingboard "C" was essentially an "A" and "B" in one package. The later Mockingboard "D" had the same capabilities as the "C", but attached to the Apple IIc via the serial port.

Types of sound files found on the IIgs

Several types of sample files are used. Here are the most common.

Raw no std. BIN Contains only raw sample data. The auxtype
is normally the sample rate divided by 51.
(See section CA for more on why this is).
ACE .ACE $CD Contains raw sample data compressed with ACE,
Apple's Tool029 sound compressor.
ASIF no std. $D8 Contains sample data plus additional data.
Notable due to its use by SoundSmith.
AIFF .AIFF $D8 Interchange format popular on the Macintosh.
Not used much on the IIgs.
HyperStudio no std. $D8 Contains raw or ACE compressed data plus
additional information.
rSound no std. $D8 Resource fork contains one or more rSound and
rResName resources. Used by HyperCard
IIgs and the Sound CDev.

An introduction to sampling

Sampling is conceptually simple; an incoming analog sound signal is converted to a digital number (0-255 on the IIgs). Getting good samples depends on a number of factors:

  • Sampling rate. This is how often in samples per second the incoming signal is actually noticed and saved. In general, you want to have a sampling rate of twice the frequency of the highest pitch sound you intend to sample. (The reasoning behind this is known as the Nyquist Sampling Theorem). Compact discs sample at 44,100 Hz, which means they can accurately track signals up to 22,050 Hz, beyond the range of human hearing. Long-distance telephone calls are sampled at 8,000 Hz, since the characteristic part of human voices is generally from 1000-3000 Hz. If frequencies higher than or equal to half your sampling rate exist, they will manifest as distortion in the output sample.
  • Stereo card quality and shielding (the Audio Animator makes the best samples of any card I've tried, by far).
  • Input signal level (the higher the better, except that there is a threshold known as the 'clipping level' above which the sampler will be unable to track the signal. Analog tape recorders do something very similar).

Once a sample is made, it can be manipulated in a variety of ways via mathematics. Because this processing is digital, no degradation of the signal can occur, unlike with analog processing. Some effects which can be done include:

  • Cut and pasting parts of the sample around.
  • Mixing/overlaying two samples.
  • Flanger/Chorus effects.
  • Amplification and deamplification.
  • Echoing
  • Filtering and equilization

and much more...check out a modern rack-mounted guitar digital signal processor for all the things possible :)

To digitize a sound (I'll use AudioZap as the example, others are similar):

  • Hook everything up.
  • Check the oscilloscope. The wave should be barely touching the top and bottom of the 'scope. Any higher and the sound is clipping; any lower and you'll get a poor quality recording. Adjustment methods vary by card; for the Sonic Blaster card AZ can adjust it in software. Otherwise, consult your card's manual.
  • Select a recording rate (lower numbers on AZ = faster).
  • Click Record and cue up your tape or CD.
  • Select Ok and then start the tape or CD.
  • Click the mouse and stop the tape or CD when you are done.

You've just made a sample! congratulations! can't hurt anything, but may discover fun/neat things to do!

Some basics on editing sounds.

(This section attempts to be program-independent, but in some cases specific refrences to AudioZap may sneak in :-)

I'll assume you now have a sound loaded up, and whatever program is showing you a nice wave graph. Now, you can pick out portions of the wave by simply clicking and dragging the mouse over a part of the wave, and letting go when you have as much as you want. If you now try to Play, you'll only hear the portion you have selected. If you need to adjust your selection range, many programs allow you to shift or apple-click and extend the endpoints instead of just starting over with a new range.

Once you have an area selected, you can cut/copy/paste/clear just like you would text in a word processor. When pasting a waveform, you simply click once where you'd like, and select Paste. The program inserts the previously cut or copied piece of wave and moves the wave over to make room, just like with a word processor.

For more specific information, consult the documentation for the program you use.

AE Types of music files

MCS None MUS Music Construction Set tune.
TMS .SNG BIN Music Studio song.
SS None MUS SoundSmith song.
NTMOD None INT NoiseTracker GS module
NTSNG None BIN NoiseTracker GS song.
MOD None $F4 Amiga ProTracker module ($F4 is temporary).
MIDI .MID MDI Standard MIDI file.

A brief overview of SoundSmith style editors.

SoundSmith (and all other MOD derived editors) use a very simplistic way to representing music, to wit:

0  C5  1000  --- 0000
1  --- 0000  --- 0000  ... additional tracks here
2  G5  33FF  G5  53FF
3  --- 0000  --- 0000
4  C5  1000  --- 0000

This is often known as a 'spreadsheet' format since there are rows and columns much like a spreadsheet. Let's take a look at an individual cell:

Number of cell
|     Instrument number
|      |  Effect data
|      | /|
2  G5  33FF
   /\   |
   ||   Effect number
  Note and octave

For this note, it's #2 of 63 in the pattern, it's a G in octave 5, using instrument number 3, effect 3, and data FF. What effect 3 actually means depends on the tracker in question. On SoundSmith and derivatives, it means "Set the volume to --", in this case set it to $FF (255) which is the maximum.

Now, into a larger structure. 64 lines of cells makes up a block, or pattern as it is sometimes called. (some Amiga and PC editors allow blocks of varying lengths, but we won't consider those here). You can terminate a block early with a special effect. On most trackers, an actual effect number is used. On SoundSmith, entering the note/octave as NXT makes that line of cells the last line played in that block.

Now that we've covered cells and blocks, we can get into the large-scale structure of things. To make a complete song, we can give the player a 'block list' which tells it to play a specific sequence of blocks in a specific order. For instance, we could have it play block 4, then block 0, then block 1, then block 2, then block 2. An entry in the block list is known as a 'position'. MOD-derived formats typically allow 128 positions, and 64 (MOD) or 71 (SoundSmith) blocks.

For those of you with (gasp!) other machines and more modern trackers, you'll notice many of these trackers have a 4th column in each track. The extra column is usually a volume level for the track, where 0 means "don't change" and all other values do - this helps to preserve effects and make things more flexible. Also, nearly all limits associated with the original MOD format are no longer in force - Impulse Tracker on the PC, probably the most advanced tracker available today, offers 64 tracks, up to 32 megabytes of samples, and nearly unlimited blocks and positions.

A Practical Example:

Crank up MODZap 0.9 or later and a favorite tune. Set it to the "Classic Player". Now, remember those numbers you never understood before, off to the left of the scrolling cells? Here's what they mean, in terms of what you just learned: *grin*

This is the # of entries in the block list      >  35  --- 0000
This is the current block list entry playing    >  04  --- 0000
This is the block # currently playing           >  01  --- 0000
This is the current cell # in the current block >  36  A#4 0384

As you watch, the current cell # will normally (barring certain effects) smoothly go from 00 to 63. When it hits 63, it will go to 00 again and the current block list entry number will increment by 1. When it does, the current block number will change if needed (remember, a block can appear multiple places in the block list).

An Overview of MIDI

MIDI is a specification developed to allow computers and electronic musical instruments to communicate with each other. Physical MIDI hookups can get rather complicated; here is a brief primer:

MIDI hookups are a lot like your stereo, in that each device has IN and OUT ports. However, MIDI devices also have a port known as THRU, which retransmits information from the In port (more on why this is a Good Thing later). MIDI devices are thus connected in a modfified daisy-chain arrangement, with the Out of the master (usually a computer) connected to the In of Slave #1, and Slave #1's Thru connected to Slave #2's In, and so on. The Outs of all devices go to the In of the master.

Here is a diagram of a simple hookup:

|    ----------------               |
|   |   ___________  |     -----    |
|   |  |           | |    |     |   |
In In Out         In Out Thru   In Out Thru
Computer          Synth         Drum Machine
(Master)          (Slave #1)    (Slave #2)

MIDI is based on 16 'channels'. Each channel is typically assigned to one specific device you have connected in your chain. In the example above, you might have the synth set to listen to channels 1-9, and the drum machine set to listen to channel 10 (this is a typical assignment). With this setup, when the computer transmits a note on channel 10, it will first go to the IN of the synth, which will simultaneously retransmit it via it's THRU port and notice that it doesn't want to use the data. The note will then appear on the drum machine's IN port. The drum machine will transmit it on it's THRU port (to which nothing is connected in the example) and start the note. This allows flexibility; if for instance you wanted you could connect a second drum machine with different sounds, set it to channel 10 also, and have a unique mix :)

I will not cover MIDI recording and editing here, because there isn't really any good MIDI software on the IIgs to cover. That's life.

Technical Specs for the GS Ensoniq chip

The 5503 Ensoniq Digital Oscillator Chip (DOC) contains 32 fundamental sound-generator units, known as 'oscillators'. Each oscillator is capable of either making an independent tone by itself, or of being paired up cooperatively with it's neighbor in a pairing known as a 'generator'. The generator arrangement is used by most programs, for it allows more flexibility and a thicker, lusher sound.

The DOC plays 8-bit waveforms, with the centerline at $80 (128 decimal). This format is known as "8-bit unsigned". $00 (0 decimal too) is reserved for 'stop'. If a sample value of 0 is encountered by a DOC oscillator, the oscillator will immediately halt and not produce any more sound. The DOC additionally has an 8-bit volume register for each oscillator, with a linear slope. The dynamic range of the DOC (the 'space' between the softest and loudest sounds it can produce) is approximately 42 dB, or about on par with an average cassette tape.

Each oscillator has it's own 16 bit frequency register, ranging from 0 to 65535. In a normal DOC configuration, each step of the frequency register increases the play rate by 51 Hz, and computing the maximum theoretical play rate is left as an exercise for the student.

When oscillators are paired to create generators, there are 4 possible modes:

  • Free-run: the oscillator simply plays the waveform and stops. No interaction with it's 'twin' occurs.
  • Swap: Only one oscillator of the pair is active at a time. When one stops, the other immediately starts.
  • Loop: The oscillator simply plays the waveform and if it hits the end without encounter.cgiing a zero, it starts over at the beginning.
  • Sync/AM: This actually has 2 possible effects: either one oscillator of the pair modulates the volume of the other with the waveform it's playing, or both oscillators sync up perfectly, causing a louder and more 'solid' sound.

Oscillators play waves stored in up to 128k of DRAM. This DRAM is not directly visible from the GS's 65816 CPU, but can be accessed (slowly) via services supplied by the Sound GLU chip. Note that no widely manufactured IIgs motherboard supported the full 128k of DRAM that the DOC can see. Conversely, no synthesizer Ensoniq made using the DOC had anything less than the full 128k.

The output of an oscillator can be directed to any one of 16 possible channels. Apple only makes 8 channels avalible via the 3 bits on the sound expansion connector, and all current stereo cards limit this to 1 bit, or two channels. However, the "Bernie II The Rescue" IIgs emulator for the Power Mac expands this support to 4 discrete output channels, two of which are encoded to the rear channel for Dolby Pro-Logic compatible output. No IIgs software that I'm aware of supports more than 2 channels however.

About IIgs Stereo Cards

MDIdeas SuperSonic First IIgs stereo card. Not very well
constructed, but sounds nice. Digitizer
option pretty good.
MDIdeas Digitizer Pro Daughterboard for SuperSonic, but also takes
up another slot in your GS. Pretty good, but
very few were sold.
Applied GStereo I've never used one; anyone?
Applied FutureSound Most advanced card made. Includes
Visions sophisticated noise reduction, coprocessor, and
timing generator for ultimate control of
sampling rates.
Applied Sonic Blaster Generally poor to average card; boneheaded
Engineering decision to use non-shielded ribbon cable
results in hissier than average output and
Applied Audio Animator The one they got right. Has digitizing
Engineering circuitry external to the GS itself to avoid
noise, plus a MIDI interface.
Econ Tech. SoundMeister Generally above average quality. Nothing much
to say. Pro version with direct-to-harddisk
recording cancelled.

What about them other machines?

Here's a rundown of sound on other computers...

Computer or Card     Wavetable voices  WT bits  FM voices  Stereo?  Digitize?
Apple IIgs                 32            8       None       Yes(4)  Yes  8 bit
Soundblaster                1            8        11        No      Yes  8(4)
Soundblaster Pro            2            8        20        Yes     Yes  8
Soundblaster 16             2           16        20        Yes     Yes  16 bit
Soundblaster 16 AWE32/64   32           16        20        Yes     Yes  16
Pro Audio Spectrum 16       2           16        20        Yes     Yes  16
Gravis UltraSound          32         8/16       None(2)    Yes     Yes  16(4)
Gravis UltraSound Max      32         8/16       None(2)    Yes     Yes  16
Gravis UltraSound PnP      32         8/16       None(2)    Yes     Yes  16(11)
Logitech SoundMan Wave     20           16        22        Yes     Yes  16
Commodore Amiga (all)       4            8       None       Yes     Yes  8(4)
Mac (non AV, 0x0)           4            8       None       Yes(3)  Yes  8(4)
AV 0x0 Mac             Infinite(1)    8/16(10)  Infinite(1) Yes     Yes  16
PowerPC Mac                 2           16       None       Yes     Yes  16
AV PowerPC Mac         Infinite(9)    8/16(10)  Infinite(9) Yes     Yes  16

Game Machine         Wavetable voices  WT bits  FM voices Other voices Stereo?
Atari 2600                  0             0         0          2         No
Intellivision               0             0         0          4(8)      No
Nintendo Ent. System        1(5)          8         5          1         No
Sega Genesis                1(5)          8         6          0         Yes
Sega CD                     11(7)         8/16(7)   6          0         Yes
Super NES                   8             12(6)     0          0         Yes
Sony PlayStation            24            16(6)     0          0         Yes
Sega Saturn                 32(12)        8/16      32(12)     0         Yes
Nintendo 64              Infinite(13)     8/16   Infinite(13)  0         Yes


"Wavetable" as used here means "a channel capable of playing back a digitized waveform". This is NOT the generally musically accepted meaning of the term, but it IS how it is commonly used when referring to computer sound boards.

"8/16" for WT playback bits means the chip is capable of directly processing 8-bit or 16-bit samples without conversion (the GUS's GF1 chip and the AV Mac's DSP chip obviously fit these criteria).

1 - The AV Mac's DSP chip can theoretically mix an infinite number of wavetable voices or synthesize an infinite number of FM voices. However, this is limited in practice by the speed of the chip and any other things you have it doing (voice recognition, modem replacement, etc).

2- The Gravis UltraSound can emulate FM synthesis in software.

3- Macs before the Mac II were mono-only.

4- This requires additional hardware.

5- The Genesis and NES's wavetable channel is pretty hackish, and not very high quality; nonetheless it works for speech.

6- The SNES and PSX sound chips accept 16 bit samples which have been ADPCM 4:1 compressed (this is similar to the ACE compression toolset on the GS, but the data format is NOT the same).

7- The Sega CD has two channels of 44.1khz stereo 16-bit CD audio and 8 8-bit DAC channels in addition to the capabilities of the Genesis.

8- The Intellivision uses the General Instruments AY-3-8192 chip found on Apple II boards such as the Phasor and Mockingboard. This provides three tones and one percussive noise at once.

9- The PowerPC AV Macs have no dedicated DSP chip; they use the main CPU, which can cause application performance degradation (see also note 1).

10- AV Macs of both CPU types have a 2-channel 16-bit CODEC to actually reproduce the audio, but the DSP or 60x chip are capable of conversion.

11- The Gravis UltraSound PnP specs also apply to other AMD InterWave-chip based boards such as the Reveal WavExtreme 32. 12- The Saturn's 32 voices can each be set to either waveform playback or FM. FM is not limited to sine waves as on older chips, however. 13- Like AV Macs, the N64 uses a DSP to mix as many sound channels as you can devote processing time to - however, since the same DSP computes the 3D geometry you're pretty limited on how many channels you would normally want to use.

What's this I hear about 3D sound?

Since stereo sound has been around since at least the 1940s, people have been attempting since then to bring the front-to-back plane into sound, and not just the side-to-side provided by conventional stereo. One of the more notable attempts was made in the 1960s with the so-called "quadraphonic" system, which actually had 4 speakers and used special LPs with 4 distinct channels. Since this is often impractical, and nobody wanted to go to the trouble of recording 4 channels anyway, the system faded out by the mid-to-late 1970s.

With the advent of affordable DSP power in the early 1990s, and advanced psychoacoustic research, many new systems started to appear. Most popular is Dolby Pro Logic, which encodes 4 channels of sound into the 2 stereo channels commonly found in stereo VHS tapes and compact discs. This system uses 5 channels - left, center, and right in front plus left and right rear, which are actually the same sound. This system doesn't provide very good sound localization because the 2 rear speakers cannot play different material, and neither they nor the center channel can play full-range sound. Nonetheless, because the encoding for this system is cheap and easy to do, a wide variety of PC and Macintosh software now offers it in either licensed or unlicsensed form.

This system is being gradually phased out in favor of Dolby Digital, or AC-3, which encodes "5.1" distinct full channels of sound - 1 channel for each of the same 5 speakers used in the older Pro Logic plus a ".1" channel which contains only deep bass and is intended to drive a subwoofer. This provides a very compelling sound field when properly implemented with good quality speakers, since all 5 main speakers can play independant full-range sounds.

There are also a variety of methods which claim to reproduce an entire sound field with only 2 speakers or normal stereo headphones. The most popular of these is "QSound", which has the added advantage of also being compatible with Pro Logic, so you can get 'real' multi-plane sound if you've got it and a reasonable imitation otherwise. QSound was first commercially used for Madonna's "Immaculate Collection" album, and is now used in arcade, console, and PC-based video games as well as many other places.

Note that although Pro Logic encoding is possible in realtime on the IIgs, no known software actually does this. Additionally, the psychoacoustic methods such as QSound simply require too much DSP power to pull off in realtime on the IIgs or other Apple II computers, so be wary of any claims of such. It's certainly possible to pre-process waveforms with QSound and simulate realtime encoding - this method is used on systems such as the Sony Playstation which don't have spare DSP capacity. This "cheat" may or may not work with other psychoacoustic systems - it depends on the specific coding method. As always, let your ears be your guide...

Copyright (c) 1993-1997 Ian Schmidt. Contents may be freely distributed as long as no editing occurs without permission, and no money is exchanged. Exceptions are hereby explicitly provided for Joe Kohn's Shareware Solutions II, the services GEnie and Delphi, for the current Apple II FAQ maintainer, and for user groups everywhere.

The Apple II: It just keeps going and going and going....