DIG Audio File Format

 

Audio File Format DIG

Documented by Tony Ramos, May 29, 1994

Parrot .DIG Audio File Formats

Overview
——–
This document describes the data storage format for Parrot unstructured (raw)
and structured digital audio files. The type of file cannot be determined
by filename alone since the Parrot software names all its files with the
extension „.DIG“.

I am providing this detailed information in the hope that Atari 8-bit users
will take advantage of their ability to store and reproduce digital sound with
their computer. Perhaps someone will use this information to create new
sound manipulation software, such as a program to convert sounds sampled on
other computer platforms to Parrot format (hint hint).

Introduction
————
Parrot (and Parrot II) are programs for the Atari 8-bit line of
home computers which provide sound sampling and playback. Sampling
is achieved through the computer’s joystick port using a simple, paddle-
like device. Sample playback uses the computer’s internal sound
circuitry and requires no additional hardware.

The Parrot _Sampler_ program records sound to disk as raw sample files.
Users can assemble these samples into a set of tracks using the _Emulator_
program and play them as musical instruments on the computer’s keyboard.
Sounds in track files can also be played from BASIC using calls to a freely
distributable subroutine included with Parrot.

The Emulator saves each set of tracks as a „structured“ file containing
track names and other information.

Unstructured (raw) format:
————————–

Byte offset Number of bytes Description
———– ————— ———–

0 5 Magic sequence to identify Parrot raw file:
ASCII characters FGHIJ, $46-$4A hex.

6 1 Playback speed, in timing loops. **
Early versions of the software incorrectly
set this byte to 75.

7-(11 or 12) 5 or 6 Sample length in bytes. ASCII numeric
string terminated by an Atari EOL, $9B hex.

12 or 13 (length given Sample data. Samples are 4 bits each,
above) two samples per byte, high nybble first.

Structured (tracks) format:
—————————

0 6 Magic sequence to identify Parrot track file:
ASCII characters PQRSTU, $50-$55 hex.

7-(11 or 12) 5 or 6 Combined sample length in bytes. ASCII numeric
string terminated by an ATASCII EOL, $9B hex.

12 or 13 82 Track name table with nine entries, each
consisting of one byte containing the name
length followed by the name as an ASCII
string padded with NULLs ($00) to eight
characters. Table terminated by an ATASCII
EOL, $9B hex.

102 or 103 72 Track data table. Nine entries, each with
the following structure:

Offset Length Usage
—— —— —–
0 2 Sample start offset, low byte first.
2 2 Sample end offset, low byte first.
4 1 Sample repeat flag, 1 = on.
5 1 Audible track select flag, 1 = on.
6 1 Audible track select speed, in busy loops. **
7 1 Not used.

174 or 175 (length given Sample data table. Samples are 4 bits each,
above) two samples per byte, high nybble first.

** The arbitrary `busy loops‘ timing measurement can be converted to
conventional samples-per-second using the following formula:

CPU_Speed = 1790000 /* Clock speed of the Atari 8-bit’s CPU */
Byte_Delay = 96 /* Clocks spent playing each 2-sample byte */
Busy_Delay = 5.5 /* Clocks spent during one busy loop (averaged) */
Page_Delay = 22 /* Clocks spent crossing sample page boundary */
Timing_Loops /* Playback speed entered as above */

Samples_Per_Second = CPU_Speed / ((Page_Delay + 256 * (Byte_Delay +
Busy_Delay * Timing_Loops * 2)) / 512)

For example, sounds sampled with Parrot at the default setting will play
at normal speed with `busy loops‘ set to 54. This is equivalent to 5398
samples per second and provides audio frequency response of 2.7 KHz.

At the default speed above, 2.7 KBytes store one second of sound.