Miracle #03
16 июля 1999

kodit Who's there? - Working with MS-DOS: All about the mod files - a full description of the structure of mod-file, as well as a description of all effects.

<b>kodit Who's there?</b> - Working with MS-DOS: All about the mod files - a full description of the structure of mod-file, as well as a description of all effects.
    (C) 1998 Anodyne

    ----------------

      MOD-FILE FORMAT

              AND
TECHNOLOGY OF PLAY


     1.General CONCEPTS ABOUT MOD-FORMAT


    MOD-file - file containing a song. In MOD-file is stored
score of a musical work and
instruments by which It went hand is played.


         2.STRUKTURA MOD-FILE


    The file names of music modules
have standard extensions. For MOD-format they are MOD, NST, and 
M15. An extension can be either at the end

file name, or at the beginning, but may
not at all.


    MOD-file consists of three parts:
header patterns and samples. There is also the concept of the 
song (song) - it module without samples.



    In the patterns is the score
musical work. Each sample
is a tool.


    Musical composition is divided
into parts, each part - this pattern.
Pattern - it is a matrix, in which 64
rows and N columns, where N - number
channels in the module. Rows are called
quanta channels - tracks. In each
entries can be placed note,
number of samples and effects.


    When playing songs go through all the lines in each pattern 
of order. Notes, on the same

line, begin to sound simultaneously;
after some time, depending on the tempo, the transition to the 
next line, and the process repeats. 


    Each row further broken down into frames (frames), has 
called ticks (ticks) or quarks (quarks).

The number of frames in a row is called the rate (speed). Frame 
duration in the same row are equal and depend on the current 
pace. Note if it is listed, begins to sound at the beginning of 
frame 0. In the intervals between the beginning of training

sound does not change, but it can
stagnant at the beginning of each frame under the effects.


    Elements in the pattern are stored sequentially: first, all 
elements of the first line, located on the order of channels, 
then all elements of the second row and etc. The size of the 
pattern is four bytes, and the size of the pattern

depends on the number of channels. In each module, all patterns 
are the same size as the number of channels in module - a 
constant. 


           The format of the element pattern is as follows:


         byte 1 byte 2 byte 3 byte 4

        76543210 76543210 76543210 76543210 - number of bits

        ssssffff ffffffff aaaaeeee pppppppp


        ffff ffffffff - a period that determines the pitch.

        ssss aaaa - number of samples.

        eeee - effect.

        pppppppp - effect parameter.


    In byte 1 is the highest part
period, in bytes 2 - younger. Effect and
parameter to denote hexadecimal digits. If the period is 0, then
note missing, similarly, if the number
sample is 0, the sample is not specified.
Sample numbering starts with 1. Effect
can not be absent, since all the values ​​of the effect of 
rates from 0 to F represent any effect. But the effect of 0 
with the parameter 00 of anything is not affected, so this 
value can be regarded as No effect.



    Notes in the MOD-format stores as periods. Period 
determines the frequency of sampling for the sample. Sampling 
frequency F in Hertz calculated by the formula F = A / (period 
* 2) where A - or 7093789.2 or 7159090.5.

The latter value is used most
often, though essentially a big difference between these values 
​​do not. Background. Period of MOD-format represents the value 
bound to computer architecture Amiga, on the

which appeared first trackers, and with
them, and MOD-format. Ambiguity in
value of A is explained by the existence of
two modifications of Amiga, which varied the frequency of clock 
signals. All numbers in MOD-file is stored in a "blunt"

(Big-endian) format - the most significant byte is
first, because it's native file format processor Motorola 
680x0, established in Amiga.



    Periods of one and the same notes in the MOD-files created 
on different trackers, may vary. This difference is small and 
is due either to the mathematical Errors creators trackers, or 
their departure from ravnotemperirovannoy scale.



    Standard, MOD-format provides three octaves, with numbers 
1,2 and 3. Octave 2 corresponds to the middle octave.

But apart from the standard can be custom octaves with numbers 
0 and 4. Note C middle octave has a period of 428 s

corresponds to the sampling frequency of approximately 8363 Hz.


    The musical is the concept of modules
subtle tone (finetune). In MOD-format -
This is the eighth of a semitone, ie semitone
divided into 8 parts on a logarithmic scale, each thin the tone 
more than the previous time in the FT, where FT - the root of 
degree 96 of 2 (96 = 12 * 8). 


    Samples are often called tools
for MOD-format is the same, but
formats other modules, these concepts
different. To get different sounds
frequency of one sample is used
method of frequency shift (frequency shifting) - each note has 
its own sampling frequency sample. Using

Another method might distort
original sound.


       The overall structure of MOD-file is as follows:


    1) the title, its length may be
either 600 or 1084 bytes, depending
the number of samples (see below);


    2) patterns that are stored in order
rooms immediately after the header, starting with
pattern 0, since the size of the pattern for
specific module - a constant, then knowing
number of the pattern is easy to calculate its offset in the 
file; 


    3) samples, are in numerical order
immediately after the last pattern, each
sample is a raw wave
the shape of the iconic 8-bit samples;
the first two bytes in each sample
reserved and are not intended to
storage of samples, but in practice they
there always is.


    Number of samples in MOD-file may
be either 15 or 31. According to this criterion
All MOD-files are divided into two types. In
modules with 15 samples has a title
length of 600 bytes, in modules of 31 samples
1084 bytes.


           In general, the header has the following format:


         1) the name of the song (song name);

         2) descriptors of samples;

         3) length of the song in the positions;

         4) position loop songs;

         5) a table of patterns;

         6) the signature of the module.


     Consider these fields in more detail.


    1. The name of the song. Stored in a file on
offset 0 and has a length of 20 bytes.
Is a string that ends with zero byte, but can take all 20
bytes.


    2. Descriptors samples. Their number can be either 15 or 
31, depending on how many samples in the module. Descriptors 
are stored in numerical order immediately after the name of the 
song, the length of each descriptor - 30 bytes. Thus, the 
handle of the first sample is at offset 20, a handle to the 
second - At offset 50, etc. Format descriptor (offset are 
relative to the beginning descriptor):



    a) The name of the sample. Offset - 0, length -
22 bytes. This is a string with a null byte in the
end, but can take all 22 bytes.


    b) The length of the sample. Offset - 22
length - 2 bytes. The length of the sample - is
the word "blunt" format. Sets
number of words in the samples, ie if
Multiply this value by 2, we get
sample length in bytes. This number
includes the reserved 2 Bytes
beginning of the sample. But if the length of the sample - 1
word, it means there is no
sample, in samples in this case
2 bytes are not stored.


    c) The value of fine tone. Offset -
24, length - 1 bytes. Senior Nibl always
is equal to 0 in the low stored landmark
number of -8 to 7. Each note
corresponds to a different sampling frequency
sample. But for each
samples, this frequency increases or
reduced by a specified number of thin
tones. For example, if thin
Tone is 2, the frequency is increased to 2
subtle tones, and if the value is -8, then
note is played a semitone lower.
The need to thin tones associated with
that sound can be digitized on
frequency does not coincide with any of the
musical frequencies. With subtle tones
it can be adjusted, for example,
Medium A has a sample rate 14093
Hz, and the sound of the same height on the digitized
frequency of 14,195 Hz, then lowers it to
one light tone - turns standard
frequency.


    d) The volume of the sample by default.
Offset - 25, length - 1 bytes. May
be in the range from 0 to 64, 0 - Full
silence 64 - the maximum volume.
Given in linear scale.


    e) The offset loop sample.
Offset - 26, length - 2 bytes. This
shift is given in the words of respect
sample start, including a reserved
bytes. Makes sense, if the length
repeatable part of the larger units.


    f) The length of the repeated parts. Shift
28, length - 2 bytes. Specifies the number of
words after the displacement loop,
which will be played. After this
play continues with the bias
loop. If this value is 0
or 1, then the sample is not to fixate.


    3. Length of the song in the positions. Shift
with respect to the file - either 470,
When the module 15 samples, or 950, if
1931 sample. Given by a 1 byte. Length of the song
positions - the number of elements
(Positions) in the table of patterns that
relate to the composition. Can be from 1
128.


    4. Position loop songs.
Offset of the file -
or 471, if the module 15 samples, or
951, if the 1931 sample. Given by a 1 byte.
Determines the position of the loop module
which continue to play,
when the module finish badly to finish. May
take values ​​from 0 to 127. Many
tracker field is not supported,
as for cycling is more
effective means.


    5. Table patterns. Shift
with respect to the file - either 472,
When the module 15 samples, or 952, if
1931 sample. Is a one-dimensional
array of 128 elements (positions)
1 byte. In each position number is stored pattern. By Tracks 
are only the first position, the number of which is determined 
by the length of the song. To know the number of patterns in 
the module must scan the table (all 128

elements!). The highest value, increased by 1, will give the 
number of patterns. In principle, the module can be located

patterns that do not relate to the composition.
On the maximum possible number of patterns, see below.


    6. The signature of the module. The modules with 15
samples the signature is missing, so
immediately after the table of patterns of displacement
600 starts the first pattern. Signature
only in modules with 31 samples, where
it is the shift of 1080, having
4 bytes long. Theoretically, no
restrictions on this field is not - here
can be located arbitrary four
bytes. But the generally accepted rule
signature - four ASCII-character with
codes from 32 to 127.


    By signature, or lack thereof
determined by the number of channels and
samples in the module. At offset 1080
read 4 bytes. For modules with 15
samples of this shift is
element of the first pattern, located
in line 30 on the first channel, the first
bytes of this element is not greater than 15 (see
format of the pattern). For modules with
31 samples the first byte of the signature does not
less than 32. Thus determined
number of samples in the module, and for
modules with 15 more samples and the number of
channels - it is always


    7. If the sample module 31, then
number of channels is determined by
signature. Known at present
day of the signatures are:


        1) signature 2CHN means that the channel 2;

        2) the signature M.K. , M! K! or FLT4 - Channel 4;

        3) the signature 6CHN - 6 channels;

        4) the signature FLT8, 8CHN or OKTA - 8 channels;

        5) the signature of the form <nn> CH specifies the 
number of channels to nn, 

           where <nn> - two ASCII-numbers, the number of nn - 
even number 

           from 10 to 32.


    In Protracker'e signature M.K. also
meant that the maximum possible
number of patterns in the module is not greater than 64,
signature M! K! removes this limitation.
But Fast Tracker II modules preserves
signatures MK, <n> CHN and <nn> CH, in
which the number of patterns can be up to
256.


    The two main temporal characteristics of MOD-format are 
speed (speed) and the rate - the number of strokes per minute 
(beats per minute) or BPM. Speed ​​- the number of frames in a 
row the initial value of speed - 6. In MOD-format adopted by 
one stroke to 4 rows or 4 * speed shots. The concept of the 
number of beats per minute is not quite correct in MOD-format, 
it reflects the reality only when the speed is six. The initial 
value of BPM 125. 


    Knowing the BPM can calculate the number of
frames per second. The number of frames in
minute - a BPM * 4 * 6, and in the second -
BPM * 4 * 6 / 60 or BPM * 2 / 5. The length of one
frames per second is equal to 5 / (BPM * 2).


  3.Principle PLAYBACK MOD-FILE


    The player for each channel
stored description of the channel. It
completely describes the sound channel. State of the channel 
has the following characteristics: 


        1) the most recently used on the channel the note;

        2) most recently used on the channel sampling rate

           for the sample;

        3) the current sampling rate for the sample;

        4) the current volume;

        5) the number of samples remaining in the sample;

        6) the length of the repeated part of the sample;

        7) the displacement of the current sample;

        8) the displacement loop;

        9) integer and fractional parts of values ​​to which 
increased            is called the displacement current sample, 
determines the current 

           sampling rate;

       10) the fractional part of the displacement in the 
buffer into which the 

           amount of samples of samples from all channels, the 
integral part 

           displacement globally for all channels;

       11) a pointer to handle the most recently used

           on channel samples;

       12) last used on the channel effect and its parameters
           parameter;

       13) the default settings of some effects:

           a) the effects of parameter Portamento Up 'Down;

           b) the effect parameter TonePortamento;

           c) the effect parameter Sample Offset;

       14) the variables used in the processing effects:

           a) counters the effects of Arpeggio, Note Cut, Note 
De               lay and Retrig;


           b) variables for Vibrato: depth, speed, current

              pointer in the table waveform Vibrato, the current
              schaya waveform Vibrato, and a pointer, whether 
it is necessary 

              to play a new note from the beginning of the 
waveform, or 

              use the position left by the previous

              notes;

           c) variables for Tremolo: Depth, speed, current

              pointer in the table waveform Tremolo, basic
              volume curve Tremolo, the current waveform Tre
              molo and a pointer to whether we should play a 
new note to 

              beginning of the wave form, or use the position

              remaining from the previous note;

           d) number of samples for the effects Note Delay and 
Retrig; 

           e) counter and the line number of the beginning of 
the cycle for the effect 

              Pattern Loop.


    Before playing the current note and
the current number of samples is not specified. Effect and
its parameter is zero, which is equivalent to
No effect. Since, as
channel to meet the note or the number of samples,
they have always given. At one
channel at a time can
sound only one sample.


    Reproduction of the module can be represented as the work 
of two parallel processes: the player and mixer. In

Player is a pointer to the current
line in the score. At the beginning of the playback module, he 
points to the first line pattern from the first position. When

playback begins, read
value of the notes, the numbers of sample and effect
for each channel in a row. In accordance with the calculated 
values ​​vary channel status.



    Mixer at this time, working
in parallel with the player and mixes
samples and submit the result to sound
output. The mixer operates using
some characteristics of the state of the channel.
Job mixer is reduced to watching
structures describing the state of channels.
If the channel is given a sample, and it is not
finish the to the end, then the sample is taken
current sample and added to the sum
current samples from all channels. After
the pointer moves the current selection to the next position in 
the sample. Originally, the MOD-format audio channel with the 
numbers 1 +4 * n and 4 +4 * n appears in Left audio output, and 
the sound of the channels with the numbers 2 +4 * n and 3 +4 * 
n - to the right, where n - non-negative integer, depending on 
the number of channels. 


    Once a player
beginning of the first frame has changed state
channel, it waits for 5 / (BPM * 2) seconds. By
After this time, will begin the second
frame. At this time may change
channel status, if this were to
given the corresponding effects. Again
expected to begin until the new frame.
Etc. When will the number of frames equal to the current speed, 
the current pointer line moves to the next, and there is a 
change in channel status Under the new notes, samples and

effects.


    Consider the effect of the notes and numbers
sample to change the state of the channel.
If you found the note at unspecified
sample room sample room or occurs at either of your note, then 
they are saved and no further action is occurs.



    If both are given, and note, and
number of samples, they are ongoing, and initializes the 
information on the sample. It includes the following: on the 
note and subtle tone sample is the current sampling rate, the 
displacement current selection is reset to zero, the length 
repeatable part of the offset loop and the current volume is 
copied from the descriptor sample, calculated the number of 
samples remaining in the sample. 


    If only the note, it becomes the current, and is initialized
information about the sample.


    If only the number of samples, then
it does not check whether it coincides with the number
current sample. If match, then
initialized, only the current volume. Otherwise, there is a 
complete initialization information about the sample. 


    In addition to the notes and the number of samples per
channel status influence the effects.

4.EFFEKTY in MOD-FORMAT


    Effect - it's a team player. Effects are divided into three 
groups: 


        1) effects that affect the sound samples;

        2) effects that affect the playing order of composition
           tion;

        3) effects that affect the temporal characteristics of 
the reproducing            product.



    Some effects are activated only
early frame 0, the other - at the beginning of any
frame. The latter depends on the speed and
when it changes the sound may become
quite different.


    The effect is given by one hex digit and has a setting XY,
defined by two hexadecimal
figures. Some effects of parameter XY
is a single whole, in others it
divided into two parameters: X and Y.
Consider the effects in more detail.


          EFFECT OF 0. ARPEGGIO.


    In fact, this effect does not
arpeggios, and triad mimics with a "very fast" arpeggios. 
Options X and Y, this effect sets the value of

gradation by which the current rises
note played. Detail the process
looks like this:


        1) frame 0 of the current played note;

        2) Frame 1 plays a height equal to the height of the 
current notes 

           plus X semitones;

        3) frame 2 is played with a height equal to the height 
of the current notes 

           plus Y semitones;

        4) frame 3 again play the current note;

        5) etc. to the last frame in a row.


    This effect is strongly influenced by
has speed. For example, if
speed is equal to 1, then the effect does not
manifest.

Effect 1. PORTAMENTO UP.


    Raises the pitch in each frame
on XY periods:


        1) frame 0 of the current played note;

        2) Frame 1 plays a height equal to the height of the 
current notes 

           minus XY periods;

        3) frame 2 is played with a height equal to the height 
of the current notes 

           minus XY * 2 cycles;

        4), etc. to the last frame in a row.


    If the sound exceeds the current height
a certain threshold, then the action effect
automatically disabled. In this case, sound
either disappears or stops
maximum. It depends on the player.


    If XY = 00, then two
options: either the height does not change or
taken over the last nonzero value XY,
used in the effects of 1 or 2.
Depends on the player.


    If the current pitch is set F1
in Hertz, it is easy to figure out what will be
pitch F2 in Hertz after the increase
it on the XY periods: the current height in
periods - P1 = A / (F1 * 2), height after
increase, in Hertz, - F2 = A / (P2 * 2), where
P2 = P1-XY, A - is either 7093789.2 or
7159090.5 (see above).


       Effect 2. PORTAMENTO DOWN.


    Which increases similar to portamento
only in this effect height, respectively, decreases.


       Effect 3. TONE PORTAMENTO.


    Portamento to note. One of the two
effects (the second - the effect of 5), which
parameter, except for XY, a note.
The note indicated next to this effect,
does not become current, and remembered, and
pitch starts to slide off the
the current height of this note at a rate of
XY periods per frame:


        1) frame 0 of the current played note;

        2) Frame 1 plays a height equal to the height of the 
current notes 

           plus or minus XY periods, depending on whether

           whether to increase or decrease the height to reach

           given the notes;

        3) frame 2 is played with a height equal to the height 
of the current notes 

           plus or minus XY * 2 cycles;

        4), etc. before, until we either until the last

           frames in a row, or to a specified note.


    If this effect is not specified
note, it takes most recently used on the channel note. If XY = 
00, taken over the last nonzero value XY,

used in this effect.


    If this effect is the number of the
sample, the subsequent behavior depends
from the player. The recommended option
initialize sample. If you specify
note-setting, it becomes the current
note, and the effect in this case, in fact,
ignored.


           Effect 4. VIBRATO.


    Vibrato speed and depth of X Y.
Vibrato can have four different
waveforms: sine wave, flowing
sawtooth, square (square) and
random.


    Current waveform of vibrato
selected effect E4Y (see below). On
random waveform no restrictions are imposed, but in practice,
is periodically repeated sequence of 64 numbers, distributed
a uniform law.


    The depth determines the amplitude Y
waveform, which depends linearly
from Y. If Y = 1, then the amplitude
is minimal if Y = F, maximum.
Pitch will vary
from CF-Y * 2 and CF + Y * 2, where CF - height
current notes in the period.


    X determines the rate of change
pitch - it will be stagnant at X/64
period per frame. For example, if X = 8,
then the total period wave form vibrato
should walk up to 8 frames. Diapason
updated only at the beginning of each
frame.


    In practice, this effect is realized
follows. There are 4 array
Each of the 64 items. In these arrays
store 4 waveforms, one of them
is current. State of the channel
determined by the current index in the array. In
beginning of each frame line in which
act this effect, the current
index added to X, the resulting value becomes the new current 
index, on which the array is read out the number of

-1 to 1, multiplied by Y * 2 and added to the height of the 
current sheet in the period. The current index is always taken 
modulo 64.



    Let i - the current index, VibratoWaveform - an array of 
current forms of vibrato. Then, step by step it looks like.



        1) frame 0 is played by high current sheet (CF periods);

        2) at the beginning of Frame 1: i = (i + X) mod 64 and 
set 

           current pitch = CF + VibratoWaveform [i] * Y * 2;

        3) at the beginning of frame 2: i = (i + X) mod 64 and 
set 

           current pitch = CF + VibratoWaveform [i] * Y * 2;

        4), etc. to the last frame in a row.


    If the next line is the effect
vibrato with an indication of the new notes, then
in two ways: either the current
the index is reset at the start of frame 0, or
no. In the latter case, the vibrato
resumes at the point of the wave form
where it left off in
times. Null (retrig) the current position
waveform for vibrato or not,
determined by the effect E4Y.


    If X = 0 or Y = 0, then taken
the last non-zero values ​​of X and Y,
used in the vibrato.

EFFECT OF 5. TONE PORTAMENTO + VOLUME SLIDE.


    This effect - the combination of the three
(Portamento to note) and A (slide
volume, see below). Parameter in the XY
effect of 5 is the effect of A.
XY parameter for the effect of 3 will be
the last values ​​used in
effect; 3-note option, if the note
not specified, will be the last note is a parameter.


    If, together with the effect of 5 identifies
note or sample, a further sound
depends on the player. Recommended
behavior - the note and consider the sample
as the effect options 3.


    Let SetPortaNote (note, sample) -
function is handled in effect 3
mentioned along with him a note and sample. She
checks to see if the note, and if not, then
taken recently used in
Effect of 3 or 5 note. This function
works as described in the section about
Effect 3.


    Function TonePortamento (XY_3) treats the effect of 3. 
Parameter XY_3 - the last value that was used in the effect 3. 
Function VolumeSlide (XY_A) treats the effect of A, its setting 
- with specified effect of 5 XY. Then the treatment effect of 5

looks like this:


        1) at the start of frame 0 is called SetPortaNote (note,

           sample); frame 0 is the current note and volume;

        2) the beginning of Frame 1 - called TonePortamento 
(XY_3) and 

           VolumeSlide (XY_A);

        3) start of frame 2 - called TonePortamento (XY_3) and

           VolumeSlide (XY_A);

        4), etc. until the last frame.


   Effect 6. VIBRATO + VOLUME SLIDE.


    This effect - the combination of the four
(Vibrato) and A (slide volume).
XY parameter in the effect of 6 refers effect of A. XY 
parameter for the effect of 4 will the last values ​​used in

Effect 4.


    Let the function Vibrato (XY_4) treats the effect of 4. 
Parameter XY_4 - the last value that was used in the effect 4. 
Function VolumeSlide (XY_A) treats the effect of A, its setting 
- with specified Effect 6 XY. Then the treatment effect in June

looks like this:


        1) frame 0 play the current note and volume;

        2) start of frame 1 - called Vibrato (XY_4) and Volume

    Slide (XY_A);

        3) start of frame 2 - called Vibrato (XY_4) and Volume

    Slide (XY_A);

        4), etc. until the last frame.


           Effect 7. TREMOLO.


    Tremolo speed and depth of X Y.
Tremolo can have four different
waveforms, such as a vibrato:
Sine, Falling sawtooth,
square and random.


    The effect of the tremolo makes the volume
vary from CV-Y * 4 to
CV + Y * 4 units volume, where the CV - the current volume. If 
the volume goes boundaries from 0 to 64, then it is truncated.



    Speed ​​X has the same meaning as
speed vibrato. For tremolo
uses the same table as for
vibrato. For the purpose of the current wave
forms of the tremolo effect is E7Y. By
Personnel, this effect works like this:


        1) frame 0 is played by the current volume (CV);

        2) at the beginning of Frame 1: i = (i + X) mod 64 and 
set 

    current pitch = CV + TremoloWaveform [i] * Y * 4;

        3) at the beginning of frame 2: i = (i + X) mod 64 and 
set 

    current pitch = CV + TremoloWaveform [i] * Y * 4;

        4), etc. to the last frame in a row.


    Null (retrig) the current position
waveform for the tremolo, if indicated
note, or not, is also determined
effect E7Y.


    If X = 0 or Y = 0, then taken
the last non-zero values ​​of X and Y,
used in the tremolo.


             Effect 8. PAN.


    Balance. Originally, the MOD-format
did not have this effect, he appeared in
later tracker.


    The action of this effect is
that the sound comes from the channel is not completely
either the left or the right sound
output, both outputs, and with the help of
XY parameter controls the relative
volume on left and right
output.


    In interpreting the parameter exists
ambiguity. Initially, the effect
Balance was introduced in Dual Mod Player by
Otto Chrons. There parameter XY meant
the following:


        1) XY = 00 - the sound is entirely in the left exit;

        2) XY = 40 - the sound goes to the same extent and in 
the left and 

           in the right outputs;

        3) XY = 80 - the sound is entirely in the right output.


    Intermediate values, respectively, regulate the balance. In 
addition, the value of XY = A4 makes mono surround (Monaural 
surround sound), ie displays sound equally loud in

left and right channels, but at the same
channel sound is inverted.


    In the Fast Tracker] [and Impulse Tracker
XY slightly different interpretation:


        1) XY = 00 - the sound is entirely in the left exit;

        2) XY = 7F .. 80 - the sound is almost the same degree

           is in left and right outputs;

        3) XY = FF - the sound is entirely in the right output.

EFFECT 9. SAMPLE OFFSET.


    This effect leads to sound
sample, starting at offset, which
hex looks like XY00
bytes. Effect operates after
processed by the note and the number of samples by changing
pointer to the current selection in the sample.
If the offset exceeds the length of the sample,
then it is truncated to him. Must
Note that if a sample makefile, the
he should get stuck. You may
be that the length of the sample greater than the sum
displacement loop and repeated
parts, and a shift in the effect of 9 hits
abroad that amount. In this case,
sample to the end and finish the game
loops.


    If XY = 00, then taken over the last
nonzero parameter of this effect.

EFFECT OF A. VOLUME SLIDE.


    Sliding the volume up or down.
The parameter XY or figure X, or figure
Y, but not both should be equal
zero, otherwise the option is not valid and
effect is ignored.


    If zero is not equal to X, then the volume
slides up and if Y, then down.
Volume increases / decreases in the max
(X, Y) unit volume, each frame:


         1) frame 0 is played by the current volume;

         2) at the beginning of frame 1: if X <> 0 then CV = CV 
+ X; if Y <> 0, 

    then CV = CV-Y;

         3) at the beginning of frame 2: if X <> 0 then CV = CV 
+ X; if Y <> 0, 

    then CV = CV-Y;

         4), etc. to the last frame in a row.


    If the volume is beyond
interval [0.64], it is truncated.

EFFECT OF B. POSITION JUMP.


    Jump to the position of XY table
patterns. After a string of
which is the effect, to finish the game
end, play continues with
the first row of the pattern of position XY.
We must see to it that did not happen
jumping out of the composition.


    If a line meets a few
effects of B, it is considered only
Last.


    This is the first of the three effects
affect the order of play
composite. On the combined effect of these
effects, see below.


         EFFECT OF C. SET VOLUME.


    Change the current volume of the sample at
channel. XY parameter can be from 0 to
40 (from 0 to 64 in decimal). If
he is over 40, taken as 40.


D. EFFECT PATTERN BREAK.


    Interrupt the pattern. This is the only
effect, which is setting XY
decimal number, ie X and Y must
be decimal numbers.


    A line that met this
effect, finish the game to end, and
further play comes with strings
XY pattern in the next position.


    If XY exceeds 63, the jumping is on the line 0. If the
XY is a hexadecimal digits, then
treatment effect of D depends on the player. In this case, it 
is recommended regarded as a hex XY

number.


    If a line meets a few
Effects of D, then take into account only
Last. This is the second of three effects,
affect the order of play
composite. On the combined effect of these
effects, see below.


               EFFECT OF E.


    This effect has a 16 podeffektov,
determined by the parameter X. These podeffekty can be regarded 
as the effects of the form EX with the parameter Y.



         EFFECT E0. SET FILTER.


    Includes (Y = 0) or off (Y =
1) High-pass filter on the audio
output. This effect uses a hardware filter on the Amiga, and 
almost anywhere else is not implemented.



    Effect of E1. FINE PORTAMENTO UP.


    Subtle boosting portamento. Increases the current pitch at 
the Y periods this is done only at the beginning of frame 0.

If this effect is indicated note, the
she once played on a high altitude.


    As well as for portamento, it is necessary
make sure that the frequency is not married
certain limits.


    Effect of E2. FINE PORTAMENTO DOWN.


    Subtle downward portamento. Similarly, the effect of E1, 
only in this effect height, respectively, decreases.



     Effect of E3. GLISSANDO CONTROL.


    Includes (Y = 1) or off (Y =
0) glissandos for portamento to note
(Effect 3). Glissando - portamento on
semitones. When enabled, the height
sound when using the effect of 3
changes in semitones. Parameter in the XY
3 remains in effect only make sense now
sampling frequency samples will be updated
when the current height of sound
periods of rise / fall to the next semitone.


    In many trackers, this effect is not
implemented, it is not in Scream Tracker 3,
Fast Tracker] [and Impulse Tracker.


      Effect of E4. VIBRATO WAVEFORM.


    Assigns a waveform for the vibrato
and determines whether to drop
(Retrig) at the beginning of the current pointer
position of the waveform each time
occurs when the vibrato effect with
indication of the notes, or to continue the effect with
the location in the form in which it was
suspended execution of the previous
vibrato. It is given by Y
as follows:


        1) Y = 0 - select a sine wave, the index is reset;

        2) Y = 1 - select dropdown sawtooth shape, indicated
           exponent is reset;

        3) Y = 2 - choose a square shape, a pointer discharged
           is;

        4) Y = 3 - pick a random form, a pointer discharged
           is;

        5) Y = 4 - select a sine wave, the pointer is not reset;

        6) Y = 5 - choose the dropdown sawtooth shape, indicated
           exponent is not reset;

        7) Y = 6 - choose a square shape, the pointer does not 
sbra            described by;


        8) Y = 7 - choose a random shape, the pointer does not 
sbrasy            is called.



    Some trackers do not support the random form (eg, Fast 
Tracker] [); Other (Scream Tracker 3 and Impulse

Tracker) is always dropping the pointer.

EFFECT OF E5. SET FINETUNE.


    Sets the tone of a thin sample,
which is current at the channel
equal to Y. The parameter Y is regarded as
symbolic number in the form of additions to
two, ie 8 =- 8, 9 =- 7, ..., F =- 1.
Y value overwrites the thin tone
sample descriptor sample.


    Effect is rarely seen, but none
less supported by almost all trackers. He had not only been 
realized in Impulse Tracker.


Effect of E6. PATTERN LOOP.


    This is the last of the three effects
affect the order of playback composite. First, the official 
beginning of the cycle, it is an indication of E60, ie, Y = 0.

When this effect occurs with the parameter Y <> 0 on the same 
channel, is transition on the line with the previous E60 and

so repeated Y times.


    Effects of Position Jump and Pattern
Break work together, if found in one line. If one
line with the effects or Position Jump
Pattern Break meets effect Pattern
Loop, it has a higher priority over them.


    Effect Pattern Loop has the effect of
only on the channel on which it is
specified, ie effects are shown on various channels, operate in 
parallel. So it looks ideally depend on the subtleties

from the player.


    Nested loops on the same channel as
generally not permitted, and if a row
are E60, is taken into account only the latter. If found E6Y, 
whose Y <> 0, no pair E60, it is ignored.



    Some players, if
channel not found a pair E60, looking
it on another channel. For example, since
makes the Fast Tracker] [.


      Effect of E7. TREMOLO WAVEFORM.


    This effect is appointed by the current
waveform for the tremolo. Parameter Y
is equivalent to the effect of Vibrato
Waveform.


      EFFECT E8. 16 POSITION PAN.


    Balance at 16 positions. As well as
effect of 8, not a standard MOD-effect and is supported by few
trackers, so how can it be replaced by
effect 8. Parameter Y can be from 0 to
F:


        1) Y = 0 - the whole volume of the left exit;

        2) Y = F - the whole volume at the right exit;

EFFECT E9. RETRIG NOTE.


    Reset the note at the beginning, ie re-
set the current sample at the beginning
sound. Y parameter specifies the number of
frames through which will take place
Reset:


        1) frames from 0 to Y-1 played in the current note and 
samples, 

           effect is not valid;

        2) at the beginning of the frame Y note is reset and 
continues to 

           play from the beginning;

        3) at the beginning of the frame Y * 2 note is reset 
and continues to 

           play from the beginning;

        4), etc. to the last frame in a row.


    If Y = 0, then the processing of this
the effect depends on the player. For example, it can be 
ignored. 


    EFFECT OF EA. FINE VOLUME SLIDE UP.


    The subtle slide volume up.
Y parameter specifies how much to increase
volume in units of volume. This
effect acts at the beginning of the frame 0, ie
before you begin to sound, volume
the current notes will be increased. Must
make sure that the volume is not exceeded
value of 64.


   Effect of EB. FINE VOLUME SLIDE DOWN.


    The subtle slide volume down.
Similar to that of EA, only the volume
decreases.


          EFFECT OF EC. CUT NOTE.


    Crop note. The current note is sounded in
during frame 0, ..., Y-1, and in early
Y frame its volume is set to
0.


         EFFECT OF ED. NOTE DELAY.


    Hold your note. During the frame 0,
..., Y-1 Sound on the channel disappears, and in
beginning of the current sample frame Y begins
play from the beginning of the current note.


       Effect of EE. PATTERN DELAY.


    Delay the playing of the current line. The string will lose 
for the time would need to play Y

lines. This effect actually increases the number of frames in a 
row to the Y * speed, where speed - current speed. All

other effects are treated as
usual.


    EE0 effect is ignored, and if the
row several effects EE, then
taken into account only the last one.

Effect of EF. INVERT LOOP.


    Plays a looped piece in
samples in the opposite direction, changing
the sign of samples (inverting
sample). To this end, the current sample should
be looped, and the length of the cycle should not
be large. Sample is played back
at a rate of Y. How small
should be the length of the cycle, and what
measured the rate of Y is known only
creators Noisetracker'a, Soundtracker'a
and Protracker'a (and maybe they do not know
at least he is not implemented in
All versions Protracker'a). But they
nobody will tell, so this effect
Nowhere else has not been realized.


    If this effect EF0, then set the usual direct loop
sample.


          EFFECT F. SET SPEED.


    This effect sets in
Depending on the setting or the current XY
rate or the current rate (BPM).


        If XY <= 1F, then the speed is set. Value

        XY = 0 is ignored.

        If XY> = 20 then set BPM.


    It should be noted that at one time to
rate of treated values ​​XY <= 20 and
there is a very small number of modules,
playing at 20.

4.KLASSIFIKATSIYA Reproduction


    MOD-player tethers can be represented as two parallel 
working process: the actual player, and

mixer (see Section 2. The principle of playing MOD-files). 
First of all, playback modes can be classified by the type of 
player: 


         1) The player works in real time;

         2) The player does not work in real time.


    Similarly, ways to play
classified by type of mixer:


         1) mixer works in real time;

         2) mixer does not work in real time.


    Prerequisite is
synchronous operation and the player, and
mixer, therefore, in general, how
Playback can be divided into two
Type:


         1) synchronous, ie working in real time;

         2) asynchronous, ie, do not work in real time.


    Specificity of music playback
lies in the fact that in terminal it should come with a constant
speed, ie in real time. For
ways to play the type 1 here
no problems - the signal from the
output mixer is a constant
speed and is directly fed into the
terminal.


    For ways to play type 2
signal output from the mixer comes with a changeable speed, so 
it is necessary a transformation of the signal in time, which 
would have leveled the speed. 


    One way to transform
is to use a buffer between
mixer and the end ustroystvom.Signal
from the mixer goes into the buffer
arbitrary speed, and read from
buffer with a strictly constant rate.
Rate of filling the buffer should be
not less than the speed of its devastation.


    To play the MOD-files
method of type 1, requires an operating
system operating in real time.
Win32 is not an operating
system. It provides a mixer,
a real-time - is
DirectSound, but the implementation of the player
the same type using the standard
of Win32 is not possible.


       5.ASINHRONNOE PLAY


    Reproduction of type 2
uses the buffer. In this buffer mixer
recorded waveform signal
which is then read from it
sound card and transmitted to the terminal
ustroytvo.


    Wave form - a sequence of
samples. Sampling - a relative
amplitude of the signal. Reading
samples from the buffer sound card
performed with a constant
speed that can be installed.
Reading speed is measured in
number of samples per second or,
same, in Hertz, we denote it
letter F.


    The main thing is important for
player, the division of MOD-file - it is
division of the footage. Knowing the length of the T frame
seconds, we can calculate the length L in
samples: L = T * F. This length can
change during playback
module.

 Algorithm playback looks like:


    while (bufer_esche_ne_zapolnen)

    obrabotat_nachalo_kadra (i); / / i - the current frame 
number 

    zapolnit_bufer_vyborkami (L); / / L - length of frame in 
samples 

    i + +;



    Function zapolnit_bufer_vyborkami (L)
a mixer. In general, the length of the buffer
can be nondividing divisible by L, and
algorithm A bit different, but
it does not change the substance.


    Typically, the length of the playback
the signal is much greater than volume
buffer. Therefore, this buffer must be
constantly replenished, the rate
filling can vary - most importantly,
that it was not less than the rate
read from the buffer.

-= LITERATURE =

    6. ftp://ftp.cdrom.com

    7. http://www.citenet.net

    8. http://huizen.dds.nl

    9. ftp://sdc.wtm.tudelft.nl

   10. ftp://crystal.clare.cam.ac.uk

   11. http://wuarchive.wustl.edu

   12. ftp://ftp.cwi.nl

   13. http://snake.mcs.kent.edu

   14. http://ftp.cica.indiana.edu





Other articles:

From the Editor - Preface: For what purpose we are releasing the magazine?

From the Editor - shell: a description of a new obolchka to the magazine.

From the Editor - a letter to the journal: Dr.Sioux / Phantom Family, Fistsoft, Mr.Z / HardWave, Kurov N., Eagle / Computer Ratz Group, Rom Corp / Virtual Vision Group.

From the Editor - in this issue: Content.

Project of the Year - presentation version of the game of Robo KT-soft/ETC.

Project of the Year - a presentation of the game from a group of Spark: Townships.

Project of the Year - a presentation of the game "12 secret book."

Project of the Year - a few words about the upcoming game, Chip & Dale.

Project of the Year - an amazing story to the game "Navigator".

Project of the Year - World of Darkness: a description of a new real-time strategy.

Rattles - Fresh or not, but savory cheats.

Rattles - Crematorium: STALKER game - a description of all items.

Rattles - Crematorium: Country Myths - Tips specials.

SWAP'A Basics - information for beginners as well as a few sly misrepresent, which You can crank the mail.

kodit Who's there? - Quick graphics: a few recipes from Zetter'a (print sprites, update the screen).

kodit Who's there? - Packer'y and Depacker'y: the truth about the packer or the ranting of Sir Kot'a.

kodit Who's there? - Working with MS-DOS: All about the mod files - a full description of the structure of mod-file, as well as a description of all effects.

kodit Who's there? - Working with MS-DOS: Ms-Dos floppy disk - a description of the structure of Ms-Dos disk.

kodit Who's there? - Chanky flame: a description of the algorithm chankovogo fire.

kodit Who's there? - Attribute bump mapping: bump mapping for those who have not entered.

kodit Who's there? - Guru meditates: optimization programs for execution time and size.

kodit Who's there? - An approximate search for a given sequence of bytes!

kodit Who's there? - Fast 42 print: fast how to print 42 characters in a row.

Party zone - KidSoft'98: a report from the Voronezh Festival of Computer Art.

Party zone - EarthQuake'99: a report from the Chelyabinsk festival of computer art.

Myself - 128 colors on the Spectrum: Revised scheme of up to 128 colors from the Donetsk group Spark.

Myself - Kettle: Connection General Sound to Profi through the system connector.

Myself - Uninterruptible Power Supplies: UPS-information technology.

Myself - General Sound Filter: story of the new gadgets to the GS.

Myself - Modems: Diagrams, charts! Scheme G. Shepeleva Kondratiev and M. Hayes modem connection.

Myself - Modems: Command - Command terminal.

Myself - Modems: Total modemizatsiya - a call to connect momedov.

System Software - FastCopy 3.0: a complete description of tricked out turbo-copyist.

System Software - Pro Tracker bugs! Several glyuchkov in ProTracker'ah.

System Software - Pro Tracker 3.4 final presentation remix Pro Tracker from Samara.

News - Chelyabinsk: X-Raizor returned to the Spectrum, Wocen wrote boot, Blade otdahyet, Steelzer joined Triumph, Crite completed the alpha version of the "World of Darkness", Bytic bought GS, Edison makes the site, Ironman wants to buy Spectrum.

News - Omsk: full staff and are expected products from a group of U98.

News - Kaliningrad: The loud death or Spectrum quiet life in Kaliningrad.

Techno-nature - Electronic music: Dj.Ironman talks about technology (Part 1).

Techno-nature - Electronic music: Dj.Ironman talks about technology (part 2).

Techno-nature - Internet music-sites: a lot of addresses where you can learn new about electronic music.

Techno-nature - Addiction XX: bike from Dj.Ironman 'as well.

a quarter to four - the story of everyday life from the X-Raizor'a.

Room with laughter - smells in and around: funny story from the magazine PTUCH.

Room with laughter - Perdmen: damning story of all of the same PTYuCh'a.

Room with laughter - Wick: nekolko scenarios from the film chronicles the wick.

Room with laughter - Halo: The end of the story published in the second room.

Proclamation - advertisements and announcements about finding friends on the Spectrum.

Proclamation - advertisements and announcements about finding friends on the Spectrum.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Sweet - condemnation.
Future Spectrum - Video Display V9990. Enhanced graphics capabilities ZX Spectrum.

В этот день...   23 November