MIX EDITOR AND MIX PLAYER CREATOR
By C.J. Richardson
for 8-bit Software
"MixEd" is a program to load in, edit, play, alter and save mixes.
"RunBld" is a program to build a machine code mix player routine in
order to play the mix.
For both programs PAGE is best at &E00. However it will be alright
elsewhere. If using PAGE elsewhere, the only problem is likely to
occur when using the example data lines I include.
______________________________________________________________________
IMPORTANT NOTICE
This is the first version of MixEd and has been initially written to
work on a Master computer or compact. However the MixEd and RunBld
programs should run on a Model B although an error free operation
cannot be guaranteed. You may also get distorted sounds from the
speaker. Both programs are not error trapped and thus accurate input
from the keyboard is required. As this program is in it's initial
stages I would be grateful if members would make a note of and report
all errors that occur.
______________________________________________________________________
"MixEd" - The Mix Editor
MixEd presents you with a menu, the options from which are chosen by a
single keypress highlighted in brackets. Explanations of each menu
option are highlighted below ...
(H)ISTORY
Will display a history of load actions. When a program is loaded, the
start and end addresses in memory to where it was loaded are
remembered. Up to about 50 actions are remembered.
(W)IPE HISTORY
After about 50 loads, the history memory is full. Further load
history is remembered in the last free memory location, at this stage,
the history is unreliable. The load history memory is reset by
pressing W.
(L)OAD FILE FROM &<location>
A file will be loaded into memory from the location displayed.
This location can be changed by the options listed below.
(S)AVE FILE FROM (B) TO (E)
A file is saved using the memory locations specified by BEGIN and END.
It is saved with the reload address set to wherever HIMEM is.
(B)EGIN AT &<location>
Change the load and play start address. This figure will be used to
start saves from and to start playing from using option (P). Two
keypresses are required. Enter the MSB of the number only (ie. for
&6700 just press 6 then 7). Remember to check that you do not load
data to below HIMEM.
(E)ND AT &<location>
Change the load and play end address. This figure will be used to end
saves at and to finish playing at. Again, enter only the MSB.
(R)ATE &<number>
Change the speed that the mix is played at. 0 is slow. 1 is fastest.
&FF is slowest (&10 to &20 is about the usual).
(Z) Decrease begin address by &100
(X) Increase begin address by &100
(<) Decrease end address by &100
(>) Increase end address by &100
(P)LAY MIX
Plays mix from the specified begin to end addresses.
(C)HANGE DATA
A page of memory is displayed. Control codes are replaced by a space.
A beep is issued when a control code is not displayed. You may then
replace this page with a character which you can specify. Nothing
will be replaced if you just press Return.
(*) OSCLI
Issue a MOS command. Useful for changing filing systems etc.
______________________________________________________________________
It is possible to select a short section of sound, save it back to
disc, do this with other short sections from other samples, then load
them all back in into different areas of memory by the use of the
Begin option. Then re-save the whole thing. You can then load the
new mix into "RunBld". To play each section you must make a note of
the start and end addresses of the separate sections whilst using
MixEd.
______________________________________________________________________
"RunBld" - The Mix Player Construction Program
After saving your own mix, you can then run it directly without using
"MixEd" (you can also use this program to build run routines for any
other mix). "RunBld" assembles a run routine for the mix. There are
three things that the run routine needs to know before it can play a
mix. The most significant byte (MSB) of the start and finish address
of the section of memory to be played, and the rate at which it is to
be played (The MSB of &1900 is &19).
At the end of RunBld (line 260 onwards) are data lines. You write
these data lines, when the play option is chosen the program reads the
data to find out the three values itneeds to play each section of mix.
The data is entered in blocks of three. The first number is the MSB
of the start address. The second number is the MSB of the end
address. The third number is the speed at which the section is
played. There can be a number of repeats of blocks. The start and
end addresses are determined by you when listening to the mix using
MixEd. You are presented with a menu, the options are as follows ...
(L)OAD A MIX
Load a mix starting at HIMEM.
Please see the note about HIMEM being at different values.
(S)AVE A MIX PLAYER
Save the mix player that you have assembled from &900 onwards.
(P)LAY THE MIX
Plays the mix using the addresses that you have put into the DATA
statements at the end of the program.
(I) LOAD IN THE DATA STATEMENTS THAT YOU HAVE PREVIOUSLY SAVED
The data needed to tell the mix player what to play is stored in the
lines from 260 onwards. It is possible to save just these lines to
disc. I have included an example of data lines in directory D
(filename D.VIVDAT). Before loading a set of lines in, all the line
numbers in the program from 260 onwards are deleted first, this stops
any mixing of lines.
(O) SPOOL THE LINES CONTAINING THE DATA STATEMENTS TO DISC
Lines 260 onwards are the lines which hold the information the mix
player needs. After entering a file name, the lines are saved to
disc. The data lines from the example is in directory D, they were
saved using this option.
(*) ENTER AN OSCLI COMMAND
______________________________________________________________________
<Escape> to list the data statements. The Data statements are read in
blocks of three. The first number of the block is the MSB of the
start address. The second number of the block is the MSB of the end
address. The third number of the block is the rate at which the mix
is played, 1 is the fastest &FF is the slowest, &10 to &20 is about
the usual speed. The data is terminated by three zeros. However only
the first zero is needed, if the second zero is changed to 1, then the
mix will be played in an endless loop. If the third zero is changed
to 1, then the mix will be also played backwards. Remember that the
start address must then be higher than the end address!
Here are a couple of examples of the data lines ...
DATA &19,&80,&10,0,0,0 - Will play the whole of the mix in memory
(&1900 to &8000) at a rate of &10
DATA &19,&80,&10,&19,&80,&10,0,0,0 - Will do the same again but twice.
DATA&30,&40,&40,0,0,0 - will play a small section of the mix slowly.
DATA&80,&19,&20,0,0,1 - will play the whole of memory but backwards
note that the start address must be higher
than the end address.
DATA&80,&19,&20,0,1,1 - will play the whole of memory, backwards and
forever.
Once you have saved the mix using MixEd and noted the start and end
addresses of each section in the mix, run RunBld. Load in the mix.
Press Escape, list the program and then change the data statements,
each start and finish address followed by the speed it is to be played
at. Look at some of the examples in directory D. Load in any of
these programs using the (I) option from RunBld, they are the data
statements that I wrote to build the mix player examples. Run the
program again and listen to the mix by pressing P. When you are happy
with the sound, use the save mix runner option (S). After naming the
file, in future all you have to do is *LOAD the mix, then *RUN the mix
runner.
When loading a mix into RunBld, HIMEM is the address that it will be
loaded to. This is to avoid the mix overwriting the program. Usually
HIMEM will be at the same address for both MixEd and RunBld and no
problem will occur. However, if you are using a model B with PAGE at
&1900 and load in the example mixes, you will find that if you then
load in the example data lines that I include on the disc, that they
will not run the mix as desired. This is because the mix will have
been re-loaded from a different address and therefore you will need to
alter the data statements, adding an offset. The mix should run from
&1900. If you are running it from &2400 (which is where it will be if
page is at &1900) every first and second data statement needs &B
adding to it. The third value (pitch) does not need altering of
course. One way to do this without spending ages converting hex
numbers is to change line 190 of MixBld to ...
190P%=P%+20:[OPTl%:.start:]:REPEAT:READa%,b%,c%:IFa%<>0:a%=a%+&B:b%=b%+
&B:[:OPTl%:LDA#a%:STA&75:LDA#b%:STA&76:LDA#c%:STA&74:JSR&900:]
This will simply add the desired offset to the data as it is read in,
thus allowing the data examples I include to run correctly. Another
solution is to *LOAD the mix in before CHAINing MixBld. However, the
first bit of the mix will then be corrupted.
Chris Richardson (2J3).