On Tue, 9 Apr 2002, Don Simons wrote:

> Andre Van Ryckeghem wrote
> > It would be helpfull if the midi could be toggled off and on
> > and if there is a possibility for only midi (something as IMS1)
> > In that case, ie. the Grace notes could be programmed by normal notes (the
> > midi skips the Grace and the dvi output the normal notes).
> >
>
> Whenever I want to include ornaments in a midi, I just make a separate pmx
> input file.

I use the preprocessor GNU m4. I name my source files *.pm4 or *.mt4 and
then in the central makefile (common for all my editions) I have
standard targets like:

M4LINE=m4 -I $(BLDROOT) $(M4FLAGS)
M_FLAGS=-DMIDIDEFS
%.pmx: %.pm4
        $(M4LINE) $< >$@

%.mtx: %.mt4
        $(M4LINE) $< >$@

%_m.pmx: %.pm4
        $(M4LINE) $(M_FLAGS) $< >$@

%_m.mtx: %.mt4
        $(M4LINE) $(M_FLAGS) $< >$@

In my $(BLDROOT) directory I have a file which defines a lot of macros.
One example is:

define(�MIDI�,
�ifdef(�MIDIDEFS�, �$1�, �$2�)�)

(I use � and � as quotes instead of the usual m4 ` and ' to be able to use
these characters easy in my sources.)

In the example.pm4 file I can then write things like:
MIDI(�b8 a�,�Gb a4�)

If I do "make example.dvi" I get the printable version with "Gb a4", and
if I do "make example_m.mid" I get the midi version with "b8 a" (of course
there should be targets for .mid and .dvi files for this to work).

I have similar markups for all kinds of editorial changes that I do, so I
can type "make example_u.dvi" to get the "extreme urtext" version with
original clefs, accidentals and so on.

This solution (which I was sure that I had mentioned before, but I can't
find a reference now) has helped me a lot and has the obvious advantage
that all changes can go into ONE file and I can still extract a version
with the exact combination of editorials that I want (I use separate
markups for clefs, accidentals, figured bass accidentals, slurs, text,
note length, rests...).

> The main argument against making a separate file is that you will then have
> to make editorial changes in both files.  But that argument is weakened if
> you have very many measures that require a separate midi representation
> anyway; what difference does it make if you have to independently edit two
> items that are in the same file or in different files?

If you want several separate files for different reasons (midi, urtext,
different clefs...) there is an "explosion of combinations". I like to
keep all changes in one file.

The m4 macro layer can of course be used for a lot of other things. My
favourite is this:
(Some hints:
 DEFNINST:  Defines the number of instruments
 DEFMOVLEN: One number/movement. The number of pages since last page
            specification is specified after /.
 MOVEMENTS: Movement breaks for all instruments.
 RELBREAK:  Linebreak relative to last movement break.
 INPART:    Everything defined in the second argument is true only for
            the part defined in the first argument.
)

include(st.m4)
DEFNINST(2) 1 4 0 5 0 -2
DEFMOVLEN(10, 4/2, 6/1) 16 0.16
Instr 1
Instr 2
bt
./

INPART(1, �DEFMOVLEN(10/1, 3, 5/1)�)
INPART(2, �DEFMOVLEN(11, 4, 6)�)

<<<Lots of bars>>>

MOVEMENTS

<<<Lots of bars>>>
%%
RELBREAK(2)
INPART(1, �RELBREAK(1)�)
INPART(2, �RELBREAK(2)�)
<<<More bars>>>

MOVEMENTS

<<<Lots of bars>>>

With the help of the macros DEFNINST, DEFMOVLEN, MOVEMENTS and RELBREAK
this is basically (I have removed some irrelevant stuff) evaluated to:
%
% Filtered through m4. Do not edit.
%
2 2 1 4 0 5 0 -2
3 20 16 0.16
Instr 1
Instr 2
bt
./

%1 S18P2
%2 S21P0

<<<Lots of bars>>>

%%
L11M
%1 L11P2M
%2 L12M

<<<Lots of bars>>>
%%
L13
%1 L12
%2 L14
<<<More bars>>>

%%
L15P3M
%1 L14M
%2 L16M

<<<Lots of bars>>>


This is very nice when I want to change for example the number of systems
in the score for the first movement. Then all other linebreaks are
automatically recalculated and I only have to change ONE number (10) to
something else.

I have placed my st.m4 file at http://www.lysator.liu.se/~tuben/m4 if
anyone is intrested. Please note that this was my very first attempt at
writing m4 macros, and that has been extended for several years. It is
undocumented and (I'm sure) badly structured. I'm not even sure that I
know the function of all that code anymore... =:-o

Recently I wanted to run this on Windows but could not find a gnu m4 that
could handle � and � as quotes. Please let me know if you find such a
beast (I did not succeed with the one in cygwin, but that may be my
fault). For a quick test, in m4, write:

changequote(�,�)
��

The second line (��) should just echo as an empty line.

I'm sorry for the long post, but maybe some ideas from this can be as
helpful to someone else as it has been for me.

/Johan Tufvesson


_______________________________________________
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music

Reply via email to