From:
                                                           10/14/97 11:01 PM
Subject: MAX Digest - 13 Oct 1997 to 14 Oct
1997To: Recipients of MAX digests 

There are 4 messages totalling 119 lines in this issue.

Topics of the day:

  1. Can seq read and play immediately?
  2. sprintf (2)
  3. saving seq recorded sysex

----------------------------------------------------------------------

Date:    Tue, 14 Oct 1997 07:43:39 GMT
From:    Andreas Pla* 
Subject: Can seq read and play immediately?

I have a midi file on disk, containing a sysex dump message  for my
synthesizer. When I want to send it to the synth, first I have to send a
'read' message to the seq object, and when I have selected the file, I have
to send a 'bang' to seq.

Is there a way letting the seq object play immediately when the midi file is
read from disk? Or is there a message which can trigger the bang when the
midi file is read?

Thanks,
Andreas

(Andreas Plass, a.plass@proaudio.de)

------------------------------

Date:    Tue, 14 Oct 1997 09:38:44 -0000
From:    Nick Rothwell 
Subject: Re: sprintf

Clarification: is the sprintf we're talking about a particular
implementation provided by the MAX libraries? I'm still in the THINK C
stone age and I can't remember offhand what gets provided by MAX and
what I pull in from elsewhere; and the CodeWarrior/PPC situation is
presumably different...

> %s      Replace with a symbol.

%s for string (i.e. char*) rather than symbol in the MAX sense,
presumably?

> Long size is indicated with an l. This is important with big numbers
> (>32767), because only 16 bits are converted when you leave it out.

Perhaps it's too early in the morning, but I don't understand what
you're saying here. The format string relies on the programmer
providing arguments of the right size. So, %d is "int" (whatever that
might be in the compiler to hand) and %ld is "long". If you pass a
short to %ld there will probably be problems with subsequent
arguments; similarly if you pass a long to "%d" in a compiler which
associates int with short. If int==short, then passing a long value of
1 to %d will still fail. If int==long, then passing a short to %d or
%ld will fail also.

I think.

--
         Nick Rothwell, CASSIEL        contemporary dance projects
         http://www.cassiel.com        music synthesis and control

        "...but you? You've got a monkey on your back: dedication."

------------------------------

Date:    Tue, 14 Oct 1997 11:20:08 -0400
From:    John Alexander 
Subject: saving seq recorded sysex

Hi - I've recorded some sysex messages (formatted with sxformat) into seq,
and after I write them to a MIDI file the file can not be opened by my
sequencer. If I open the file up in a hex editor there are 3 extra bytes
after every F7 sysex terminator. So for example a sysex message looks like
this F0 ....data.... F7 00 02 F7. And its always 00 02 F7. If I use the
"print" function of seq the correct sysex has been recorded.

Does anybody know what could be going on? Or a better way to record sysexes
to a MIDI file in MAX?

Thanks in advance,
John Alexander

------------------------------

Date:    Tue, 14 Oct 1997 09:38:01 -0700
From:    Peter Elsea 
Subject: sprintf

In private mail, John Williams asked:
>If the object can't use leading spaces, and always justifies left, is there
>any way of getting it to print in a Text object window in nice tidy
columns?
>Also, formatting commands appear to have to be in quotes, which then appear
>in a message box and in the Text window. Any way around this?

The only way I know to get tidy columns is to put up with the leading
zeros. The following:
sprintf %05ld__%05ld__%05ld
Where the _s are replaced by option space will give you even columns,
albeit with that old fashioned "computer" look. Be sure to use a wide
enough field width. The lines will jog if a number exceeds 5 places.

The reason it's so screwy is that printf outputs numbers when possible, and
creates symbols only as a last resort. (Quick review for newbies: a number
in Max is a 32 bit representation of the value; a symbol is a pointer to a
string of characters.) Since the Max rule for displaying numbers is to
supress leading 0s, (and show floats to 6 places) the trick is to convince
sprintf to make a symbol. This will happen when any non-numeric is adjacent
to the number. (You can display huge numbers this way- you might want to
look at the tutorial Max&numbers at ftp://arts.ucsc.edu/pub/ems/maxtutors/)

Since the space is used as the delimiter in all Max objects, it can't be
used as a formatter of the % 5ld style. (-: Perhaps the sprintf code could
be tweaked to recognize opt-space. David?:-) Leading spaces is actually the
default for printf, but in Max, multiple spaces are always condensed to
one. That's why the weird behavior with
sprintf '%3ld
when you go from 1 to 100.

Peter Elsea
Electronic Music Studios
University of California, Santa Cruz
http://arts.ucsc.edu/EMS/Music/index.html
 elsea@cats.ucsc.edu

------------------------------

End of MAX Digest - 13 Oct 1997 to 14 Oct 1997
**********************************************