A complete range of facilities i provided for playing music composed with the AMOS Professional system, as well as module created with the popular Tracker and Med systems.
Any pieces of AMOS Professional music that are to be used with your programs must be held in the Music Bank, which is normally Bank 3. These musical pieces can be played without affecting tiny other part of the main program. If sound effects are triggered on a channel that is currently playing music, the tune will be suspended while the sound effect is performed, and will start again from its last position once the effect is over.
Several musical arrangements can be stored in the same bank, provided that there is enough memory, and to identify melodies each piece of music must be given its own number.
instruction: play a piece of AMOS Professional musicThe MUSIC command is used to start playing the specified melody. Up to three different melodies can be started at the same time, but each new MUSIC instruction will halt the current melody and hold its status in a stack. When the new song has ended, the original music will start again exactly where it left off. Here is a ready-made melody to load and play:
Load "AMOSPro_Examples:Music/Music.Abk"
Music 1
If you do not want your music to play through to the end, it can be halted in either of the two following ways.
instruction: stop a single passage of music
Music Stop
This instruction brings the current single passage of music to a halt. If there is any other active music held in the stack and waiting to be played, that music will begin to play at once.
instruction: turn off all music
Music Off
The MUSIC OFF command is used to turn off all AMOS Professional music in your program completely. After this command has been called, the sound track can only be re-started by executing a MUSIC command all over again.
instruction: set the volume of a piece of music
Mvolume level
To set the volume of a piece of music, or to change its current volume, this command is followed by a number ranging from zero for complete silence, up to 63 for as loud as possible.
Obviously, by setting up a simple loop, you can fade your music up or down.
instruction: change the speed of a piece of music
Tempo speed
Changing the volume or speed of music and sound effects can enhance the mood of most programs. The TEMPO command is used to modify the speed of the current melody, and must be followed by a number ranging from 1 for as slow as possible, up to 100 for incredibly fast. Here is an example of music mood changing:
Load "AMOSPro_Examples:Music/Music.Abk"
Music 1
Do
For X=0 To 63
Tempo X: Mvolume X
Wait 10: Next X
Loop
Please note that music created using the Tracker and MED systems may include their own tempo and volume labels, and these will override the settings specified by AMOS Professional.
If you are unable or unwilling to write your own musical masterpieces, there is no need to worry. AMOS Professional lets you take other composers' soundtracks and add them to your original games and utilities. There are thousands of public domain soundtracks written with various systems, and to make life easy, you are provided with a range of commands that will play the latest Soundtracker modules.
A Tracker module can only be played while all other AMOS Professional music is stopped. The following TRACKER instructions should only be used for Tracker modules and not for normal AMOS Professional music, otherwise some bizarre noises are likely to be generated. The AMOS Professional VOLUME and TEMPO commands will have no effect on Tracker modules, which have their own built-in controls.
instruction: load a Tracker module
Track Load "modulename",bank number
Use this command to load a specified Tracker module into the memory bank number of your choice. Any existing data in this bank will be erased before the module is loaded, and the new bank will be called "Tracker".
instruction: play a Tracker module
Track Play
Track Play bank number,pattern number
To start your Tracker module playing, give this command followed by the appropriate bank number. If the bank number is omitted, bank number 6 will be used as a default. Most electronic composers use sets of patterns to make up a tune, and these can be repeated in any suitable order. A Tracker sequence can be started from any one of these patterns, providing that you know which pattern number refers to which particular part of the sequence. An optional pattern number can be added after the bank number parameter. Here are some example settings:
Track Play : Rem Use default Tracker bank
Track Play ,5 : Rem Play pattern 5 from default Tracker bank
Track Play 9,5: Rem Play pattern 5 from bank 9
instructions: toggle a Tracker loop
Track Loop On
Track Loop Off
Use these commands to make Tracker modules loop over and over again, or to stop a particular loop after it has commenced. Try this example:
Track Load "AMOSPro_Examples:Music/Mod.Tracker"
Track Play
Track Loop On
instruction: stop all Tracker music
Track Stop
This command is used to halt all Tracker modules playing.
If you wish to play Med modules, the "Medplayer.library" file must be in your "Libs:" folder. Naturally, if you have no intention of exploiting the Med library, there is no need to load it and allocate unnecessary memory. Both "MMDO" and "MMD1" modules can be used for your programs.
instruction: load a Med module
Med Load "Module name",bank number
The MED LOAD instruction loads the specified module in memory, and re-locates it to the specified reserved bank in Chip memory. This bank is not a data bank, and will not be saved along with your program, so Med modules must be loaded anew each time that the program is run.
This command will open the "Medplayer.library" file, and you may be asked to insert your System disc into the drive if this file is not available on the current disc.
As with Tracker modules, AMOS Professional sound samples can be played while Med modules are active. When a sound effect is triggered, any Med music will be stopped on all four voices, and will start again as soon as the sample has been played.
instruction: play a Med module
Med Play
Med Play bank number,song number
This instruction plays the specified currently loaded Med module. If no bank number parameter is given, the data in the last appropriate bank to be loaded will be played. Med modules can include more than one song, and an individual melody can be specified by including the song number to be played, as follows:
Med Play 2
Med Play ,2
Med Play 2,2
instruction: stop the current Med module
Med Stop
This simple instruction halts the current Med song being played. The song can now be started from the beginning with a new call to MED PLAY, or continued using a MED CONT command.
instruction: continue a Med module
Med Cont
This command is used to re-commence a Med module that has been halted by a MED STOP instruction. The song will continue from the exact point at which it was stopped.
instruction: access MIDI instructions in a Med module
Med Midi On
MIDI is the international standard by which musical instruments talk to one another and stands for Musical Instrument Digital Interface. If the Med module contains MIDI instructions for controlling keyboards, drum machines and so on, the MED MIDI ON command must be given before the first MED LOAD command, in other words, before the "Medplayer.library" file is opened.