Music file compatibility

Over recent issues of AMPLINEX we have been debating the problem of compatibility between music files created on different Hybrid Music System configurations. The introduction of the Music 2000 MIDI interface meant, for the first time, that music files created by one member may not be usable by another. The recent addition of the Music 3000 expander has added to this problem.
In this feature we publish contributions from two AMPLINEX members who propose practical solutions to the problem.
Firstly, Taj Letocha (author of the ZROM utility published in AMPLINEX U11) outlines a proposal for dual-purpose music files suitable for the Music 2000 as well as the Music 5000. In the second part of this feature, Ian Hubbard suggests a method for making music files suitable for members with the new Music 3000 expander as well as those with just the Music 5000.

The Music 2000 and AMPLINEX music

Taj Letocha
I was very interested in the discussions in AMPLINEX 012 about the production of music which is compatible with both the Music 5000 and the Music 2000 and which can be played whether or not the user has a MIDI set-up.
I've spent a little time looking at this problem and have come up with the basis for a solution which I'll describe in terms of a series of 7 steps to follow during the construction of a piece of music. I've also produced an example piece called 'Metal' for you to examine while going through the explanation.
Here are the seven steps:
1) Produce the piece of music using whatever musical set-up you wish. For example, if it's a piece for a mixture of Music 5000 and MIDI-instruments, then write the mixes as appropriate; otherwise, just do your normal thing. (This is not necessarily the easiest step!)
2) *SPOOL all mixes and instrument definitions into a text file. The easiest way of doing this is to use the WRITE command to output your complete piece to a text file:
*SPOOL txtfile
WRITE
*SPOOL
You can then edit it so as to remove all but the mix and instrument definitions. While you're editing it, add an extra line at the end containing the word 'run' in lower case.
If your piece is written solely for use with the Music 5000 (i.e. no MIDI instruments at all) then you should identify your SPOOLed text file as being for the Music 5000 - perhaps with a '/5' suffix. If, however, your piece makes use of at least one MIDI instrument, then identify the SPOOLed text file as being for the Music 2000 - with a '/2' suffix. By using such names consistently, anyone else looking at your piece will immediately be able to figure out how 'MIDI compatible' it is!
There are two files accompanying the Metal piece called (would you believe) Metal/5 and Metal/2. Have a look at both of these to see how I've defined my instruments and mixes.
(Editor's note: the text files Metal/5 and Metal/2 are not included in the Features menu but they can be examined using the *TYPE command from within AMPLE.)
3) When back in AMPLE, LOAD up your piece and redefine (by hand) all of those words which appear in the SPOOLed text file to be null. For example, if you have a mix called 'mix1' and an instrument called 'piano' in your piece then type
"mix1"[]
"piano" []
to redefine them.
Now your piece will have no specific information in it regarding the mixes and instruments that it should use.
4) Rename the RUN word to 'run'.
5) Now type in a new RUN word as follows
"RUN" [7MODE MENUDISP
%---------------------------------------
%         MIDI Compatible Piece
%
%       Select your arrangement:
%
%         Music 5000%m5000
%         MIDI Setup%midi
%
%---------------------------------------
MENU ]
Create the two new words 'm5000' and 'midi' used by the RUN menu:
"midi"  [ "EXEC fname/2" OSCLI ]
"m5000" [ "EXEC fname/5" OSCLI ]
where 'fname' is your filename for your SPOOLed text files.
A standard version of these words can easily be held as a text file and EXECed into an existing piece or, even better, held in a ZROM module and retrieved by using *ZX.
6) Use the SAVE command to save your piece.
7) That's it! You now have a Music 5000 and Music 2000 compatible piece.
To hear it, LOAD it into the AMPLE environment as normal and type RUN. You'll see the two-option menu come up asking you to select just the Music 5000 arrangement or the MIDI arrangement. Make your selection and the system will *EXEC either the '/5' or the '/2' file as appropriate and automatically invoke 'run' which will play the piece.
Some points are worth bearing in mind here.
If you have created only the Music 5000 arrangement, then selecting a MIDI arrangement on running the piece won't achieve anything at all unless you also created the '/2' MIDI file to go with it. The same applies to a MIDI piece of course - without a sensible '/5' Music 5000 file, you can't hear the piece in full. This may seem obvious but for those without a Music 2000 and the MIDI instruments to go with them there is normally no need to create a '/2' MIDI file. (One can even ask: why bother to go as far as the '/5' file if you've got no MIDI?)
There is obviously an overhead associated with this technique: namely, 3 files per piece instead of one. This could cause a significant problem to AMPLINEX, for example, which is constrained by both the number of files and their total size. This problem could be solved by using the library features provided by ZROM to collect the contents of all '/2' and '/5' files into one (or even 2) libraries and changing very slightly the definitions of the 2 words 'midi' and 'm5000' to use ZXEC instead of EXEC. This would certainly ease AMPLINEX's problem.
The other drawback with the technique is the length of time it takes for the piece to play once having chosen the MIDI or the Music 5000 arrangement. This can be addressed in 2 ways: firstly, once the MIDI or the Music 5000 arrangement has EXECed into the piece, you can delete the RUN word and rename 'run' as 'RUN'. Then use the SAVE command to save the whole piece which can then be reloaded and RUN with no time penalty again and again.
The second approach would be to write the piece as usual but not redefine each instrument and mix word to null as in step 3 above. So if the piece were written for the Music 5000 alone, the only extra work for MIDI compatibility would be to create the '/2' MIDI file and ensure that the new 'RUN' word (see step 5 above) calls 'run' when the Music 5000 arrangement is selected and calls 'midi' when the MIDI arrangement is selected. This would result in a piece which would play immediately when its 'native' mode of instruments and mixes is selected at run time.
I hope that you find my ideas not only interesting but also of practical use in this unusual dilemma that we face: being able to compose pieces which not everyone can play!

Related files on this disc:
$.Metal - Example music file which can be played on both standard Music 5000 and Music 2000 MIDI systems
$.Metal/5 - Text file containing mix and instrument words for Music 5000 systems
$.Metal/2 - Text file containing mix and instrument words for Music 2000 MIDI systems

The Music 3000 and AMPLINEX music

Ian L Hubbard
Music 3000 expander owners can contribute to the music section of AMPLINEX so that members with or without the expander software can listen. This can be done by using the M5INFO word which returns the current number of unused channels.
1) Define a variable that will contain the number of channels, e.g.,
"chans" [GVAR]
2) Include the following as the first line of the RUN word to find the number of channels available:
READY M5INFO chans #B! #2 #2 #2
3) Depending on where you like to change mixes, you can use the following structure to use different PLAY strings in the RUN word, use alternate mix words in a part word, or use alternate VOICE setups in a mix word:
chans #B? 16 #=
IF(
% Music 5000 alternative
)ELSE(
% Music 3000 alternative
)IF

Editor's note:
We hope the two articles above will provide some ideas for members with Music 2000 or Music 3000 systems. Both of the methods outlined above allow a piece to be played by those with the basic Music 5000 system as well as providing a different version for those with a Music 2000 or 3000.
We would like, however, to encourage members with Music 2000 or Music 3000 systems to contribute music made for those systems, whether or not they incorporate the ideas discussed in this feature. Once we have gauged the volume, quality and type of music available we will consider the best way to publish it.

Published in AMPLINEX 014, November 1989