16

The original version of Shadowgate for the Macintosh is an eerie experience after you have played the NES version, with its amazing soundtrack. The Mac version is entirely mute, save for some random sound samples which seem to be recorded with a microphone.

In an interview I recently listened to with the authors, they said that everything was all about saving data in that game for it to fit in a floppy.

But if every little bit mattered so much, how did they fit all those sound samples? Don't even a very short such sample take a huge amount of space? WAV files, etc.? Compared to any sort of MIDI-like background music which would take much less space to store than the sound samples.

Yet the game is entirely silent in terms of music.

This doesn't make any sense to me. If the Mac was able to play back realistic sound samples, surely it must have also been able to output some kind of music? The "storage space" argument doesn't seem to hold up at all.

3
  • 8
    It’s easy to forget just how limited the original Macintosh hardware was. It’s a testament to the design team that they were able to do so much, with so little. Commented May 7, 2023 at 19:20
  • if you enjoyed that experience then i can recommend checking out some 1980s PC games. 'xenon 2' on the commodore amiga was an audio delight, but on the PC speaker it was something else entirely. and the game 'ports of call' is worth checking out for its clever use of the PC speaker
    – Aaron F
    Commented May 10, 2023 at 16:14
  • Where was the interview?
    – Jon Hess
    Commented May 10, 2023 at 22:58

5 Answers 5

27

The original Macintosh has a single-channel 8-bit 22kHz PCM output; it reads from memory and sets a new output level once per scan line of the video output. It’s up to software to generate waveforms if music output is desired and you can hear music in some games.

So one would guess, most charitably, that the issue was being able to generate audio sufficiently quickly with only data of the size available. Something like plain MIDI with no sound font is usually handled on the PC via FM synthesis, which would likely have cost too much processing.

0
19

Tommy already answered the basic facts, so I would like to put the various assumption a bit into perspective.

The Mac version is entirely mute, save for some random sound samples which seem to be recorded with a microphone.

Which is what the Mac's sound 'system' was made for.

It is said that the single channel 8 bit/22 kHz DAC hardware was included on Steve Jobs' request especially for his "out of this bag" stunt, although Andy Herzfelds recollection tells this being exaggerated, but showing his dedication to the sound system. In addition one of the 6522 timers could be used to mute/unmute the sound to produce simple sounds (including higher than 11 kHz) or create additional effects.

In an interview I recently listened to with the authors, they said that everything was all about saving data in that game for it to fit in a floppy.

Which is half the story. The other parts is scarcity of main memory, CPU power and low floppy speed. The original Mac was a machine that had way more in common with back then home computers than what we think of it now - heck, even a C64 can outrun the original Mac in certain areas - And Shadowgate was designed in 1984/85 when the Macintosh came with 128 KiB of RAM which had to fit OS, video RAM (22 KiB), code and of course all resources (graphics, sound). As a result a lot of loading was needed.

But storage was only a single 400 KiB Floppy drive. A prime goal was to fit everything onto a single floppy - flipping floppies is the best way to kill immersion - so not exactly much space either.

So while Sound can be compressed to some degree, it needs a lot of code, CPU power (an 8 MHz 68k isn't a racer) and even more RAM space. With a Machine that strapped, it's hard to have a buffer for a second of continuous sound (22 KiB). Of course amount of data can be reduced by syntesising sound from data but that again needs lots of CPU and code.

In contrast, the NES version came on a 256 KiB TKROM, ready to execute in place with no need to load from a slow floppy. Even more important, it has 5 sound channels which can be programmed using way less than 22 KiB/s data rate and more important no need to use RAM for that purpose.

But if every little bit mattered so much, how did they fit all those sound samples?

One might have to look at each separat, but I would think the main 'trick' was keeping them short. Karl Roelofs talks a bit about this in a Blog Entry which pretty much summs it up:

So, in order for us to make this work, we had limitations:

  1. No music (except for credits of course)
  2. Scant sound effects
  3. Utilize patterns as much as possible

Don't even a very short such sample take a huge amount of space? WAV files, etc.?

That's exactly the point here.

Compared to any sort of MIDI-like background music which would take much less space to store than the sound samples.

True. But MIDI (or any kind of procedural format) will need some device, hard or software to turn it into a wave form to be outputted. In case of the Mac it would have been main CPU and main RAM. Neither available in large quantities.

Yet the game is entirely silent in terms of music. This doesn't make any sense to me. If the Mac was able to play back realistic sound samples, surely it must have also been able to output some kind of music? The "storage space" argument doesn't seem to hold up at all.

Oh, it does. In any way imaginable.


Historic side note: Apple joined the (International) MIDI Association as early as January 1984 as corporate/manufacturer.

5
  • 1
    One of the reasons the Lisa was so expensive was because the software was large and required a harddisk. Commented May 8, 2023 at 19:02
  • 2
    @ThorbjørnRavnAndersen I don't think the external ProFile hard drive was included in the baseline configuration; it relied on the two Twiggy floppy drives. (A "first look" article from the February 1983 issue of Byte magazine mentions an included 5MB hard drive, but I think by the time the system came to market that was an extra-cost option.) The internal "Widget" drive wasn't available until the Lisa 2/10.
    – jeffB
    Commented May 8, 2023 at 19:28
  • 1
    @jeffB Jup. Base configuration was dual twiggy drive. HD came later as add on and was made mandatory (as build in) with Lisa 2
    – Raffzahn
    Commented May 8, 2023 at 20:32
  • Switching disk was part of the thrill back then, place it just before the second boss for maximum impact: will it work? is Disk 2 still readable? Can't wait for it to load! Argh that was too quick a load, I had not the joystick in hand, now I'm dead! Shout out for the Bitmap Brothers and their amazing 16 colors palette that could smoothly render all elements!
    – Kaddath
    Commented May 9, 2023 at 14:33
  • @Kaddath seems as if the creators of Shadowgate had a different opinion - including colours...
    – Raffzahn
    Commented May 9, 2023 at 17:40
8

Although the MIDI 1.0 standard was first published in 1984, the first commercial computer (as opposed to sequencers or synthesizers) to incorporate MIDI was the Atari ST in 1985. Macs didn't have MIDI let alone a built-in synthesizer bank.

5
  • I assume you mean build in with the basic machine, as other computers had MIDI already before the ST like with the Yamaha CX5M for MSX or a whole series of MIDI interfaces using the 401 break out box by Roland.
    – Raffzahn
    Commented May 9, 2023 at 6:38
  • 3
    I do think that focusing on MIDI specifically is a bit of a red herring. The OP question should be interpreted as referring to using any music synthesizer, of which there have been several mechanisms before and after MIDI. MIDI itself is just a particular sequencing protocol (eventually also a file format) + the General MIDI instrument list, that happened to be agreed on by the music equipment industry. The C64 could have played synthesizer background music, for example, but the Macintosh didn’t have anything remotely like the C64 SID, and it didn’t have the horsepower to do it in software Commented May 9, 2023 at 17:17
  • Many pre-1984 computers had MIDI-like capabilities (such as the C64's SID). The Mac didn't.
    – Mark
    Commented May 9, 2023 at 19:16
  • 1
    @Mark Those things don't relate. It's possible the modern understanding/usage of "MIDI" somehow includes sound synthesis; the original MIDI did not. I was there. MIDI was for encoding music (what sheet music does). SID/POKEY are dedicated hardware for making sound/music (what a flute does). Instruments pre-dated sheet music, and sound hardware predated MIDI. SID/POKEY were there to offload sound-making from the CPU so you could get better sound and save the CPU for game animation. IIRC Mac supported MIDI just fine. Commented May 10, 2023 at 4:53
  • @Harper-ReinstateMonica, by "MIDI-like", I mean the ability to play music encoded as something note-like, as opposed to how the Mac requires the music to be presented as something PCM-like.
    – Mark
    Commented May 10, 2023 at 22:38
3

As noted elsewhere, the Macintosh sound hardware clocks a DAC at 22,050Hz. Although there is no hardware for multi-voice music, early versions of Inside Macintosh described three sets of ROM routines that could be used to produce sound. If memory serves, one could produce a configurable-amplitude fixed-pitch done with no CPU overhead, feed 22,050Hz audio samples from memory with moderate overhead (I think about 10%), or play four-voice music using 256-byte looping wave tables with substantial overhead (I think about 50%). I never looked at or played with Apple's code for that, but suspect it would have generated a frame worth of samples during each video frame, and given the 50% CPU loading I'd guess the code prioritized memory usage over speed, but was probably optimized about as well as possible given that constraint (total CPU time per line is 324 cycles, so 50% loading would be about 160 cycles per sample--maybe 36 per voice plus 16 per sample loop overhead.

2

Yes, the original 1984 Mac had 3 ways to do it

Inside Macintosh was Apple's official documentation for the original 1984 Macintosh. Chapter 8 of volume II describes the Sound Manager:

The Sound Driver is a standard Macintosh device driver in ROM that's used to synthesize sound. You can generate sound characterized by any kind of waveform by using the three different sound synthesizers in the Sound Driver:

• The four-tone synthesizer is used to make simple harmonic tones, with up to four "voices" producing sound simultaneously; it requires about 50% of the microprocessor's attention during any given time interval.

• The square-wave synthesizer is used to produce less harmonic sounds such as beeps, and requires about 2% of the processor's time.

• The free-form synthesizer is used to make complex music and speech; it requires about 20% of the processor's time.

The simplest way to do what you want is to use the "square-wave" mode. You pass in a structure that contains an array of up to 5000 notes. The notes are played one-at-a-time, in sequence, with each specifying a frequency, amplitude, and duration of a square-wave beep. However, there are no chords nor voices for particular musical instruments.

SWSynthRec = RECORD
    mode: INTEGER;      {always swMode = -1}
    triplets: Tones     {sounds}
END;
SWSynthPtr = ^SWSynthRec;
Tones = ARRAY[0..5000] OF Tone;
Tone = RECORD
    count: INTEGER;     {frequency}
    amplitude: INTEGER; {amplitude, 0-255}
    duration:  INTEGER  {duration in ticks}
END;

The four-tone synthesizer has 4 sampled voices. Each voice specifies 256 samples of a waveform; they loop when they reach the end of their buffer. The rate at which the samples of each voice is played are individually controlled. Thus, each voice could produce the sound of a different musical instrument, each with a different pitch, allowing you to produce a chord. This mode is the closest to MIDI sound. However, there is no volume control for the individual voices. Also, you specify the duration of the chord, but then it is up to you to configure the next chord.

FTSynthRec = RECORD
    mode:  INTEGER;       {always ftMode = 1}
    sndRec: FTSndRecPtr   {tones to play}
END;
FTSynthPtr = ^FTSynthRec;
FTSoundRec = RECORD
    duration: INTEGER;    {duration in ticks}
    sound1Rate: Fixed;    {tone 1 cycle rate}
    sound1Phase: LONGINT; {tone 1 byte offset}
    sound2Rate: Fixed;    {tone 2 cycle rate}
    sound2Phase: LONGINT; {tone 2 byte offset}
    sound3Rate: Fixed;    {tone 3 cycle rate}
    sound3Phase: LONGINT; {tone 3 byte offset}
    sound4Rate: Fixed;    {tone 4 cycle rate}
    sound4Phase: LONGINT; {tone 4 byte offset}
    sound1Wave: WavePtr;  {tone 1 waveform}
    sound2Wave: WavePtr;  {tone 2 waveform}
    sound3Wave: WavePtr;  {tone 3 waveform}
    sound4Wave: WavePtr   {tone 4 waveform}
END;
FTSndRecPtr = ^FTSoundRec:
Wave = PACKED ARRAY[0..255] OF Byte;
WavePtr = ^Wave;

The free-form synthesizer is what the other answers are referring to. It simply plays a buffer of samples. However, it is the WORST way to produce MIDI-like sound, as you have to either have to have the entire sampled song in memory, or build the sound on-the-fly including changing the pitch.

FFSynthRec = RECORD
    mode: INTEGER;      {always ffMode = 0}
    count: Fixed;       {"sampling" factor}
    waveBytes: FreeWave {waveform description}
END;
FFSynthPtr = ^FFSynthRec;
FreeWave = PACKED ARRAY[0..30000] OF Byte;

As far as your concerns about memory efficiency, the first two modes are quite sparing with their memory usage. (Although the Pascal code shows fixed-sized buffers, you only need to allocate as many as are actually used.)

3
  • The four-tone synthesizer would allow amplitude control by having a different wave for different volumes. While supporting e.g. 64 volume levels for each of many instruments would have consumed excessive storage, even having just a "quiet" wave and a "loud" wave, and having some instruments be quiet for one "tick", then loud for most of their duration, and quiet at the end, while others start loud and are quiet for their duration (which is what I did for the BTP2 music player featured in the Stella's Stocking cartridge for the Atari 2600) can do a lot to improve the quality of music.
    – supercat
    Commented May 10, 2023 at 15:56
  • @supercat: Sure, you could have done the calculations yourself (either at compile time or on-the-fly), but it's always nice when the operating system does the tough work for you.
    – DrSheldon
    Commented May 12, 2023 at 22:54
  • Having the OS "do the tough work for you" is only nice when it doesn't cause excessive CPU loading or memory usage. Letting the application decide on the best trade-off between musicality and wave table storage is more useful than having the OS impose its own trade-offs or spend 100% of CPU time performing real-time amplitude scaling.
    – supercat
    Commented May 12, 2023 at 23:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .