.The official Csa2 (comp.sys.apple2) Usenet newsgroup Apple II FAQs originate
  from the Ground Apple II site. Ground Apple II administrator: Steve Nelson

.Csa2 FAQs-on-Ground Resource file: R015SNDNMUS.htm
.                   ....
 
 

Apple II Sound & Music

  Version 1.51 (2-JAN-97)

  Written by Ian Schmidt (irsman@iag.net)
 

     Thanks for corrections and updates to Joe Walters, Dave Lyons, Dave
Huang, Mitchell Spector, and Scott Gentry.

     Send additional questions/comments/blatent error reports to
irsman@iag.net.

A quickie what's new:

 * Added to the Other Systems table.
 * Various additional info and editing.
 * Started the 8-bit section

    I know some of you emailed me info on the Phasor, Mockingboard, etc, a
while ago but I can't find it now, so please e-mail anything you've got to
irsman@iag.net. Also, additional info (like the name) on the program which
plays GS sampled sounds on 8-bit IIs would be a good thing.
 

 Table of Contents

 * An introduction to music and sound
 * 8-bit music and sound
 * Types of sound files used on the IIgs
 * How to digitize sounds
 * How to edit sounds
 * Types of music files
 * An overview of SoundSmith-style editors
 * An overview of MIDI
 * Technical specifications for the IIgs Ensoniq chip
 * About IIgs stereo cards
 * What about them other machines? And video games?
_________________________________________________________________
 
 

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,052 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. This
capability is best known from it's use in some of the classic Apple II
games, but there is also a program  available that allows you to play any
arbitrary IIgs-style sampled  sound on any Apple II.
_________________________________________________________________
 

Types of sound files found on the IIgs

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

Name   Ext.     FType    Description
---------------------------------------------------
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.
Hyper
Studio 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.
* 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! Experiment...you 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

Name   Ext.   FType  Description
---------------------------------------------------
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 m akes up a block, or
pattern as it is sometimes called. (MED on the Amiga allows blocks of
varying lengths, but we won't consider those here). You can terminate a
block early with a special effect. On the Amiga, 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.
 

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 note 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, to avoid getting too
technical :)
_________________________________________________________________
 

Technical Specs for the GS Ensoniq chip

     The 5503 Ensoniq Digital Oscillator Chip (DOC) contains 32
fundamentalsound-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). $00 (0 decimal too) is reserved for 'stop'. If a sample value of 0
is encounter.cgied 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: One oscillator of the pair modulates the volume of the
  other with the waveform it's playing. Not commonly used.

     Oscillators play waves stored in up to 128k of DRAM. The Ensoniq has
it's own memory refresh system. Note that Apple only supplies 64k of
DRAM for the DOC (this is known as the DOC RAM).

     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 molex connector, and all current stereo cards limit this to 1 bit,
or two channels.
_________________________________________________________________
 

About IIgs Stereo Cards
 

Mfr           Name              Notes
---           ----              -----
MDIdeas     SuperSonic      First IIgs stereo card.  Not very well
                            constructed, but sounds nice.
                            Digitizer option is 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; included for
Ingenuity                   completeness.

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; bad
Engineering                 decision to use non-shielded ribbon
                            cable results in hissier than average
                            output and digitizing.

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...
 

                Wavetable
Computer/Card    voices     WT bits    FM voices  Stereo?  Digitize?
--------------------------------------------------------------------
Apple IIgs        32           8        None        Yes(4) Yes 8
Soundblaster       1           8        11          No     Yes 8(4)
 Pro               2           8        20          Yes    Yes 8
 16                2          16        20          Yes    Yes 16
 16 AWE32         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)
 UltraSound Max   32         8/16       None(2)     Yes    Yes 16
 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         Infinite(1)  8/16(10)   Infinite(1) Yes    Yes 16
 PowerPC           2          16        None        Yes    Yes 16
 AV PowerPC     Infinite(9)  8/16(10)   Infinite(9) Yes    Yes 16
 
 
 

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

Notes:

"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's sound chip accepts 12 bit samples which have been ADPCM
compressed (the same type method as ACE on the GS).

7- The Sega CD has two channels of 44.1khz stereo 16-bit CD audio 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.
 

__________________________________________________________________________
 

Copyright (c) 1993-97 Ian Schmidt and Cygnix Development. 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 America Online, GEnie, and
Delphi, and for user groups everywhere.  The Apple II: It just keeps going
and going and going....

Oh, and for the benefit of Marc:
-30-

Ian Schmidt / irsman@iastate.edu / irsman@cs.iastate.edu / BAZ IS RIGHT!!!

to top