home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
ST_USER
/
1992
/
USERJA92.MSA
/
EDSYNTH_READ.ME
< prev
next >
Wrap
Text File
|
1987-04-21
|
34KB
|
1,057 lines
Edsynth V1.2
A complete music synthesizer system for the Atari ST
By Chris Horton
Table of Contents
1 Introduction .............................................. 1
1.1 Programming Information .............................. 1
2 The Editor ................................................ 2
2.1 The Command Language ................................. 2
2.2 The Commands ......................................... 3
2.2.1 Envelope ....................................... 3
2.2.2 Note ........................................... 4
2.2.3 Off ............................................ 4
2.2.4 Double ......................................... 5
2.2.5 Chord .......................................... 5
2.2.6 Slide .......................................... 5
2.2.7 Vibrato ........................................ 5
2.2.8 Tremolo ........................................ 5
2.2.9 Freq ........................................... 6
2.2.10 FadeIn ......................................... 6
2.2.11 FadeAway ....................................... 6
2.2.12 Loop ........................................... 6
2.2.13 Restart ........................................ 6
3 An Example Tune ........................................... 7
4 Editor Functions .......................................... 9
4.1 F1 - Load file ...................................... 9
4.2 F2 - Merge file ..................................... 9
4.3 F3 - Save file ...................................... 9
4.4 F4 - Save a file in stand-alone format .............. 9
4.5 F5 - Erase voice .................................... 9
4.6 F6 - Top of input data .............................. 9
4.7 F7 - Bottom of input data ........................... 9
4.8 F8 - Disk directory ................................. 9
4.9 F9 - Stop tune ...................................... 9
4.10 F10 - Play tune ..................................... 10
5 Including stand-alone tunes in your own programs .......... 11
6 Personal use of Edsynth ................................... 14
Edsynth V1.2 1 Chris Horton
1 Introduction
This manual describes the utilisation of Edsynth, a music
synthesizer system for the Atari ST series of computers. It
consists of an editor for the entry of the music commands which
are then compiled and passed to the synth for playing. As the
synth has been designed to run on the interrupt system of the
computer, once started the music merely continues as a background
task, allowing further editing while playing music.
The synth allows three voices to be played simultaneously as
well as a noise channel. However, with a little bit of programming
this limit can be overcome. There are special commands built into
Edsynth to allow multiple notes to be played on a voice, thus
giving the illusion of extra voices. This gives a theoretical
maximum of nine voices, plus the noise channel! This manual will
describe all the editor commands in detail, as well as how to
install the synth into your own programs.
1.1 Programming Information
Edsynth was written entirely in 68000 Machine Code, assembled
using the GST Assembler. Programming began in Summer '88 and ended
in Spring '89. V2.0 under development.
Edsynth Manual February '89
Edsynth V1.2 2 Chris Horton
2 The Editor
On booting up you are confronted with the editing screen. The
first thing you will notice are the three boxes on the screen;
this is where the music commands for the three voices are input -
voice 1 is the first box, voice 2 the second, etc. At the moment
the cursor is in the input area for channel 1, but pressing the
right and left cursor keys jumps between the other voices. Before
we begin writing a tune let's load in a tune and hear just what
the synth can do. Press the F1 key. Now the cursor is located on
the bar at the top of the screen. Type :
TUNE.DAT
The disk-drive will spin for a few seconds, and then you will
be asked which voices you want loaded. We want all the voices, so
simply hit RETURN. The data file will now be loaded, and the input
areas fill with the code for this tune. The cursor is now back in
the input area for channel 1. Now press F10, but first make sure
the volume on your TV is turned up. You will now be able to hear
the tune playing. But notice how the cursor can still be moved.
This is because the music is running as a background task,
allowing re-editing of the music, even while it's still playing!
You might have wondered why we can only see seven lines of
the code for each voice. This is because the input area is really
a window through which only a small amount of the code can be
seen. We can look at the rest by making the window look at a
different section of the code. Press the down cursor key. In
response, the cursor moves down a line. Keep pressing until it
moves off the bottom line. You will see that the text has scrolled
up and another line can be seen. Moving back up is accomplished by
pressing the up cursor key. However if we wanted to find a line
further down in the text, it is going to take a long time
scrolling line by line through the code. For this reason a paging
facility has been included. Simply press SHIFT while pressing the
required cursor key, and the text scrolls up a whole page - or
seven lines.
Now press F4. This is the erase facility. You are now being
asked which voice you wish to erase. We want to erase all voices
so simply press RETURN. All the input areas are now empty, in
preparation for data entry.
2.1 The Command Language
Edsynth tunes are written in a language that has to be
learned before we can begin our composition. The tune code is made
up of a sequence of music commands such as ENVELOPE, NOTE, DOUBLE,
and a host of others, the use of which is described in detail
below. However I will just include here a brief note on how these
are input to the editor. To ease the entry of tunes, the editor
only expects the first letter of each command to be typed, which
it will then expand to the full command name.
For example, press the E key. The editor expands this to
ENVELOPE - the first music command. Now the cursor moves on to the
Edsynth Manual February '89
Edsynth V1.2 3 Chris Horton
next input column. For this particular command, the next parameter
has to be a number - let's say 01. So hit the 0 key and then the 1
key. We are now on the next column.
Type : F 01 A 05
Now the cursor should be in the last column. Press the T key
and then the N key. The cursor has now returned to the left-hand
side of the input area ready for the next command entry. Don't
worry about what you have just typed in, all will be revealed
later.
2.2 The Commands
Here follows a description of all the commands available in
Edsynth.
2.2.1 Envelope
It would be pretty boring if, when a note was played, it
stayed at one particular volume throughout. Therefore, we need a
way of describing the way the volume of the note changes as it is
played. The ENVELOPE command fulfils this purpose for us.
The diagram below shows how the envelope of a voice is
constructed.
/\
/^ \
/ | \
/ | \___________
/ | | ^ |\
/ | | | | \
/ | | | | \
/______|___|____|_____|___\
| | | | | |
| | | | | |
|<---->| | SUSTAIN | |
ATTACK| | LEVEL | |
|<->| | |
|DECAY | |
| |<->|
| RELEASE
PEAK VOLUME
LEVEL
It's pretty difficult to understand, so I'll go through it
stage by stage.
The ATTACK SPEED is the speed with which the volume rises to
its peak when the note is played. The higher the attack value, the
slower the increase in volume. The PEAK VOLUME is the maximum
volume reached before the note begins to die away again. The DECAY
SPEED is the speed at which the volume decreases before it holds
steady at the SUSTAIN LEVEL for the duration of the note. When the
note stops it doesn't simply cut out, but decays away at the speed
Edsynth Manual February '89
Edsynth V1.2 4 Chris Horton
of the RELEASE value.
The ENVELOPE command sets up all these values for a
particular voice. They are input in the order they were described
above, with the addition of one more parameter - we must say
whether the voice is going to be a tone or noise (a tone plays a
pure note, and a noise plays as a kind of hissing sound), or both
at the same time.
It is easiest explained with an example :
ENVELOPE 01 F 01 A 05 TN
This sets the ATTACK as 1, PEAK VOLUME as 15, DECAY as 1,
SUSTAIN LEVEL as 10, RELEASE as 5, and the voice will play both
tone and noise.
NOTE
Edsynth uses a numbering system called hexadecimal (base 16).
In this system all the digits 0 to 9 are used as well as the
letters A to F. Thus the number ten becomes 0A, thirteen 0D,
seventeen 11, etc.
All notes thereafter will be played with this envelope until
the next ENVELOPE command is reached.
When the cursor is in the TN column (the small one on the far
right), it expects you to specify noise - N - last. So if you
simply want noise, just press 'N', and the cursor will proceed to
the next line. For both tone and noise type 'T' first and then
'N'. However, if you only want tone, then type 'T' as before and
then hit the SPACE bar, so that the editor realises that you don't
want noise as well.
2.2.2 Note
This command selects the pitch and duration of the note to be
played. For example :
NOTE C#3 0010
The above plays the note C SHARP of octave 3 for duration 10
(in hex).
Edsynth allows notes in the octave range 0 to 7.
2.2.3 Off
When we want to insert a pause into the tune, the OFF command
is used. The only parameter needed here is the duration of the
pause. Hence :
OFF 0050
will pause for duration 50. When an OFF command is reached
the note decays away at the speed that the RELEASE has been set
to.
Edsynth Manual February '89
Edsynth V1.2 5 Chris Horton
2.2.4 Double
I mentioned above Edsynth's ability to play two notes with
one voice. This technique is achieved by rapidly alternating
between two notes to give the effect of both notes playing at the
same time. The command used for this is DOUBLE and it requires
four parameters:
DOUBLE C3 G3 01 0020
The first two are the notes to be played, the third the speed
with which the synth alternates between the two, and the last is
the duration for which they are held.
2.2.5 Chord
This command is very similar to DOUBLE except this time three
notes are played as opposed to just two. Thus an extra parameter
is required:
CHORD C3 D#3 G3 02 0010
The first three are the notes to be played, the fourth is the
speed of alternation, and the last is the duration.
2.2.6 Slide
Wouldn't it be nice if, instead of simply jumping from one
note to the other, we good gradually move through all the
intervening pitches (this is called a glissando in musical terms).
This is the role of the SLIDE command.
SLIDE G2 G3 0050
The first two parameters are the start and destination notes
respectively. Lastly comes the duration of the slide (the smaller
the duration the faster the slide, and vice versa).
2.2.7 Vibrato
Vibrato is a technique which quite simply varies the pitch of
a note by a certain amount above and below the note as it is
played. This is a rather complex command, requiring three
parameters.
VIBRATO 05 01 04
The first is the amount by which the pitch is varied (in this
case 5 pitch graduations above and below the note). The second is
the speed with which the pitch varies between these limits (the
smaller the number the more gradual the effect). The last is the
delay after the note has been played, before the vibrato takes
effect (set this to zero, and the vibrato begins immediately).
2.2.8 Tremolo
Tremolo is much the same as vibrato, except that it varies
the volume. This only requires two parameters - the amount of
variation, and the speed of the tremolo.
Edsynth Manual February '89
Edsynth V1.2 6 Chris Horton
TREMOLO 04 02
It is useful to realise that if the note is in its decay or
release period, the tremolo produces a kind of echo effect as the
note dies away.
2.2.9 Freq
This command is used to vary the pitch of the 'hiss' produced
when a voice is playing as a noise. FREQ only has one parameter -
the frequency of the noise channel - which can be anything from 00
to FF. As there is only one noise channel, it should be noted that
changing the frequency affects all voices playing as noise.
2.2.10 FadeIn
With this command you can create the effect of music fading
gradually from zero volume to maximum. Only one parameter is
required - the fade speed.
FADEIN 0010
2.2.11 FadeAway
This is exactly the same as FadeIn except the volume changes
from maximum to zero.
FADEAWAY 0040
2.2.12 Loop
Many tunes have phrases which are repeated, and it would be a
nuisance if the phrase had to be retyped every time it was to be
played. This is where the LOOP structure comes in. LOOP allows a
sequence of commands to be replayed a certain amount of times
before moving on to the next set of commands. It takes two
parameters - the amount of lines to be repeated, and the number of
times they are to be repeated.
LOOP 09 02
The above would repeat the next nine lines twice (i.e. the
phrase would be played three times in all).
2.2.13 Restart
The last command is often used at the end of a tune and
simply resets that particular voice back to the first command.
Edsynth Manual February '89
Edsynth V1.2 7 Chris Horton
3 An Example Tune
The easiest way to get used to the language is to write a
short tune as an example. Type in the following commands for each
of the three voices - remember only the first letter of each
command is needed.
VOICE 1
ENVELOPE 00 F 01 0 00 T
FREQ 15
LOOP 06 03
NOTE C1 0008
NOTE C2 0008
ENVELOPE 00 F 01 0 00 TN
NOTE C2 0008
ENVELOPE 00 F 01 0 00 T
NOTE C2 0008
LOOP 06 03
NOTE A0 0008
NOTE A1 0008
ENVELOPE 00 F 01 0 00 TN
NOTE A1 0008
ENVELOPE 00 F 01 0 00 T
NOTE A1 0008
LOOP 06 01
NOTE G0 0008
NOTE G1 0008
ENVELOPE 00 F 01 0 00 TN
NOTE G1 0008
ENVELOPE 00 F 01 0 00 T
NOTE G1 0008
LOOP 06 01
NOTE B0 0008
NOTE B1 0008
ENVELOPE 00 F 01 0 00 TN
NOTE B1 0008
ENVELOPE 00 F 01 0 00 T
NOTE B1 0008
NOTE C1 0020
ENVELOPE 00 F 01 0 00 TN
NOTE C0 0020
VOICE 2
ENVELOPE 00 F 01 C 00 T
VIBRATO 07 07 06
NOTE G3 0080
NOTE A3 0080
NOTE A#3 0010
NOTE A3 0020
NOTE G3 0030
NOTE D#3 0020
NOTE C3 0010
SLIDE C3 C2 0010
Edsynth Manual February '89
Edsynth V1.2 8 Chris Horton
NOTE C2 0010
OFF 0010
VOICE 3
ENVELOPE 00 F 02 0 00 T
LOOP 05 01
DOUBLE G#3 G#4 01 0008
DOUBLE G3 G4 01 0010
DOUBLE G3 G4 01 0010
DOUBLE G3 G4 01 0010
DOUBLE D#3 D#4 01 0008
LOOP 05 01
DOUBLE F3 F4 01 0008
DOUBLE E3 E4 01 0010
DOUBLE E3 E4 01 0010
DOUBLE E3 E4 01 0010
DOUBLE C3 C4 01 0008
DOUBLE G3 G4 01 0010
DOUBLE G3 G4 01 0010
DOUBLE F3 F4 01 0010
DOUBLE F3 F4 01 0010
DOUBLE D3 D4 01 0010
DOUBLE D3 D4 01 0010
DOUBLE B2 B3 01 0010
DOUBLE B2 B3 01 0010
DOUBLE C3 C4 01 0020
DOUBLE C4 C5 01 0020
If you make any mistakes, the BACKSPACE key will allow you to
edit within the column you are currently typing in. If you want to
change a line simply move the cursor onto that line and type in
the new command - the old one will be deleted automatically as you
start typing. If you want to take out a line without putting
another in its place, move on to the offending line and hit the
DELETE key. Inserting a line in between two others is just as
simple, just move to the position at which you want to put your
new command, and press the INSERT key (it's next to the cursor
keys).
Now simply turn up the volume and press F10. Okay, so it's
nothing spectacular but it does demonstrate most of the commands
available, and serves as a good introduction to Edsynth's
capabilities.
Edsynth Manual February '89
Edsynth V1.2 9 Chris Horton
4 Editor functions
I have already explained the use of the BACKSPACE, DELETE,
and INSERT keys, but there are also a plethora of other facilities
available from the keyboard, mainly from the row of function keys.
There now follows a list of the keys and there respective uses.
4.1 F1 - Load file
When F1 is pressed, the cursor moves into the top input line
and prompts for a filename. Just type in the name of the music
data file to be loaded and then press return. You will now be
prompted to select the voice to be loaded. If you want all the
voices, then hit RETURN. If a single voice is selected, you are
then asked into which input area you want the data to be loaded.
Any loading errors will be reported.
4.2 F2 - Merge file
This function appends the selected voices of the new music
file onto the tune currently in memory.
4.3 F3 - Save file
Saves the tune currently in memory to disk. Files saved in
this fashion can later be loaded back into the editor with the F1
key. The convention I use is to have filenames with the extender
.DAT for tunes saved with this function.
4.4 F4 - Save a file in stand-alone format
This saves a version of the music synthesizer, with the
compiled version of the tune currently in memory. Tunes saved in
this fashion cannot be loaded back into the editor, but are for
inclusion in your own programs. I use the extender .MUS for
stand-alone files.
4.5 F5 - Erase voice
Allows a specific voice (or all voices if required) to be
erased from memory.
4.6 F6 - Top of input data
Pressing F6 moves the cursor to the first command of the
current voice being edited.
4.7 F7 - Bottom of input data
The opposite of F6 - moves to the last command of the current
voice.
4.8 F8 - Disk directory
Gives a list of the files on the disk in the drive. At the
prompt type the pathname to be searched (e.g B:\*.* ). Pressing
return defaults to the pathname *.DAT . The directory will be
displayed in the input area for voice one, and appears seven lines
at a time. To see the next page press any key. Pressing ESCape
exits from this command and returns you back to normal editing.
4.9 F9 - Stop tune
Stops playing the current tune,
Edsynth Manual February '89
Edsynth V1.2 10 Chris Horton
4.10 F10 - Play tune
Plays the tune currently held in memory.
NOTE
When asked for a filename, pressing the ESCape key (or
pressing RETURN without entering a filename), will exit from that
command without any effect.
Sometimes when you are editing a tune, you may want to
concentrate on one voice at a time. Pressing the 1,2, or 3 keys
on the numeric keypad, toggles the selected voice on or off.
There are two other special keys, namely the + and - keys on
the numeric keypad. Pressing + emulates a sort of fast-forward
feature, moving rapidly through the tune in memory. Conversely, -
restores the speed to normal. This facility is great for long
tunes, where you don't want to listen to the whole tune again,
just to here a section towards the end.
Edsynth Manual February '89
Edsynth V1.2 11 Chris Horton
5 Including stand-alone tunes in your own programs.
NOTE
This section is strictly for experienced programmers!
The stand-alone file consists of the synth player and the
compiled code for that particular tune. The synth is completely
position independent (it can be loaded anywhere in memory). The
music runs on the vertical blank (located at $4CE) and once
installed can be forgotten. The address to be placed on the
vertical blank is simply the music load address.
For example - if you load the synth at $30000, put $30000 at
$4CE (or alternatively your own vertical blank routine can include
the instruction JSR $30000).
To start the tune include a JSR to the load address + 4.
Subsequent calls to this routine will restart the tune from the
beginning. Before this routine is called however, you must ensure
the computer is in Supervisor mode.
The following is a program which outlines this procedure. It
first loads in the file TUNE.MUS (this is the demo music,
contained on the disk - it must be in the same folder as this
program), and initialises it on the vertical blank. Two
subroutines are also included to stop and start the music.
************************************
* Example program to load and play *
* a stand-alone Music file *
************************************
* By Chris Horton *
************************************
CLR.L -(SP) ; Set supervisor mode
MOVE.W #$20,-(SP)
TRAP #1
ADDQ.L #6,SP
MOVE.L $4CE,OLD_VBL ; Save old vertical blank
BSR LOADMUSIC ; Load the music file
MOVE.L #STORAGE,$4CE ; Put synth onto vertical blank
BSR STARTMUSIC ; Start music playing
******************************
* Your own code goes in here *
******************************
* The following simply waits *
* for a keypress before *
* turning off the music and *
* ending the program. *
******************************
Edsynth Manual February '89
Edsynth V1.2 12 Chris Horton
MAIN MOVE.W #7,-(SP) ; Wait for a keypress
TRAP #1
ADDQ.L #2,SP
**********************************
* Turn off music and end program *
**********************************
EXIT BSR STOPMUSIC ; Stop the music.
; Could be restarted with
; another BSR STARTMUSIC
MOVE.L OLD_VBL,$4CE ; Restore old vertical blank
OR.B #1,$484 ; Turn key-click back on
CLR.W -(SP) ; Exit to desktop
TRAP #1
*******************
* The subroutines *
*******************
*******************************
* STARTMUSIC *
* Starts the music playing or *
* restarts if already playing *
*******************************
STARTMUSIC
JSR STORAGE+4
RTS
***********************
* STOPMUSIC *
* Pauses the music *
* can be restarted by *
* calling STARTMUSIC *
***********************
STOPMUSIC MOVE.B #1,STORAGE+$59E ; This is a flag which :
; pauses music if set,
; continues if cleared
MOVE.B #7,$FF8800 ; Turn off all sound channels
MOVE.B #$FF,$FF8802
RTS
************************
* LOADMUSIC *
* Loads the music file *
* at address STORAGE *
************************
LOADMUSIC MOVE.W #2,-(SP) ; Open file
PEA FILENAME
Edsynth Manual February '89
Edsynth V1.2 13 Chris Horton
MOVE.W #$3D,-(SP)
TRAP #1
ADDQ.L #8,SP
MOVE.W D0,HANDLE
PEA STORAGE ; Read file
MOVE.L #$FFFF,-(SP)
MOVE.W HANDLE,-(SP)
MOVE.W #$3F,-(SP)
TRAP #1
ADD.L #12,SP
MOVE.W HANDLE,-(SP) ; Close file
MOVE.W #$3E,-(SP)
TRAP #1
ADDQ.L #4,SP
RTS
****************
* Storage area *
****************
OLD_VBL DS.L 1
HANDLE DS.W 1
FILENAME DC.B 'TUNE.MUS',0
STORAGE DC.B 0
END
Edsynth Manual February '89
Edsynth V1.2 14 Chris Horton
6 Personal use of Edsynth
You are free to include any stand alone files in your own
programs. All I ask is that you include on your title screen the
legend :
Music Synth by Chris Horton
Edsynth Manual February '89