Repetitive data and non-repetitive data, including periods of no information, is encoded prior to transmission or storage in digital form to minimize the memory space required for storage or the time required to transmission. Repetition, partial repetition, and near repetition is encoded in a form indicating the occurrence of repetition, its characteristics and its duration. The existence and size of repeated patterns in the data is dynamically determined. When repetition is detected, non-repetitive data is inserted into the data stream and repeated data is removed from the data stream. To this non-repeated data in the data stream are added a coded repeated pattern sample, an identification preamble signal, an instruction signal for decoding purposes, a period count signal, a mask signal, and a repeat count signal. All necessary data elements are combined and assembled to produce compressed data. A receiver utilizes these coded and uncoded data elements to regenerate complete original data.