You are here

Transferring 16-bit Audio Files From Mac To Synth

Apple Notes By Martin Russ
Published August 1995

Martin Russ explores ways of transferring 16‑bit audio files from the Mac to a synth, and reveals what's new in the Mac music world.

Apple Notes recently received an appeal for help from a confused reader, Alastair Hearsum. He was attempting to transfer audio samples from his Power Mac 7100 to his Kurzweil K2000 synth using the K2000 v3.0 software, which allows you to import AIFF format audio files. Alastair was trying to figure out how to use his Mac's built‑in audio facilities to make samples, and then transfer them to the K2000. He had found a utility which could convert from the 'snd' format audio files that the Mac produces when you use the Sound control panel to sample audio, into the AIFF files which the K2000 transfer required. Sadly, he could only obtain 8‑bit quality, 22kHz samples, which sound muffled and grainy in comparison to the 16‑bit, 44.1kHz samples that you might expect if you read the Power Mac's specification sheet. So what was going wrong?

After some investigations, I tracked the problem down to the Mac's built‑in System functions. When recording 'snd' files via the Sound control panel, this only stores the data as 8‑bit, at a maximum recording rate of 22kHz. This is probably for historical reasons connected with the origins of the Macintosh, since 'snd' files are intended to be played across the complete Mac range of models, and so they default to the underlying minimum standard: 8 bits at 22kHz. The actual hardware for recording and playing back sound files varies from Mac to Mac. The latest 'AV' and Power Macs have 16‑bit, 44.1kHz record/replay capability, but they can also sample at well below this, as Alastair has discovered.

What is needed is a program or utility which can record directly to an AIFF file format in 16 bits, thus making the most of the Power Mac's available sound features. There are several public domain and commercial applications which will do this: SoundEffects is a shareware example which also allows quite a bit of sample processing, and Opcode's AudioShop can sample at 16 bits for around £150. Alastair wrote back to me and said that he was now using SoundEffects, and he also pointed out that the documentation provides some information on writing your own plug‑in audio processing modules (not TDM, unfortunately!).

However, after working my way through the relevant chapters of Inside Macintosh (see 'How It Works'), there may be another option. Since it is possible to write other drivers for the Sound control panel (it should have just the 'built‑in' microphone input displayed normally), then it may be possible to define a driver which will use higher bandwidth, and perhaps 16‑bit data. Writing sound drivers is well beyond my current knowledge of the Mac, but it looks like it ought to be possible. Has anyone ever seen a sound driver that works at 16 bits on those Macs that can cope with it? Let me know if you have...

Tip Of The Month

Using RAM Doubler had been remarkably trouble‑free for me, so it came as no surprise when I found one of those incompatibilities that you always hear about, but never seem to suffer from personally. In my case, it all happened when I upgraded from Galaxy to Galaxy Plus editors. Suddenly, instead of my sequencer and my editor living quite happily in the same machine, I got an automatic reboot whenever I started up the universal librarian application at the same time as my Vision sequencer.

Opcode suggested increasing the amount of RAM allocated to the two programs (I was allocating 2.5Mb to Vision and 4Mb to Galaxy), but increasing Vision's share of the RAM to 4Mb had no effect. So that's when I started trouble‑shooting...

The major problem with trying to figure out why a MIDI or music application is misbehaving, is that you can't just restart with all the extensions off (you hold the 'Shift' key down whilst restarting). This may prevent all the extensions from being installed, but it also prevents any MIDI Manager, FreeMIDI or OMS extensions being installed as well. The trick is to use something like Extensions Manager (from Apple, and included in System 7.5, although I prefer the one that came as an accessory to System 7.1 — see November 1994 Apple Notes for more details) to turn on extensions one by one until the problem reappears.

The order in which you load extensions depends on their importance. In most cases, you should enable the MIDI driver first. So I tried enabling just OMS and testing — Vision loaded okay, and trying to run Galaxy Plus did not give the usual 'ping' as the Mac rebooted! I then added in virus protection, the VRAM speed‑up tweak. Each time I added in a new extension, I re‑tested the Vision/Galaxy Plus combination. All went well until I installed RAM Doubler, and then we were back to the crashes.

At this point you might be tempted to stop, ring the software supplier and complain. But actually, there's quite a bit more to do before you re‑enable all the rest of your extensions. For example, how do you know that there isn't another incompatibility in all the untested extensions? In my case, I disabled RAM Doubler and continued adding extensions and testing Vision/Galaxy Plus. All went well until I enabled MacTCP 2.0.4, and then we were back to the automatic reboot syndrome again! When I removed MacTCP, all was well again.

So there were at least two incompatibilities on my particular Mac (a IIsi); yours may well be very different. But the technique is still the same — you provide bounds for the problem by isolating its causes, and then you ring up the software support people. In my case, I emailed the results to Opcode. I have not yet received a reply, but at least I now know how to run my sequencer and editor/librarian simultaneously!

How It Works: Mac Audio

The sound output of the Mac is capable of a wide variety of different methods of sound production. These range from rather crude square waves, through to sample replay at 16 bits, in stereo, and at 44.1kHz sample rate or beyond. The basic sound generation is handled either by a combination of a VIA chip and a Sony chip (in 'classic' Macs), or an Apple Sound Chip in Mac II and later models. In classic Macs, the sound circuitry is tied to the video circuitry. Since you can fit 370 sound samples into a video frame, and the frames repeat at 60.15 frames per second, this gives a sampling rate of just over 22kHz. This is where the underlying 22kHz sample rate comes from for '.snd' format sound files.

The Mac Toolbox ROM Sound Driver routines provide three basic types of sound production method. Although these are called 'synthesizers', they aren't exactly what most readers of SOS would expect! The simplest of these synths produces square waves — you just specify the pitch and the duration, although you can also programme a complete sequence of notes. The 'four tone' synth is more complex; it plays back looped single or multi‑cycle waveforms in up to 4‑note polyphony. There are only 256 sample points in the loop, so the length of samples is very short, but producing four sounds at once is quite processor‑intensive, especially for Macs which do not have the Apple Sound Chip. Finally, the 'free form' synth just replays a single sample, although this time the length is limited only by available memory.

The Sound Manager replaces the ROM‑based Sound Driver in more recent Mac systems.It supports the same synthesizers, but also provides a way of specifying sounds with a resource: the 'snd' resource. It allows up to 512 samples in the waveform table for the 'free‑form' synth, as well as higher sampling rates.

The Mac's 'snd' files come in two main forms. Format 1 files are used to control any of the three types of synthesizer — they contain information on the sounds and the notes to be played, and so a single 'snd' resource file can be used to play a complete sequence of notes just by passing the resource handle to the SndPlay Sound Manager call. Format 2 'snd' files only work with the 'free‑form' sampled sound synthesizer, and define only the timbre of the sound — the application needs to control the pitch and duration of the notes which are played. The 'snd' audio files are Mac‑specific and always seem to store their data in 8‑bit form.

In contrast, AIFF files are designed for exchanging audio information across different platforms, and so are not based around the Macintosh hardware or software at all. AIFF stands for Audio Interchange File Format, and it is a variation of the IFF files used for some graphics formats. Like many modern file formats, the actual content of an AIFF file is not fixed: instead it is made up of 'chunks', and these chunks contain either information on the type and format of the data in the rest of the chunk, or control information. AIFF files can contain a number of different types of chunk. The 'Common' chunk describes parameters like the length and sample rate of the sample. There are also 'Sound Data' chunks, and specialist chunks which can hold markers, additional parameters, MIDI information, AES/EBU format audio data, and other application‑specific information. The audio data can be up to 32‑bit, and is stored as linear, 2's complement data. Although 32‑bit data uses four bytes per sample, the format allows less bytes to be used for smaller numbers of sample bits: three bytes for 24‑bit, and two bytes for 16‑bit (or less) audio samples.

On The Net

After all the hype about the Internet and the World Wide Web, I thought that it was about time to add my own contribution!

If you want to glimpse inside my own busy world, then try WWWing to www.dungeon.com/midi/. There's only a couple of Web pages to read at the moment, but I'm always working on extensions in the background. Unlike many other people's home pages which seem to consist of nothing but links to other pages, I have included one page which actually provides some real information! It's called 'The MIDI Clock Sync Page', and it provides a few pointers to techniques for synchronising LFOs with MIDI Clock. Well worth a visit.

Apple News In Brief

  • Opcode's DigiTrax 1.2 Digital Audio Recording program is now native for Power Macs. You need an AV Mac, Power Mac, or a Mac equipped with an ARTA (Apple Real‑Time Architecture) compatible NuBus audio card in order to record and manipulate up to six audio tracks in a 'studio‑like' environment. Contact MCMXCIX on 0171 723 7221 for more info.
  • Apple should be releasing ClarisWorks 4.0 in the UK later on this year. Lots of new features should make this an even more essential purchase for just about any Mac user. There's even HTML support for making your own WWW pages!
  • Yamaha continue to give away very useful software! The latest is the Tiny Wave Editor, intended for users of the CBX D5 and CBX D3 hard disk recording systems. It offers on‑screen cutting and pasting, as well as time‑stretching, audio reverse, normalising, and sample rate conversion using an FIR filter. Contact the Yamaha‑Kemble Information Line on (01908) 369269 for more information.
  • After System 7.5, the forthcoming new System, codenamed Copland, and likely to be known by the much more predictable name of System 8.0, has started to undergo the 'sneak preview' stage that seems to be the way that software is hyped these days. Mac Developers have been shown early versions, although the full release will not be ready until at least mid‑1996. Expect major changes to the look of the interface, including much more sophisticated Open/Save dialogue boxes, and lots more built‑in customisation as standard. Multi‑tasking, although partially present, will apparently still only be fully implemented in System 9.0, codenamed Gershwin — and that will be some time in 1997.
  • Opcode's recently announced Studio Vision Pro version 3.0 has some fascinating new features. As well as the new DSP menu and functions, the new 'Audio to MIDI', and 'MIDI to Audio' conversions do exactly what they suggest — convert a monophonic digital audio track into MIDI information, which can then be edited, and then convert it back to audio with the changes incorporated. This allows users to manipulate the audio information as if it were MIDI data. The screenshot shows the audio original, the extracted note information, and the pitch bend information. Check out a demo as soon as possible!