Subject: MAX Digest - 7 Mar 1999 to 8 Mar 1999 (#1999-76)
Date: Tue, 9 Mar 1999 00:00:01 -0500
From: Automatic digest processor 
Reply-To: MAX - Interactive Music/Multimedia Standard Environments
     
To: Recipients of MAX digests 

There are 9 messages totalling 536 lines in this issue.

Topics of the day:

  1. Filter that only allows notes > 250 ms in length - answer
  2. attempting port from SGI-land
  3. Filter that only allows notes > 250 ms in length (2)
  4. Folder
  5. Broken Hilbert
  6. Broken Hilbert / frequency shifter (attempting port from SGI-land)
  7. last-minute help
  8. Animation

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

Date:    Mon, 8 Mar 1999 01:31:52 +0000
From:    Steve Smith 
Subject: Filter that only allows notes > 250 ms in length - answer

Having posed the question,  I put some thought into coming up with the
answer, and here it is.

The idea is that notes don't get past the filter unless you hold them down
for at least 250 ms.  This allows some hunting and pecking for notes in an
ear training program I am writing.  In improvising situations (dare I say
jazz) there is lots of fishing for notes that one hears, and as long as you
keep your hunting and pecking SHORT, you don't sound WRONG.

In my ear training program I send you chords and ask you to identify them.
If you hold a wrong note too long (>250 ms in this case) the chord gets
regenerated by the timing sensor.

Now it works.

max v2;
#N vpatcher 9 51 637 392;
#P message 469 215 129 196617 64 60 69 67 81 62 74 76 79 72;
#P newex 469 183 77 196617 prepend append;
#P message 427 178 24 196617 set;
#P newex 469 121 55 196617 r heldnote;
#N vpatcher 50 40 384 472;
#P number 150 96 34 9 0 0 0 3;
#P number 73 97 34 9 0 0 0 3;
#P newex 122 74 38 196617 unpack;
#P newex 122 50 82 196617 r $1Len;
#P message 73 118 35 196617 set \$1;
#P number 71 269 48 9 0 0 0 3;
#P newex 122 135 111 196617 if $i1 > 0 then 1 else 0;
#P newex 122 160 40 196617 change;
#P newex 122 185 40 196617 sel 1 0;
#P message 172 216 33 196617 stop;
#P comment 144 218 24 196617 stop;
#P comment 90 218 29 196617 start;
#P button 122 217 15 0;
#P newex 122 251 41 196617 clocker;
#P newex 122 277 123 196617 if $i1 > 250 then 1 else 0;
#P newex 122 377 53 196617 s heldnote;
#P newex 122 303 40 196617 change;
#P newex 122 328 30 196617 sel 1;
#P message 122 353 32 196617 65;
#P connect 14 0 0 0;
#P connect 15 0 16 0;
#P connect 12 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 6 0;
#P connect 10 1 9 0;
#P connect 6 0 5 0;
#P connect 5 0 13 0;
#P connect 5 0 4 0;
#P fasten 9 0 5 0 177 245 127 245;
#P connect 4 0 2 0;
#P connect 2 0 1 0;
#P connect 18 0 12 0;
#P connect 0 0 3 0;
#P connect 1 0 0 0;
#P connect 17 0 14 0;
#P fasten 16 0 17 0 127 94 78 94;
#P connect 16 1 18 0;
#P pop;
#P newobj 363 104 29 196617 p len;
#P newex 379 268 35 196617 len 10;
#P newex 365 250 30 196617 len 9;
#P newex 351 232 30 196617 len 8;
#P newex 337 214 30 196617 len 7;
#P newex 323 196 30 196617 len 6;
#P newex 309 178 30 196617 len 5;
#P newex 295 160 30 196617 len 4;
#P newex 281 142 30 196617 len 3;
#P newex 267 124 30 196617 len 2;
#P newex 163 191 35 196617 s 6Len;
#P newex 177 209 35 196617 s 7Len;
#P newex 191 227 35 196617 s 8Len;
#P newex 205 245 35 196617 s 9Len;
#P newex 219 263 43 196617 s 10Len;
#P newex 131 253 35 196617 s 5Len;
#P newex 117 235 35 196617 s 4Len;
#P newex 103 217 35 196617 s 3Len;
#P newex 83 199 35 196617 s 2Len;
#P newex 75 181 35 196617 s 1Len;
#P newex 253 106 30 196617 len 1;
#P newex 137 41 40 196617 notein;
#P newex 107 144 144 196617 route 1 2 3 4 5 6 7 8 9 10;
#P newex 150 108 52 196617 pack 0 0 0;
#P newex 137 78 118 196617 Borax;
#P comment 362 53 100 196617 Patcher len - save this patcher to disk to
make this patch work;
#P comment 5 43 100 196617 This will handle up to a 10 note chord at one
time;
#P connect 5 1 2 1;
#P connect 5 0 2 0;
#P connect 4 0 7 0;
#P connect 4 1 8 0;
#P connect 4 2 9 0;
#P connect 4 4 11 0;
#P connect 4 3 10 0;
#P connect 4 5 16 0;
#P connect 4 6 15 0;
#P connect 4 7 14 0;
#P connect 4 9 12 0;
#P connect 4 8 13 0;
#P connect 3 0 4 0;
#P connect 2 1 3 0;
#P fasten 2 3 3 1 181 101 176 101;
#P fasten 2 4 3 2 194 101 197 101;
#P connect 27 0 29 0;
#P connect 28 0 30 0;
#P connect 29 0 30 0;
#P pop;

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

Date:    Sun, 7 Mar 1999 22:43:44 -0800
From:    dudas 
Subject: Re: attempting port from SGI-land

mtheodore writes:

>I've been trying to get the beloved Hilbert patch from FTS/SGI land
>to work in MSP. I simply substituted biquad~ for 2p2z~, and cycle~ for
>osc~. The signal becomes unreasonable when going through biquad~, which
>leads to me to guess that the coefficients are incorrect

although the cycle~ object is roughly compatible with the old osc1~ from
the antiquated versions of Max (Next or SGI), the biquad~ cannot be
substituted for 2p2z without modifying the coefficients.

The biquad~ and 2p2z~ objects are two different implementations of two-pole
two-zero filters, and their coefficients are slightly differently
re-ordered for efficiency reasons in each case.

Let's consider the five coefficients for the biquad are: a0, a1, a2, b1,
b2, and the six coefficients for the 2p2z~ are: c0, c1, c2, d0, d1, d2.

Their relationship looks something like this:

a0 = c0 * d0
a1 = c0 * d1
a2 = c0 * d2
b1 = -c1
b2 = -c2

But why waste your time doing this all yourself????  That would be
re-inventing the wheel.  There is already a beautifully done ISPW
compatibility lib and native version of "the Jimmies" for MSP, both which
already exist and are available from IRCAM, as long as you cough up the
dough, bien sur.

If you want to know more about phase quadrature (hilbert transform), you
can find more than you will ever need to know in any basic DSP book with a
chapter on filter theory.

-Georgette

(Cussi' ti pol scominsiar a creder, sorsetta, che ghe xe anca qualche dona
che scrive nea lista de Max!!)

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

Date:    Mon, 8 Mar 1999 02:45:31 -0500
From:    Stephen Kay 
Subject: Filter that only allows notes > 250 ms in length

>>User inputs up to a 10 note chord.  Only allow notes which are duration=

of
>>250 ms or greater.
>>Q:  Is there an EASY way to do this?

>MIDI note-on messages say nothing about the duration of a note. Duration=

is
>only obtained by measuring the difference between the time of the note-o=
n
>message and the time of the corresponding note-off message. So, if you'r=
e
>talking about realtime MIDI input (as opposed to a MIDI file which you
>could scan in advance), there's no way you can know if a note has a
>duration > 250 ms without incorporating a delay of at least that much.

True.  But assuming that he wants to allow that much delay, there
are several ways to go.

I've written this kind of code quite frequently (but I typically
only am interested in windowing "chords" together, so the delays are
more in the 30 ms range).

Basically, you need to store the time that the note-on was received,
then get the time that note-off is received, and decide if the note
met the criteria.  This can be done quite easily in C using the
gettime() function, which returns in ms clock the time of the event.
Subtract the note-on time from the note-off time, and you have the =

duration of the note.

Before I knew how to program in C, I used to hack this kind of thing
together using the very cool (but unappreciated) Borax object.
Part of its lack of appreciation probably stems from the fact that
it appears rather complicated.  But it reports all kinds of interesting
information about note-ons and note-offs, including polyphony, and
delta times (which is what you need to get the durations).  The info
can be stored in a coll file. But it won't be pretty...

Stephen Kay
--------------------------------------------------------------------
The MegaMAX Collection: =

   http://www.musikinetix.com/MegaMax/MegaMax.html
Free Max objects!:
   http://www.musikinetix.com/MaxCorner/PublicDomain.html
--------------------------------------------------------------------

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

Date:    Mon, 8 Mar 1999 02:45:34 -0500
From:    Stephen Kay 
Subject: Folder

John Brit:
>While we are editing resources, you can get rid of the the three
checkboxes
>which appear at the bottom of the "Save as" dialog by editing DITL id
1003.
>You cannot remove them (unless you want to crash every time you try to
save),
>but you can place a static text box over them which can either be blank =
or
>contain your name or the name of your favorite Spice Girl or vegetable o=
r
>whatever.

The other thing you can do is just move the objects "off" the screen.
Select the checkboxes, and scroll them somewhere that is off the size of
the dialog that is going to be displayed.

Do not ever delete these things - the code expects to be able to find =

them.  It doesn't care if they're outside of the view that the user
is presented with, though.

Stephen Kay

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

Date:    Mon, 8 Mar 1999 11:37:52 +0100
From:    Carl Faia 
Subject: Re: Broken Hilbert

Maybe this is better??

max v2;
#N vpatcher 50 40 728 626;
#P toggle 201 399 15 0;
#P newex 230 426 45 196617 dac~ 5 6;
#P user meter~ 194 459 274 472 100;
#P user meter~ 176 294 256 307 100;
#P message 176 116 16 196620 1;
#P message 130 88 36 196620 open;
#P toggle 101 89 15 0;
#N sfplay~  1 16384;
#P newobj 130 139 55 196620 sfplay~;
#P user gain~ 129 320 24 100 158 0 1.071519 7.94321 10.;
#P user ezdac~ 118 475 162 508 -150994852;
#P flonum 262 217 86 12 0 0 0 3;
#N vpatcher 40 55 599 511;
#P comment 14 141 114 196620 signal to modulate;
#P comment 68 29 296 196620 single sideband modulator (aka frequency
shifter);
#P comment 38 324 171 196620 frequency shifted signal;
#P newex 175 182 45 9 +~;
#P newex 135 210 38 9 cycle~;
#P comment 13 183 33 196620 real;
#P comment 55 184 74 196620 imaginary;
#P comment 374 34 109 196620 frequency of shift;
#P inlet 318 104 15 0;
#P inlet 69 221 15 0;
#P inlet 18 221 15 0;
#P outlet 19 318 15 0;
#P newex 236 208 38 9 cycle~;
#P newex 18 264 35 9 *~;
#P newex 69 265 35 9 *~;
#P newex 19 290 60 9 +~;
#P newex 317 131 57 9 phasor~;
#P newex 176 153 62 9 sig~ 0.25;
#P connect 7 0 4 0;
#P connect 4 0 2 0;
#P connect 2 0 6 0;
#P connect 13 0 4 1;
#P connect 8 0 3 0;
#P connect 3 0 2 1;
#P connect 5 0 3 1;
#P connect 14 0 13 1;
#P connect 0 0 14 0;
#P connect 1 0 0 0;
#P connect 1 0 14 1;
#P connect 1 0 5 1;
#P connect 9 0 1 0;
#P pop;
#P newobj 130 251 143 196620 p complex-mod;
#N vpatcher 41 55 750 528;
#P comment 174 383 129 196620 <--90 degree phase diff.-->;
#P comment 14 388 70 196620 signal out;
#P comment 328 389 70 196620 signal out;
#P comment 82 82 65 196620 signal in;
#P newex 348 302 319 14 biquad~ 0.870686 -1.8685 1. -1.8685 0.870686;
#P newex 348 160 332 14 biquad~ -0.260502 0.02569 1. 0.02569 -0.260502;
#P newex 29 302 315 14 biquad~ 0.06338 -0.83774 1. -0.83774 0.06338;
#P newex 29 160 315 14 biquad~ 0.94657 -1.94632 1. -1.94632 0.94657;
#P inlet 29 80 15 0;
#P outlet 29 369 15 0;
#P outlet 348 369 15 0;
#P comment 268 34 288 196620 makes 90-degree-out-of-phase copies of a
signal.;
#P comment 8 30 76 196626 hilbert~;
#P comment 91 33 169 196622 --hilbert transform;
#P user meter~ 66 211 146 224 100;
#P user meter~ 81 360 161 373 100;
#P user meter~ 359 211 439 224 100;
#P user meter~ 371 360 451 373 100;
#P connect 9 0 10 0;
#P connect 10 0 11 0;
#P connect 11 0 8 0;
#P connect 10 0 3 0;
#P connect 11 0 2 0;
#P connect 9 0 12 0;
#P connect 12 0 13 0;
#P connect 13 0 7 0;
#P connect 12 0 1 0;
#P connect 13 0 0 0;
#P pop;
#P newobj 130 190 76 196620 p hilbert;
#P comment 262 196 122 196620 Freq in Hz of shift;
#P comment 407 33 100 196620 Please fix me - I'm a broken single sideband
modulator - when done \, please post on the Max list - thanks \, M.Theodore;
#P comment 406 185 100 196620 The hilbert subpatch comes from FTS land -
however \, biquad~ was substituted for 2p2z~ - this seems to be the source
of the problem.;
#P comment 406 373 100 196620 The complex-mod subpatch also comes from FTS
land - the only change here was from osc~ to cycle~;
#P comment 116 34 100 196626 Fixed??;
#P connect 9 0 8 0;
#P connect 6 0 9 0;
#P connect 11 0 10 0;
#P connect 13 0 10 0;
#P connect 12 0 10 0;
#P connect 10 0 5 0;
#P connect 5 0 6 0;
#P connect 9 0 8 1;
#P connect 10 1 13 0;
#P connect 6 0 14 0;
#P connect 9 0 15 0;
#P connect 5 1 6 1;
#P connect 17 0 16 0;
#P connect 9 0 16 0;
#P connect 7 0 6 2;
#P connect 9 0 16 1;
#P pop;

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

Date:    Mon, 8 Mar 1999 10:17:43 +0000
From:    Lawrence Casserley 
Subject: Re: Broken Hilbert / frequency shifter (attempting port from
SGI-land)

In message , mtheodore  writes
>Hi all,
>I've been trying to get the beloved Hilbert patch from FTS/SGI land
>to work in MSP. I simply substituted biquad~ for 2p2z~, and cycle~ for
>osc~. The signal becomes unreasonable when going through biquad~, which
>leads to me to guess that the coefficients are incorrect (if I remember
>correctly, oral tradition has it that no one actually knows any longer
>how these
>particular coefficients were arrived at). My eternal gratitude to
>anyone who can get this thing going again.
>thanks,
>Michael
>PATCH FOLLOWS:
>
I ported it from the ISPW and it works fine. I think I must have used
Richard Dudas's nice little 2p2z~ to biquad~ translator in ISPW
compatibility lib - thank you very much Richard!

The coefficients I have are:

0.94657 -1.94632 1. -1.94632 0.94657
0.06338 -0.83774 1. -0.83774 0.06338

to get the first output, and:

-0.260502 0.02569 1. 0.02569 -0.260502
0.870686 -1.8685 1. -1.8685 0.870686

to get the second output.

Hope it works for you.

Lawrence

--
Lawrence Electronic Operations -Tel +44 1494 481381 -FAX +44 1494 481454
Signal Processing for Contemporary Music -email leo@chiltern.demon.co.uk
http://www.chiltern.demon.co.uk

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

Date:    Mon, 8 Mar 1999 09:55:38 -0500
From:    David Crandall 
Subject: last-minute help

I need to locate a Maxer in the Baltimore-Washington area willing to help
finish up programming on an installation to open April 1.  Experience with
Pyrite &/or list operations would be a plus. I don't have a lot of $$ to
work with but maybe we can work something out in trades or narrowing the
work to just essential points, etc.  The piece involves using
pressure-sensitive pads and motion detectors to control a CD and a couple
of Niche ACMs which control audio levels from a bank of VCRs.

David Crandall
[410] 662-7661
dcrand1@gl.umbc.edu

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

Date:    Mon, 8 Mar 1999 11:00:27 -0500
From:    Michael Sweet 
Subject: Re: Animation

>>Over the past few months there has been a lot of talk about max and how
you can
>>use it to control graphics/video.  Here is a project that we worked on
>>that some of you might find of interest.

>Yes I'm interested to know how this is done. You mentioned the control of
>animation, i presume this is MIDI, but what kind of
>graphics is it, QUICKTIME etc. Im just generally interested to know.
>I noticed that POSSIBLE WORLDS had also animated Beavis and Butthead Live
>using a similar system based on Max, got me thinking of an ANtiorp-Butthead
>Horror Manga combination, that would be interesting.

We experimented with the quicktime objects for a while and they work -
except for
a couple of problems.  First, in the older quicktime scheme (2.5 and below)
there
was no way to support matting of different layers on top of one another.
This has
been added to QT 3.0 but I haven't experimented with it yet (and currently
there
is no max object that supports qt matting or qt sprites yet).  Second there
is no
way to set the priority of the layers in the current quicktime objects,  the
movies get draw on top when they get a request to draw.  This proves to be
quite
difficult to deal with in with multiple layers and complicated patches.  It
gets
difficult to predict which image will be there when you want it to be.

Our solution may not have been the best but it works and it's fast.  We took
the
original pics object and rewrote it to support millions of colors, matting,
layers, scale, rotation, flips, flops, show/hide features, set position, set
window position, as well as all the old controls (frame number, priority,
etc).
We do want to use a different file format instead of pics, because not a lot
of
programs support it; even DeBabalizer does not support pics.  We will
probably
switch to another format in the next version.  We also wrote our own drawing
engine for speed.  We have not been able to get the screen to draw in the
vertical
blanking interval yet, but maybe in the next version.  The object will also
play
QT movies,

All this gets outputed to a Truvision Targa 2000 card.  I hate Truvision. I
hate
Truvision. I hate Truvision.  They have been unhelpful in every way every
time we
have called them.  They have written off the macintosh as a platform and
won't
release any development information for it.  This means that we can't
optimize our
draw routines to use the accelerator or memory on the video card.  We are
desparately looking for another RGB supported mac video card.

The voice analyzation gets done in real time in MSP on another macintosh and
then
sent to the other G3 which is doing all the drawing (for speed).  I wish
there
we're better alternatives for networking max, the UDP objects don't work
well when
blasting data across a network.  The irony of all this is that we also use
midi
for our networking which is ironically much more reliable and doesn't crash
our
machines.  When we have more money we hope to fix that too and move our
networking
to custom ethernet objects (appletalk or tcp).  We also have several SGI
machines
here and have thought about porting our drawing to an O2 or equivalent using
max
for unix.

All the puppeting is done through any midi or serial devices, including
keyboards,
foot pedals, gloves, motion sensors (polhemus), etc.  We would love to build
custom midi boxes with many sliders, buttons, pedals, and knobs but haven't
had
the resources.

--Michael Sweet

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

Date:    Mon, 8 Mar 1999 10:22:04 -0800
From:    Peter Elsea 
Subject: Filter that only allows notes > 250 ms in length

>User inputs up to a 10 note chord.  Only allow notes which are duration of
>250 ms or greater.
>
>Q:  Is there an EASY way to do this?   (He said, pondering while watching
>his currently favorite show - Bomb)

In ftp://arts.ucsc.edu/pub/ems/Lobjects/beta98  there is an external called
nochirp.
I wrote it to clean up the data from a WX11 or similar wind instrument that
tends to send extra notes on slurs. It rejects notes after the first one
that are shorter than a certain duration. Of course there is a delay of
that duration berfore legitimate notes sound.

Anyway, if you give it an arg of 250 and send it the list [0 1] with a
loadbang, it will behave as desired. Only notes with a duration greater
than 250 ms will be passed thtough.

Note offs are passed through immediately, so if you are measuring the
duration of successful notes, you must add 250. It can be fooled by
repeated notes of the same pitch if they overlap in duration (There's no
way to tell which note off goes with which note on.)

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 - 7 Mar 1999 to 8 Mar 1999 (#1999-76)
*******************************************************