Tag: Max/MSP

Jitter in javascript

Why would you write Jitter code inside a js object?

  • Math expressions
  • File IO
  • Borrowed code
  • You’re just that way

There are three Jitter javascript tutorials (built in to Max) 45-47

Screen Shot 2015-04-24 at 12.55.44 AM

The Max javascript documentation is generally far flung. A helpful reference by Tim Schenk http://reactivemusic.net/?p=17445

Here’s an example to get started with. It downsamples a movie and changes the background color. Something I often dream about.

Screen Shot 2015-04-24 at 12.35.31 AM

Download

https://github.com/tkzic/max-projects

Folder: jitter-js

  • patch: downsamp-thing.maxpat
  • javascript source: downsamp.js

Writing Jitter external objects

Not as easy as it looks.

Screen Shot 2015-04-24 at 12.48.55 AM

Getting started

First, think of a way to get the same results without writing an external. For example, borrow other code, use javascript, gen, Processing, or MSPaint.

Apparently that didn’t work out. Well I can only get you so far.

Assuming that you have already done the following

Learn how to write non-Jitter externals:

Edit the examples

Currently the Jitter examples in the SDK are in the folders: examples/matrix and examples/gl. We’ll pretend we didn’t see GL.

Here’s a sensible approach on Mac OS.

  • Duplicate the example folder: jit.clip and rename the duplicate to something like jit.cliptz
  • Inside jit.cliptz open the Xcode project
  • Rename the Xcode project while in Xcode by single-clicking on the project name and editing it.
  • Now feel free to alter the code in any way. Look in jit.clip.c

In jit.clip.c, find the functions starting with

void jit_clip_vector_char(long n, t_jit_clip_vecdata *vecdata, t_jit_op_info *in, t_jit_op_info *out)

These are functions that processing the matrix vectors for char, long, and float matrixes respectively. We’ll work with the char function.

Change the code so that the pixel values are inverted as well as clipped by subtracting pixel values from 255.

Change two lines of code, marked here by the comment: // invert

	if ((is==1)&&(os==1)) {
		++n;--op;--ip;
		while (--n) {
			tmp =  *++ip;
			*++op = 255 - tmp>max?max:tmp<min?min:tmp; // invert
		}		
	} else {
		while (n--) {
			tmp =  *ip;
			*op = 255 - tmp>max?max:tmp<min?min:tmp; // invert
			ip+=is;op+=os;
		}
	}

 

  •  Clean and build the project.
  • The .mxo file will be under the Products folder. <Ctrl> click to show in finder
  • Copy the .mxo file into the same folder as your Max patch
  • What Max patch? This one:

Screen Shot 2015-04-24 at 12.38.14 AM

The window on the left is inverted because its getting that way in the object we just hacked.

That’s all

I didn’t really explain anything. Sometimes going through the motions is a start. If I had to do this for a living I would find the example that is most like a desired result and hack away.

Download

https://github.com/tkzic/max-projects

folder: jitter-dev

files:

  • test-object.maxpat
  • jit.cliptz.mxo (external) you will make your own version of this in Xcode

 

Jitter gen

Tutorials by Gregory Taylor

gen~ for beginners (not Jitter) https://cycling74.com/wiki/index.php?title=gen~_For_Beginners

Delicious Max Tutorials by dude837 

http://otherbirds.com/tutorials/

Pixelface (gen): https://www.youtube.com/watch?v=e49qgv5NuUQ

jit.ameba

Downsample/upsample with non obvious results.

Screen Shot 2015-04-13 at 2.22.43 PM

 

Mystery surrounds jit.ameba.

From earlier (Max 5)  Cycling 74 documentation https://docs.cycling74.com/max5/refpages/jit-ref/jit.ameba.html:

“The jit.ameba object began life as a completely failed attempt at a linear interpolation object. As the Oblique Strategies say, “Honor thy error as a hidden intention.” If you’re interested in linear interpolation objects, try the jit.plur object. Otherwise, please enjoy the mess.”

Horizontal and vertical quantization

What actually does that mean?

From the Cycling 74 Wiki

https://cycling74.com/wiki/index.php?title=jit.ameba

(There is no information here)

From Peter Elsea

http://peterelsea.com/Maxtuts_jitter/Gallery.pdf

“This is a pixilation (resampling) trick. The help file admits this was supposed to be something else, but didn’t work. Needs a spell check too, but pretty interesting. ”

 

mchain

Build Markov in chains in real-time with Max

By Richard Dudas

http://www.richarddudas.com/software/

Screen Shot 2015-04-13 at 1.03.07 AM

Using the text processing example I built a 4th order Markov chain for “The Cat in The Hat” (by Dr. Seuss). Here is some of the result (it continues to infinity) with indentation added for readability:

The sat the sun is not shine.
It was to Sit! Sit!
And I sat in the house
All that?

How I wish We had something went BUMP! How I wish We did not shine.
It was to us jump! We looked!
The Cat in that cold to go out And wet to play.
So all we sat in the Hat! And he saw him!

Then we sat is wet to Sit! Sit!
And to go out
And the house
All that?

Why do was too wet And there little bit. And wet to go out
And there we saw him step in on that?
How I wish We sat is nothing at all.
So all we could do was too wet day.

So all we sat the house 
All that is fun there we can have Lots of good fun the mat!
We had something at all.
So wet to go out And the sun is wet to Sit! Sit!

And I said too wet to do I know it is not sunny!
Too we can have Lots of good funny!
Too wet And I sat is fun the house. We sat the house. We saw him!
The Cat is wet to us.

The help file patch allows real time Midi improvisation with a step sequencer style of playback:

Screen Shot 2015-04-13 at 1.12.49 AM

 

Algorithmic composition using first order Markov chains

“With similar automation for velocity, duration and delta time.”

By Fuji Kureta

Based on @algorithmiccomposer’s tutorial at http://algorithmiccomposer.com/2010/0…

Download: https://www.dropbox.com/s/o5dsgqcgk8m…

Screen Shot 2015-04-13 at 12.54.18 AM

Download classical piano Midi files from here (use Midi format 0): http://www.piano-midi.de/debuss.htm