AVR

From Just Solve the File Format Problem
Revision as of 19:42, 23 August 2021 by Sembiance (Talk | contribs)

Jump to: navigation, search
File Format
Name AVR
Ontology
Extension(s) .avr

AVR;;; Audio Visual Research sample file format. Public domain.

The .AVR sample file format sees use on the Atari ST(e) and older Apple Macintosh computers. Commonly used for 8 bit audio, sometimes 16.

Some Atari music software supporting AVR: Quartet, Zero-X, Breakthru, EPSS, Sound Lab.

/* All fields are big endian. */
struct AVR_HEADER {

    char magic_number[4];         /* "2BIT" */

    char title[8];                /* Title, padded with 0s. No 0 terminator is
                                     needed at the end, all 8 characters can
                                     be used for text. */

    signed short int stereo;      /* -1 = stereo, 0 = mono. Stereo data is
                                     interleaved like a .wav file, LRLRLR.. */

    signed short int bits;        /* Bits per sample. Usually 8 or 16. 16 bit
                                     sample data is big endian. */

    signed short int signed;      /* -1 = signed, 0 = unsigned. The convention
                                     is to use unsigned for 8 bit recordings.
                                     Some programs may rely on this. */

    signed short int loop;        /* -1 = loop enabled, 0 = loop disabled. */

    signed short int midi_note;   /* Can be one of these three:
                                     -1: No MIDI note assigned (most common).
                                     0xffnn: MIDI note number nn assigned.
                                     0xllhh: MIDI note ll for the low key,
                                             and MIDI note hh for the high
                                             key. This mode isn't well-
                                             documented, presumably it
                                             specifies a range of keys to map
                                             the sample across. In this case
                                             it is unclear how the root note
                                             is determined. */

    unsigned long int samp_rate;  /* Sample rate in Hz. IMPORTANT: the upper
                                     byte of this must be masked off.
                                     The upper byte contains undocumented data
                                     unrelated to sample rate, very frequently
                                     non-zero.
                                     samp_rate = samp_rate & 0x00ffffff;
                                     Some programs will only look at the low
                                     two bytes of this field, limiting the
                                     maximum sample rate to 65535 Hz. */

    unsigned long int length;     /* Recording length in sample periods. */

    unsigned long int loop_start; /* Loop start point in sample periods.
                                     If the loop is switched off, this can be
                                     set to 0 (but doesn't have to be).
                                     This should be <= loop_end, but don't
                                     rely on this when reading a file. */

    unsigned long int loop_end;   /* Loop end point in sample periods. This
                                     points to the first sample which is never
                                     played (the previous sample is the last
                                     one played before looping back to
                                     loop_start). If there is no data to the
                                     right of the loop_end point, this will
                                     have the same value as length.
                                     If the loop is switched off, this can be
                                     set to 0 (but doesn't have to be).
                                     This should be <= length, but don't rely
                                     on this when reading a file. */

    signed short int key_split;   /* Undocumented, usually 0. */

    signed short int compression; /* Undocumented, usually 0. */

    signed short int reserved;    /* Undocumented, usually 0. */

    char title_extra[20]          /* Usually 0. Some programs use this space
                                     as additional characters for title[],
                                     only when title[7] is non-zero.
                                     When writing a file, it is best to set
                                     these to zero.
                                     Some programs may use this for other
                                     purposes. */

    char comment[64];             /* Text comment. Padded with 0s.
                                     It is unclear whether this needs to be
                                     terminated with a 0. Assume un-terminated
                                     when reading, and write terminated. */

}; /* Total length of header: 128 bytes fixed-size. Sample data begins
      immediately after header. */
Definitions:

signed short int:  16 bits big-endian two's complement, -32768 to +32767.

unsigned long int: 32 bits big-endian, 0 to +4294967296.

char:              A single byte.

0:                 A zero value or byte (not an ASCII '0').

0xnn               A hexadecimal value nn.

Sample:            One or two bytes making up a single numerical value for
                   one data point on one channel.

Sample period:     A group of samples, one sample for each channel.

Recording:         The whole sample data. The entire file, sans header.

Signed:            Sample data represented by signed two's complement
                   integers.

Unsigned:          Sample data represented by unsigned integers, no-signal
                   idle level (0 volts) stored as 128 (8 bit) or
                   32768 (16 bit). Values above this represent positive
                   voltages. To convert from signed to unsigned or vice-
                   versa, invert the most significant bit.

Software

Sample files

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox