Spotlight › WaveRack

WaveRack, a sound recorder and WAV editor for the IBM PC

WaveRack records sound from a Sound Blaster straight onto the disk, plays WAV files, and shows them as a waveform you can select, cut and paste. It reads a file from the disk as it needs it and never loads the whole thing, so a 4.77 MHz IBM PC can open and edit a WAV larger than its memory.

an XT's time, recording at 11 kHz
23%
silence in 30 s of a 2 MB WAV off an XT's hard disk
0.00 s
memory with a WAV open, any length
31 to 55 KB
WaveRack
The WaveRack window on VGA, drawn as a grey piece of studio equipment with a WaveRack Digital Sound Recorder logo. A black LCD reads MARCH.WAV, 00:08.01 in large green segment digits, a length of 00:24.00, and 11,025 Hz 8-bit Mono. Beside it a LEVEL PLAY meter is lit green to yellow, above an INPUT GAIN slider. Below are RECORD, STOP, PAUSE and PLAY keys with Play lit green, OPEN and SAVE keys, and minus and plus keys. The waveform of the march fills a black panel with a ruler from 0 to 25 seconds and a yellow playhead at 8 seconds, with an overview strip under it. The status bar reads Out 11,025 Hz mono.
Eight seconds into a march. MARCH.WAV is one of the six clips on WaveRack's disk: 24 seconds of the Stars and Stripes Forever, played by a US Air Force band. The meter shows the level of what is sounding, and the yellow line in the waveform is where the playback is. This is QEMU on a modern Mac, with an emulated Sound Blaster 16.

What a WAV file is

Sound written down as numbers, and why recording it to disk is hard on a 1981 PC.

A microphone turns sound into a voltage that rises and falls with the air pressure. A sound card measures that voltage thousands of times a second and gives back a number each time, called a sample. A speaker does the opposite: each sample says how far to push the cone at that instant. A WAV file is a short header followed by those samples, one after another.

Three things decide the size. The rate is how many samples a second. Each sample is 8 bits (one byte) or 16. And a file is mono, one channel, or stereo, two. MARCH.WAV has 11,025 samples a second of 8-bit mono, so its 24 seconds take 264,644 bytes. A CD's sound is 44,100 samples a second of 16-bit stereo, sixteen times as much.

The waveform is a picture of the samples. Time runs left to right, and each column of pixels draws the highest and the lowest sample in its slice of the sound, so a single click in a long file still shows. Zoomed all the way in, each column is one sample.

The Sound Blaster, a sound card from 1989, records by itself: it writes its samples into the PC's memory without the processor's help. The program's job is to move them from memory to the disk before the card comes round and writes over them. That is where the trouble is. On os8088, while the disk is being read or written, no program gets to run, and on an IBM XT one disk call takes about 0.4 seconds. Writing 32 KB to a floppy takes 2.4 to 2.9 seconds.

See it running

The face is an 80s digital recorder, in colour on VGA and in black and white on the older cards.

WaveRack
WaveRack playing MARCH.WAV with a selection from 5 to 10 seconds shown as a dark grey band with cyan edges across the waveform, and its extent marked in the overview strip. The Selection field reads 05.20 - 10.17, the Loop selection box is ticked, the LCD reads 00:06.29 and the LEVEL PLAY meter is lit.
A selection, looping. Dragging across the waveform selected 5.20 to 10.17 seconds. With Loop selection ticked, Play repeats just that part until Stop, which is how you find the exact place for a cut. This is QEMU on a modern Mac.
WaveRack
WaveRack after the selection was deleted. The title bar reads WaveRack - MARCH.WAV with an asterisk, the LCD's length reads 00:19.03, the waveform now ends before the 20-second mark, the yellow cursor stands at 5 seconds where the cut was, SAVE is no longer greyed, and the status bar reads Deleted.
After Delete. The same five seconds removed: the march is now 19.03 seconds long. The * in the title bar says the document has changes. Nothing has been written to the disk yet, and MARCH.WAV itself stays as it was until you save. This is QEMU on a modern Mac.
WaveRack
WaveRack with PRELUDE.WAV open. The LCD reads 00:00.00, a length of 00:03.00, and 11,025 Hz 16-bit Stereo. The waveform panel has two lanes, L above R, each showing three seconds of piano with a ruler from 0.0 to 3.0.
A stereo file. PRELUDE.WAV is three seconds of Bach's first prelude, from Kimiko Ishizaka's free recording, in 16-bit stereo. Each channel gets its own lane, left over right. This is QEMU on a modern Mac.
WaveRack
PRELUDE.WAV zoomed in fully. The ruler runs from 1.62 to 1.66 seconds, and both lanes show smooth wavy lines, the left channel's small and the right one's larger, with the yellow cursor at 1.63 seconds. The overview strip marks a sliver of the whole file. The plus key is greyed and the status bar reads Zoomed in fully.
Zoomed in to the samples. The + key zooms in until each pixel is one sample: the whole window shows about 0.05 seconds, and the piano's sound is a wavy line. The strip at the bottom still shows the whole file, with the part on screen marked. This is QEMU on a modern Mac.
WaveRack
WaveRack in its black-and-white theme with MARCH.WAV open: a white faceplate with black rules, a black LCD with white digits, an outlined meter, and a white waveform on black. The selection from 5 to 10 seconds is drawn inverted, black on white. Greyed keys have dotted frames and dotted pictures.
Black and white. The same face drawn from a second table of colours, the one a Hercules or CGA card gets. A selection is drawn inverted, and a key that cannot be used has a dotted frame and a dotted picture but keeps its label solid, so it stays readable. This is QEMU on a modern Mac.
WaveRack
WaveRack in black and white on a CGA screen, in its compact layout filling the width. A black LCD strip reads MARCH.WAV, 00:06.53 of 00:24.00, 11,025 HZ 8-BIT MONO, beside a PLAY meter and the input gain slider. A row of short keys with Stop, Pause and Play solid and Play latched black, the white waveform on black with the selection from 5 to 10 seconds inverted, the overview strip, a row reading Sel: 05.43 - 10.40 with Loop ticked, and a last row of drop-down lists, a VOL slider and the status Out 11,025 Hz mono.
On CGA. A CGA card shows 640 by 200 pixels in black and white, so WaveRack has a third layout that fits in 132 lines with every control still there. Here a selection loops while it plays. WaveRack picks the full face for VGA, a medium one for EGA and Hercules, and this one for CGA, and View, Compact Layout chooses it on any screen. This is QEMU on a modern Mac, running a CGA build of the system.

Recording on a 4.77 MHz PC

How a take reaches the disk when nothing runs during a disk write.

Press Record and WaveRack makes a file named VOICE001.WAV, or the next free number, in the folder it is working in. The card records into a 32 KB ring of WaveRack's memory by itself, and keeps going through every disk call the machine makes. At 11,025 samples a second the ring holds 2.9 seconds of sound.

The first version copied the ring to the disk from the window's own timer, and on an emulated IBM PC its take stopped after 13 seconds. Opening a second WaveRack meant drawing its face, and the code behind every window waited 3.4 seconds for that. Holding a menu open stopped it for 4.7 seconds. So the copy moved to a background task, which keeps running through menus, drawing and other programs loading. Each tick it copies what the card has captured into 64 KB of holding memory, and the window writes that to the disk in pieces of 16 KB or more. A take now survives about 8.8 seconds without the window's attention. The copy costs the 8088 98 clock cycles a byte, 23% of its time at 11,025 samples a second.

A floppy is slower. A 32 KB write took 2.4 to 2.9 seconds against a ring of 2.9, and one test run lost sound at its very first write. At 8,000 samples a second the ring holds 4.0 seconds, so that is the rate on a floppy, and WaveRack refuses a faster one there with Floppy: use 8,000 Hz. On a hard disk it records at 8,000, 11,025 or 15,000.

A take is a WAV file from its first write. Its header is padded to fill exactly one disk cluster, the unit a disk is divided into, so the sound starts on a cluster's edge and every write adds whole clusters. Until Stop the header says the length is 0, and at Stop it is written again with the real length. While a take runs, a 24-byte note in the system disk's SYSTEM\APPDATA folder says so. The test switched the emulator off in the middle of a take, booted it again and started WaveRack: File, Recover Take opened the take with every sample that had reached the disk.

The input gain slider runs from -12 to +12 decibels in 2-decibel steps. None of the cards os8088 drives has a recording volume, so WaveRack applies it to each sample before it is written, and the slider says DIGITAL.

WaveRack
WaveRack recording. The RECORD key is lit green with a red dot, the meter reads LEVEL REC, the LCD reads VOICE001.WAV and 00:13.09 at 11,025 Hz 8-bit Mono, and a flat grey line runs across the left quarter of the waveform panel. The status bar reads C: 31 MB free - 49 min.
Recording onto a hard disk. Thirteen seconds into VOICE001.WAV. The status bar says how much the disk holds, here 49 minutes at this rate, and the waveform grows as the take runs. The emulated card records silence, which is why the line is flat. This picture was taken during development on MartyPC, an emulator that keeps an IBM PC's timing to the cycle.
WaveRack
The whole Hercules screen in black and white, with WaveRack's medium layout and its File menu open: New, Open..., Save, Save As... and Save Selection As... with the save items greyed, and Recover Take at the bottom, not greyed. Drive icons for A:, B: and C: are at the right edge.
After a crash, on Hercules. The machine was switched off in the middle of a take. On the next start, File, Recover Take is available, and it opens the take with Recovered; save to fix; saving it repairs the header. A Hercules card, a monochrome graphics card from 1982, shows 720 by 348 pixels and gets the medium layout. This picture was taken during development on MartyPC.

Opening, editing and playing

A WAV stays on the disk, edits are a list, and the sound is read just ahead of the card.

Opening

WaveRack reads a file once, start to end, and keeps a summary: the highest and lowest sample of each short block. That summary is what the waveform is drawn from. With a document open WaveRack uses 31 to 38 KB of memory, whatever the file's length. It is up to 55 KB on a hard disk partition of over 1 GB, which stores files in 32 KB pieces. The desktop stays usable while it reads, and Escape stops it.

Editing

A document is a list of pieces of the original files: which file, the first sample, how many. Trim, Delete, Cut, Copy and Paste each build a new list, and no sound is moved, so a cut in an hour-long file takes as long as in a one-second one. A list holds up to 64 pieces. Undo goes back eight steps, kept in 6 KB. The clipboard keeps its contents when you open another file, so you can paste between two WAVs of the same format.

Saving

Save writes a whole new file under a temporary name first. Only when every byte is on the disk is the old file deleted and the new one renamed in its place. A full disk or Escape halfway through leaves the original as it was. Save Selection As writes only the selection.

Playing

The card plays 8-bit mono, so a 16-bit or stereo file is mixed down as it plays. That costs an 8088 114 clock cycles a sample for 8-bit mono, which is 53% of its time at 22,050 samples a second. 16-bit stereo costs 456 for each pair of left and right samples, more than twice what the machine has. WaveRack works this out before it plays. When the PC or the disk cannot keep up, it loads the part to be played into memory first, at one byte a sample. When that does not fit either, it plays with gaps and says CPU too slow: gaps or Disk too slow: gaps.

Playing through disk reads has the same problem as recording, the other way round. The first version went silent every time the disk was read. Now WaveRack plays from its own 32 KB of memory and fills it to the top before every read, so the card has the most sound possible in hand when the machine stops for the disk. It reads 16 KB at a time from a hard disk and a cylinder's worth from a floppy, since one disk call costs about the same whatever it moves. Each read carries on from where the last one stopped instead of searching the file from its start.

Measured on an XT

What a 4.77 MHz IBM PC with a Sound Blaster 2.0 did, on an emulator that keeps its timing.

WaveRack's playback, recording and drawing measured on an emulated 4.77 MHz IBM PC
WhatMeasured
Play 30 s of a 2 MB WAV, 22,050 Hz 8-bit mono, off a hard disk0.00 s silent (the first version: about 17 s)
The same, while a second WaveRack reads another file off that disk0.14 s silent in 40.5 s
Play 30 s of a 1.1 MB WAV, 11,025 Hz, off a 1.44MB floppy0.00 s silent
Record 60 s onto a hard disk, at 11,025 and at 15,000 Hznothing lost; the card at most 4 KB ahead of the copy
Record 204 s while a second WaveRack opened and read a 2 MB filenothing lost
Record 30 s onto a 1.44MB floppy at 8,000 Hznothing lost; the ring at most 27,648 of 32,256 bytes full
Read a 2 MB WAV to draw its waveform, off a hard disk77.8 s
Redraw the whole window1.1 to 1.5 s
Drawing while nothing happens / while recordingnone / about one drawing call per 1/18 s

Every figure comes from MartyPC, which emulates the original IBM PC to the clock cycle, with an XT-IDE hard disk adapter. Its hard disk answers with no seek or spin time, so a real drive will be slower. Its floppy drive is timed, and the 8,000 Hz floppy rate comes from it.

Memory, measured from the system's own list of what each program holds: 107 KB while recording, about 100 KB while playing a file, and 10 KB with no document open. WaveRack is 34,167 bytes on the disk.

What it does not do

Left out on purpose, and what has not been checked yet.

No real microphone has been recorded through it yet. Every emulator here records silence or nothing at all, so the pipeline, the counts and the files are tested, and the sound of a take is not. A real XT's hard disk and floppy speeds are also still to be measured.

It plays and records only through a Sound Blaster. It does not play through the PC speaker or a Covox. Without a card, Play and Record are greyed with the reason, and opening, editing and saving still work. An original Sound Blaster 1.0 or 1.5 plays but cannot record into it.

It records 8-bit mono only, at 8,000, 11,025 or 15,000 samples a second. It opens uncompressed WAVs of 8 or 16 bits, mono or stereo, at 1,000 samples a second or more, up to 2 GB. It refuses compressed WAVs and 24-bit ones, and says which.

It has no effects. Nothing fades, filters or changes the loudness of the file, and the VOLUME slider changes only how loud it plays. It does not convert formats: a document saves in its own, and a paste needs the same format as the document.

Double-clicking a WAV opens the Audio Player, not WaveRack. The smallest os8088, built for 128 KB machines, has no sound card support and leaves WaveRack off.

Running it

A disk of its own in every size, with six clips of real music.

  1. Take the WaveRack disk from the release zip, in the size your machine uses. It holds WAVERACK.O88 and clips in MEDIA: Für Elise, the Maple Leaf Rag, a Gymnopédie, the Stars and Stripes Forever, a Chopin nocturne and a Bach prelude, all public domain or given away by their performers, with CREDITS.TXT saying where each came from. The 1.44MB and 1.2MB disks carry all six, the 720KB disk four, and the 360KB disk two, with 52 KB left for about 6.5 seconds of recording. WaveRack is also in APPS on the 1.44MB and 1.2MB software disks, and on the live USB image and CD with the clips.

  2. To play and record it needs a Sound Blaster. If the speaker icon is not in the menu bar, open Control Panel, Drivers, and tick Sound.

  3. Boot os8088 with the disk in the second drive, open Disk B and double-click WAVERACK.O88. Press OPEN: the Open dialog starts in MEDIA. Space plays and pauses, dragging across the waveform selects, T trims, Delete deletes and U undoes.

  4. R records. On a hard disk choose 8,000, 11,025 or 15,000 Hz with the Rate list; on a floppy, 8,000. Stop ends the take, and it opens as the document, already saved.