Software - descriptions of the sound editor CYBERAX Sound Editor v1.0.

Deja Vu #0A
__________________________________________

(C) Max/CYBERAX Software/BDA
__________________________________________



_________    _________ ___________           ____     _______
_   ___   /   _____/ _   _____/   __ __  /_   |       _  
/      /  _____     |    __)_   |  |    |   |    /  /_  
     ____ /          |          |  |  /  |   |      _/   
 ______  //_______  / /_______  /  |____/   |___| /  _____  /
        /         /          /                  /        /
   CYBERAX Sound Editor v1.0 help file.




            Глава 1.
         Ух ты, какие кнопочки!..


   Управление  редактором   осуществляется
следующими частями клавиатуры:

CURSOR KEYS,
TRUE VIDEO,
INV VIDEO - move the cursor

ENTER - playing a sample

O, P - change parameters by one

U, I - accelerated change of parameters

SPACE - check/uncheck boxes

L - clearing the field under the cursor (cLear)

0 - clearing all fields in the sample line

SS+Q - deleting a sample line

SS+W - inserting a sample line

Y - copying the field under the cursor to the bottom
    line and move to it (copY)

T - setting repeat mark (loop To)

R - setting the repeat flag (Repeat)

E - setting the end of the sample flag (End)

1...8 - octave change

Z, S, X, D, C, V,
G, B, H, N, J, M - setting the note

The same keys pressed together with CS, will give
the frequency of a note one octave higher.  Tab-
faces of notes - REAL SOUND fromPT3.4

SS - switch to direct steam input mode -
meters (by the way, this is a very convenient
feature!).  Hold SS  and press
numeric keys can be entered character by character
parameter value.   If thunder is introduced
bone, then in addition to digital ones you can press
and keys A, B, C, D, E, F.  Pressing SPACE
will discard the changes made, and
releasing SS - to confirm them.

EXT MODE - exit the editor. Chapter 2.
 Oh, what kind of numbers are these?

   So, the sample consists of 256 positions (or
lines).  After compilation, what remains of it is
Only positions from zero to mark END
(or REPEAT).
 The presence of one of these marks is required
specifically.  The position containing the end mark
is also played.   If looping
is present, then after playing all
positions the sound will not die out, but will continue from
tags LOOP TO.
 The position consists of the following fields:

0) Label LOOP TO

1) Number (000 - 255)

2) Label REPEAT or END

3) Volume (0 - F)

4)Noise frequency (0 - 31)

5) Tone frequency (0 - 4095)

   Fields 4 and 5 contain checkboxes indicating
noise and tone masks, respectively.

   To read/write samples, I dug
a small glitch in BASIC.  After downloading
editor, a menu similar to this will appear:

             1. Edit sample
 2. Load sample
 3. Save sample
 4. Disk catalogue
 5. Clear sample

   Options are activated by pressing the corresponding
current figures.   I warn you right away that
there is no control for disk errors
is happening.  I also strongly advise against loading
put the left files into the editor - decompiler
does not check anything and can freeze the computer.

        Chapter 3.
Can you put CDs in your player?


   According to the roughest estimates, the player eats
maximum 300 cycles, which I think is not true
too much.  Before use, it is
sewn onto the player of your favorite music
cal editor.  For example, let
childrenProTracker v3.x.


;---------------------------------------
 ORG #6000
ENT

MUS_PLR EQU #C000;  PT3 player address
CHAN EQU 0;      channel number (0...2)
RG_TNE EQU CHAN*2+MUS_PLR+#300
RG_NSE EQU MUS_PLR+#306
RG_MIX EQU MUS_PLR+#307
RG_VOL EQU MUS_PLR+#308+CHAN

        CALL MODIFY;  distorting the player
        CALL  AY_OFF;  вырубаем AY
        CALL  MUS_PLR; инициализируем музу

SMP     LD    L,0;     номер сэмпла
        CALL  INI_SMP; инициализируем

MAIN    EI
        HALT
        CALL  MUS_PLR+5; муза
        CALL  SND_PLR;   звуки
        CALL  OUTPUT;    вывод на AY
        LD    A,#7F
        IN    A,(#FE)
        BIT   1,A
        JR    Z,SMP;     SS - звук
        RRCA
        JR    C,MAIN;    SPC - выход
        JP    AY_OFF

;L - SAMPLE
INI_SMPLD    H,0
        ADD   HL,HL
        LD    BC,SM_ADTB
        ADD   HL,BC
        LD    A,(HL)
        INC   HL
        LD    H,(HL)
        LD    L,A
        LD    E,(HL)
        INC   HL
        LD    D,(HL)
        INC   HL
        EX    DE,HL
        ADD   HL,DE
        XOR   A
        LD    (NO_SM_F),A;             *
        LD    (SND_PLR+2),A
        LD    (REP_ADR+1),HL
        LD    (SND_PLR+1),DE
        RET

SND_PLR LD    HL,0
        LD    A,H
        AND   A
        JR    NZ,SMP_ON
NO_SM_F RET;                           *
        LD    (RG_VOL),A; A=0 !!!      *
        LD    HL,RG_MIX;               *
        LD    A,(HL);                  *
        OR    CHAN*3+2/2*9;            *
        LD    (HL),A;                  *
        LD    A,#C9;                   *
        LD    (NO_SM_F),A;             *
        RET
SMP_ON  LD    A,(RG_MIX)
        OR    CHAN*3+2/2*9
        LD    C,A
        LD    A,(HL)
        INC   HL
        RRCA
        JR    NC,NOT_NSE
        EX    AF,AF
        LD    A,(HL)
        INC   HL
        LD    (RG_NSE),A
        EX    AF,AF
        RES   CHAN+3,C
NOT_NSE RRCA
        JR    NC,NOT_TNE
        LD    D,(HL)
        INC   HL
        LD    E,(HL)
        INC   HL
        LD    (RG_TNE),DE
        RES   CHAN,C
NOT_TNE RRCA
        JR    NC,NOT_REP
REP_ADR LD    HL,0
NOT_REP RRCA
        JR    NC,NOT_END
        LD    H,0
NOT_END AND   #0F
        LD    (RG_VOL),A
        LD    (SND_PLR+1),HL
        LD    A,C
        LD    (RG_MIX),A
        RET

AY_OFF  LD    HL,MUS_PLR+#300+10
        XOR   A
        LD    (HL),A
        DEC   L
        LD    (HL),A
        DEC   L
        LD    (HL),A
        DEC   L
        CPL
        LD    (HL),A
OUTPUT  LD    DE,#FFBF
        LD    BC,#FFFD
        LD    HL,MUS_PLR+#300
        OUT   (C),L
        LD    B,E
        OUTI
        !ASSM 12
        LD    B,D
        OUT   (C),L
        LD    B,E
        OUTI
        !CONT
        LD    A,(HL)
        OR    A
        RET   Z
        LD    B,D
        OUT   (C),L
        LD    B,E
        OUT   (C),A
        XOR   A
        LD    (HL),A
        RET

MODIFY  LD    HL,MUS_PLR+#6E1
        LD    (HL),#18
        INC   L
        LD    (HL),#2D
        INC   L
        LD    HL,MUS_PLR+#717
        LD    A,6
        CALL  MODIFY2
        LD    (HL),#DD
        INC   L
        LD    (HL),#7D
        INC   L
        INC   A
        CALL  MODIFY2
        LD    (HL),#18
        INC   L
        LD    (HL),#21
        INC   L
        LD    L,#44
        LD    A,13
        CALL  MODIFY2
        LD    (HL),#18
        INC   L
        LD    (HL),4
        RET

MODIFY2 LD    (HL),#32
        INC   L
        LD    (HL),A
        INC   L
        LD    (HL),MUS_PLR&H+3
        INC   L
        RET


;Табличка адресов сэмплов.
SM_ADTB DW    SAMPLE0
        DW    SAMPLE1
        DW    SAMPLE2
;       ...


;А это сами сэмплы.
SAMPLE0 LCODE "SMP0"
SAMPLE1 LCODE "SMP1"
SAMPLE2 LCODE "SMP2"
;       ...


;Музон с плэйером в формате PT3.X
        ORG   MUS_PLR
        LCODE "MUZAK"
;-----------------------------------------


   Когда первые восторги от звуков и музы-
ки поутихнут,  нетрудно  заметить  главный
недостаток проигрывателя:  если  во  время
звучания  продолжительного звука  включить
еще один, пусть дажеshort and black-
cue, the first sound will be cut off.  This effect
This is not unique to my player. Take-
Play any game with sounds and see the ana-
a logical picture (though in one of them
in such cases, the sound was output in an independent
a busy channel, but there was no music).
   I made an attempt to eliminate such
overlays and wrote another player.
This monster is already eating 1500 clock cycles maximum,
but it does its job.
   In general, nothing new and super-
I didn’t come up with a testimonial.   Just now
when calling a sound, you must specify it
priority (0-7). And if the priority of the current
effect is higher than the priority of the new effect, then
the latter will be skipped.
   True, there is one peculiarity here (and
why do you think I needed half a
ry pieces of measures?).   Let him continue playing
resident sample with priority 4.  You called
you get another one (short and with priority
3).  The first sound is interrupted, then plays
the second one breaks out, but after it ends
the first one will start playing again, and not with
the place where he was interrupted, and as if
he played continuously.
   Those. the player can play at the same time
up to 8 samples, but only the most “pri-
priority" of them.   If the priority is
current and new samples are equal, then the current
is interrupted and removed from the queue, and its
a new one takes its place.
   In addition, by making small changes to
player, you can enter Mouzon priority,
then the sample with lower priority will be
heard only when there is no
music.

;---------------------------------------
 ORG #6000
 ENT

MUS_PLR EQU #C000;  PT3 player address
CHAN EQU 0;      channel number (0...2)
RG_TNE EQU CHAN*2+MUS_PLR+#300
RG_NSE EQU MUS_PLR+#306
RG_MIX EQU MUS_PLR+#307
RG_VOL EQU MUS_PLR+#308+CHAN

        CALL MODIFY;  distorting the player
        CALL  AY_OFF;  вырубаем AY
        CALL  MUS_PLR; инициализируем музу
        CALL  CLR_SEQ; очищаем очередь

SMP     LD    HL,#0002; H - приоритет
        CALL  INI_SMP;  L - номер звука

        LD    HL,#0101
        CALL  INI_SMP

        LD    HL,#0200
        CALL  INI_SMP

MAIN    EI
        HALT
        CALL  MUS_PLR+5; муза
        CALL  SND_PLR;   звуки
        CALL  OUTPUT;    вывод на AY
        LD    A,#7F
        IN    A,(#FE)
BIT   1,A
        JR    Z,SMP;     SS - звук
        RRCA
        JR    C,MAIN;    SPC - выход
        JP    AY_OFF

;H=PRIORITY, L=SAMPLE
INI_SMP LD    A,H
        ADD   A,A
        ADD   A,A
        ADD   A,SMP_SEQ+1&L
        LD    E,A
        LD    D,SMP_SEQ+1&H
        JR    NC,$+3
        INC   D
        LD    H,0
        ADD   HL,HL
        LD    BC,SM_ADTB
        ADD   HL,BC
        LD    A,(HL)
        INC   HL
        LD    H,(HL)
        LD    L,A
        LD    C,(HL)
        INC   HL
        LD    B,(HL)
        INC   HL
        XOR   A
        LD    (NO_SM_F+1),A;           *
        LD    (DE),A
        DEC   DE
        LD    A,L
        LD    (DE),A
        INC   DE
        INC   DE
        LD    A,H
        ADD   HL,BC
        EX    DE,HL
        LD    (HL),E
        INC   HL
        LD    (HL),D
        DEC   HL
        DEC   HL
        LD    (HL),A
        RET

SND_PLR DI
        LD    (NO_SMPS+1),SP
        LD    SP,SMP_SEQ
        LD    B,8;                     [4]
        XOR   A
SMP_FND POP   HL
        OR    H
        JR    NZ,FOUND
        POP   HL
        DJNZ  SMP_FND
NO_SM_F JR    NO_SMPS;                 *
        LD    (RG_VOL),A; A=0 !!!      *
        LD    HL,RG_MIX;               *
        LD    A,(HL);                  *
        OR    CHAN*3+2/2*9;            *
        LD    (HL),A;                  *
        LD    A,NO_SMPS-NO_SM_F-2;     *
        LD    (NO_SM_F+1),A;           *
        JR    NO_SMPS
FOUND   LD    A,(RG_MIX)
        OR    CHAN*3+2/2*9
        LD    C,A
        LD    A,(HL)
        INC   HL
        RRCA
        JR    NC,NOT_NSE
        EX    AF,AF
        LD    A,(HL)
        INC   HL
        LD    (RG_NSE),A
        EX    AF,AF
        RES   CHAN+3,C
NOT_NSE RRCA
        JR    NC,NOT_TNE
        LD    D,(HL)
        INC   HL
        LD    E,(HL)
        INC   HL
        LD    (RG_TNE),DE
        RES   CHAN,C
NOT_TNE RRCA
        JR    NC,NOT_REP
        POP   HL
        PUSH  HL
NOT_REP RRCA
        JR    NC,NOT_END
        LD    H,0
NOT_END AND   #0F
        LD    (RG_VOL),A
        PUSH  HL
        POP   HL,HL
        LD    A,C
        LD    (RG_MIX),A
        DEC   B
        JR    Z,NO_SMPS
        LD    D,0
SMP_LP  POP   HL
        DEC   H
        INC   H
        JR    Z,NOT_EN
        LD    A,(HL)
        LD    C,A
        INC   HL
        AND   3
    LD    E,A
        ADD   HL,DE
        BIT   2,C
        JR    Z,NOT_RP
        POP   HL
        PUSH  HL
NOT_RP  BIT   3,C
        JR    Z,NOT_EN
        LD    H,D
NOT_EN  PUSH  HL
        POP   HL,HL
        DJNZ  SMP_LP
NO_SMPS LD    SP,0
        EI
        RET


;Эта маленькая процедурка - кардинальный
;способ вырубить все звуки.
CLR_SEQ LD    HL,SMP_SEQ+1
        LD    DE,4
 LD B,8;                     [4]
CLSQ_LP LD (HL),D
ADD HL,DE
 DJNZ CLSQ_LP
 RET

;Procedures AY_OFF, MODIFY and MODIFY2 absolute
;lutely identical to those placed in the first folio-
;tinge, so I boil them.  What if
;honestly, the animation doesn’t fit into the article...
;(Cardinal, damn, I cut the text buffer :)

SMP_SEQ DS 4*8;                   [4*4]

;Sample address table.
SM_ADTB DW SAMPLE0
 DW SAMPLE1
 DW SAMPLE2
;       ...


;And these are the samples themselves.
SAMPLE0 LCODE "SMP0"
SAMPLE1 LCODE "SMP1"
SAMPLE2 LCODE "SMP2"
;       ...


;Muzon with player in PT3.X format
 ORG MUS_PLR
 LCODE "MUZAK"
;---------------------------------------


   Now a few notes on players.

1) Music and sound players are better
   weigh on interruptions.

2) After calling the procedure MODIFY,player
   music no longer affects AY registers!
   If you need to drown out both the muse and sounds -
   remove the call MUS_PLR from interrupts
   SND_PLR,then call AY_OFF.

3) When the sound(s) is played to the end,
   cash is muted on 1 frame.  It's done
   so that there is no buzz leftfrom the last sound position played.
     If your music in this channel is not
   is never quiet, then he will score
   This humming noise and the plug can be removed. Then
   same if all your samples are
   are listed as an empty position.
     They are responsible for jamming in listings
   lines marked (*).

4) If you need to cut off sounds, then:

   a) for the first player, insert zero
      at SND_PLR+2

   b) for the second player, call CLR_SEQ
 (all sounds will die out), or push
      zero at address P*4+SMP_SEQ+1,where P-
 priority of the sound to be muted

   In both cases the sound will stop only
   after the next call SND_PLR  and
   OUTPUT (i.e. at the next interrupt).

5) I completely forgot!   In 2nd player
   the priority of sounds varies from0 to 7,
   and 0 is the highest priority.   LOW for-
   give priority more than seven!!!

6) WARNING!  If you optimize
   procedures INI_SMP (at first glance they
   written somewhat clumsily), then I don’t trust
   bark glitches!  The initializer is made like this
   lan specifically so that during its ra-
   bots could receive interruptions from vi-
   player sitting on them.   If we shorten
   After completing these procedures, the player can
   start playing "underinitialized-
   ny" sample, which, say, has an initial
   The lyzer managed to be set only by the young
   Lowest byte of the start address...

7) A little about the performance of the 2nd pro-
   player    Try to use
   smaller range of priorities. For example,
   if three levels of priority are enough for you,
   rity, then use the values 7,6,5;
if two - 7.6 etc.
     For mostenough applications
   four levels.  Somewhere in the listing
   there are commented out values
   in square brackets.  Use them
   to convert the player to 4 priority.


   Further development of the player:

1) Possible for each sample in the queue
   enter additional fields: offset
   tones and noise offset.  Then one and the same
   the sound can be played with different
   height.

2) You can also add a volume field there
   sound.  In this case it will be possible
   vary the volume of sounds in the game,
   for example, when changing the distance to
   their source.
     Convenient for volume control
   use contained in the player
   PT3 plate. This is done like this:

    LD A,#0X;  current volume 0...#F
VLM OR #Y0;    global volume*#10
    LD L,A
 LD H,MUS_PLR&h+1
 LD A,(HL); newvolume

3) It would be nice to introduce global volumes
   for Mouzon and for sounds.   This is done
   again according to the sign from the player.



            Chapter 4.
 Well, you hacker, damn it!

   If you downloadedCSE 1.0, then for sure
noticed a complete lack of convenient inter-
face for working with the disk (except for
BASIC).  To be honest, I was upset about something...
or compose.  However, the editor is written
in such a way that anyone who wants to come to him
can pick up his favorite filer.  For
This chapter will be useful to you.
   In addition, here is the structure
samples, which you will need if you
want to write your own compiler
sounds into the format you need, converter to/from
another format or player.

   The editor is located in memory with the address
ca #D100 and to the end.   The rest of the RAM is free
freely and can be used under file
ler.

   Editor entry points:

- #D100 - clearing the edited sample

- #D103 - compilationedited sample

- #D106 - sample decompilation

- #D109 - editing


   Logic of operation:

1) Before calling the editor, you must
   maybe give him some sample.   This
   can be done either by calling a cleanup or
   loading a sample from disk and calling decom
   peeler

2) After editing you need to call the
   peeler and only then save
   sample  When exiting the compiler in re-
   gistre BC contains the length of the sound.

3) In principle, you can work with some
   sawed sounds.   Information on
   the location in memory of the samples is given
   dena below.

4) I recommend looking at the BASIC loader,
   everything is explained in more detail there.


             Sample format.

   Sounds in the editor are presented in two
formats: uncompiled and compiled
bathroom  The first one is used inside CSE
for editingsounds, and in the second
format samples are stored on disk and played -
using the player.

I) Format of uncompiled samples.

   In memory, sample is located at address
#F700. The length of the sample is fixed and the composition
is 1024 bytes. For one position (line)
accounts for 4 bytes:

Byte 0:  bit 7 - label REPEAT
 bit 6 - label END
bit 5 - label LOOP TO
bits 3-0 - volume

Byte 1:  bit 7 - flag NOISE
 bits 4-0  - noise frequency

Byte 2: bit 7 - flag TONE
bits 3-0 - high 4 bits
                    tone frequencies

Byte 3:  bits 7-0 - low order 8 bits
                    tone frequencies

Note1: The flag is enabled if the corresponding
             the corresponding bits are equal to 1 and off
             Yes, if the bit is equal to 0.

Note2: 7th and 6th bits 0th bytes not
             can be simultaneously installed
             new!   Each of the three me-
             current can occur in the sample
             le no more than once.

II) Format of compiled samples.

   The compiled sample is located in
memory from address #FB00.  Sample length
Belt-based and depends on the position of the tagEND
(REPEAT) and on the number of enabled flags
TONE and NOISE in the sample.
   The first 2 bytes contain the offset from
start sample+2 to the position to which
looping occurs (LOOP TO).
 Next come the positions themselves. For each
ranges from 1 to 4 bytes:

Byte 0: bits 7-4 - volume
         bit 3 - label END
 bit 2 - label REPEAT
 bit 1 - flag TONE
 bit 0 - flag NOISE

   Availabilitythe remaining bytes depend on
byte 0 values:

- if NOISE=TONE=0,then more in this
  There are no byte positions.

- if the flag is NOISE=1,then the low order 5 bits follow
  The next byte contains the frequency value
  noise.

- if the flag TONE=1, then there are two bytes
  tone frequency: most significant byte first
  mi4frequency bits (contained in 4
 least significant bits), then the least significant byte
  eight.

- if NOISE=TONE=1, then the byte comes first
  noise frequencies, then 2 tone bytes.

  The end of the sample is indicated by the switched on
flag END or REPEAT. In the second case,
There is a transition to the labelLOOP TO.




            Chapter 5.
Yeah! Bonus pack!

   The editor comes with a special
albonus pack,in which you
you will find a collection of almost #100
ready-made sounds!  It was all me
pulled from MSX's sound mods
lei, which, in turn, I
borrowed from music books MSX-1...MSX-12
(these are not all sounds, I chose
more or less decent).
   At first I wanted to just put the sounds
in a zip archive, but then I thought that there were none
It’s very convenient to listen to this way
(need to be loaded into the editor one by one).  By-
this had to make a small player with
the ability to upload samples to disk.
   By studying these sounds in the editor you can
learn how to create good effects yourself
(after all, they were made by professionals for
toys on MSX).  By the way, try to find
in this collection barking dog fromMETAL
GEAR...



            Chapter 6.
 Write, Shura, write!

   For all questions related to CSE write
to the editor.  If you desperately need some...
or a function (for example, copying pieces
sample to the buffer and back) - write.   If
I think your idea is rational and I have
If I have time and desire, I will provide support.
   If any glitches suddenly appear
(especially fatal ones) - don’t be lazy and
please let me know.
   In principle, I can help with adaptation
sound player to another music player
to the editor (PSC, ST PRO, FT, GT, ASM..),
although I don’t know who this might cause
problems.
   Yes, I completely forgot!   If you make it convenient
fast and fast disk interface - built-in
bark!

Share your thoughts about the article