Osc synth in Max

Simple synthesizer controlled by touchOsc

download

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

folder: osc-synth

patch: tz-synth-4-touchOSC.maxpat

notes

Shows how to use an ipod or iphone as a controller

components:

  • Max/MSP
  • ipod touch
  • touchOSC

instructions

  1. setup touchOSC on the ipod to send to the host ip address that Max is running on – using port 8000 to send data.
  2. In the Max patch, try one of the last presets for a reasonable synth sound.
  3. In touchOSC, use the top (horizontal ) slider in the ‘simple’ layout.

 

green screen in Max

Live chroma-key example using the built-in camera.

Hacked from jitter help files…

download

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

folder: chroma-key

patch: greenScreen1.maxpat

instructions
  • click open (screen grab)
  • click read – to open a movie file
  • click start/stop toggle
  • in the grab viewer, select the background color to chromakey, by clicking with mouse
notes

This really works best with an external camera and a large monochromatic background.

components:

  • Max/MSP – Jitter
  • builtin camera

Max Wii remote examples

A collection of Wiimote patches

download

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

folder: wii

patches:

  • wiimote_read.maxpat
  • wii_vizzie_rotate.maxpat
  • ir5.maxpat
  • wiimote_ir_xy_synth2.maxpat
  • wiimote_pry_synth4.maxpat
  • bicycle speed sensor folder (under construction)
Osculator config file: wii3.oscd

installation (Osculator)

  • Download and install Osculator: http://www.osculator.net
  • Run the Osculator config file: wii3.oscd
  • Pair a Wiimote with Osculator (by pressing the red button)
  • Set Wiimote Osc output port to 9000
Other helpful tips:
  • Use a real Wii remote, not the Nyko. If you do get the Nyko, get the one with motion-plus.
  • update Osculator to the latest version
  • Under parameters (in osculator) press + to add the little pacman symbol labeled “same address”, and set the the OSC URL to whatever you’ll be using like 9000 for Max
  • remember to add the Event type (OSC routing) and value (pacman thing) for every wiimote event you’ll be using
  • remember to enter checkbox on the wiimote window for every type of data you want to send

Wiimote read patch

The patch: wiimote_read.maxpat is a common patch for reading data from Osculator into Max.

Load this patch and keep it running in the background for all of the other patches. You will know if the wiimote is working, if the data in the number boxes responds to movement of the Wiimote.

projects:

vizzie rotation effect

Rotates the video input from built in camera.

patch: wii_vizzie_rotate.maxpat

infra-red (IR) musical light painting

Paint using an IR transmitter.

patch: ir5.maxpat

helpful suggestions:

  • Make sure wii is transmitting raw IR data in Osculator
  • Turn on audio and turn up volume
  • Turn on [qmetro] for jitter

IR xy synth

A synthesizer that responds to IR xy data

patch: wiimote_ir_xy_synth2.maxpat

helpful suggestions:

  • turn on audio
  • turn up volume
  • make an audible adsr envelope by turning up the adsr dials
  • increase lfo rate
  • check the wii-mode updreceive port (should match Osculator output)
  • experiment with the ‘gate’ toggle in the middle of the patch

Pitch, roll, yaw (PRY) synth

A synth that responds to pitch, roll, and yaw data

patch: wiimote_pry_synth4.maxpat

bicycle engine simulation

synthesizes engine sounds based on RPM of bicycle wheel with Wiimote in the spokes

5/2014 : under construction – note – this patch not compatible with wiimote_read

  • waveguide_engine2c-bike.maxpat
  • wheelspeed.maxpat
  • bicycle2.maxpat

need to be running Osculator and tracking PRY stuff from Wii – need to adjust scale in engine patch. Also, select 3rd preset for engine sound.

So basically this setup needs to get standardized – use metro to send a steady stream of wheel data. Use the up to date car engine patch, etc., etc.,

A few problems with this concept – for example when the wheel is stopped the signal rate revs up to over 300  – I think because it rotates backwards for a second. Also when the wheel gets really fast, the pulses just stop!  – its like the wii-mote is overloaded or something? 4/3/2013 – I have it running so it tracks speed when the bicycle is upside down, as long as you don’t crank it too fast. but as mentioned above – the patch could be cleaned up and simplified.

 

 

Google Maps in Max

Draw points in Max by sending latitude and longitude to a Web client via Osc and web sockets.

Uses Ruby, WebSockets, Chrome, Google Maps API, Osc, Max, Jquery, and Node.js… But the Max patch is actually quite simple.

Based on this geocoding tutorial:  http://www.sitepoint.com/google-maps-api-jquery/

download

https://github.com/tkzic/internet-sensors

folder: google-maps

files

main Max patch
  • googlemaptest.maxpat
html and javascript for Google API
  • js/ (folder containing javascript code for map client)
  • markers.html (web client)
ruby
  • mapserver.rb (Osc and Websockets server)
node.js (optional)
  • nodeserver.js (local node.js webserver)

running node.js local web server (optional)

To run the project locally, you will either need to install node.js or have a local web server. The instructions assume that you have installed node, as well as the http package.

If you don’t want to bother with node, there is also an online version of the web client running at  http://zerokidz.com/gmap/markers/markers.html

intalling ruby gems

Running Ruby 2.0 as well as the following gems:

  • osc-ruby
  • em-websocket
  • json

instructions

1. If you are using the online Web client, go to this URL in a Google Chrome browser: http://zerokidz.com/gmap/markers/markers.html then skip to step 4.

2. In a terminal window start the node webserver

node nodeserver

3. Launch a Google Chrome web browser and type in this URL

127.0.0.1:8081/markers.html

4. In another terminal window start the ruby server for Osc and websockets

ruby mapserver.rb

5. Now in the Web Client (Chrome) press the “OSC” button underneath the map – to open the web sockets connection with the ruby server.

6. Open the Max patch:

googlemaptest.maxpat

7. Now you should be able to click on the message boxes for Bethel and Rumford in the Max patch to add location markers to the map in the browser.

 

Granular time stretching in Max

Adaptation of Andy Farnell’s Pd granular timestretch patch

Adjustable chunk-size, pitch, and speed – as well as manual scrubbing.

The original Pd patch (timestretch.pd) is available here: http://aspress.co.uk/sd/index.php

download

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

folder: granular-timestretch

patches

  • timestretch5.maxpat (main patch)
  • tabread4~.maxpat (Pd abstraction) 
  • hip~.maxpat (Pd abstraction)

How it works

An index pointer (file phasor) scans from the beginning to the end of the file. For example, at 44.1KHz, a 1 second file of audio would have 44,100 samples. Each sample is 022676 ms. Another phasor (grain phasor) scans small chunks (grains) of audio. If audio is playing back at the normal rate and pitch, this grain phasor runs at zero. the file phasor just moves sequentially from one grain to the next.

To stretch the time, the file phasor is slowed down, but the grain phasor speeds up, scanning grains of audio, that start at the current file phasor index. In this way, in listening to the file from beginning to end, you are actually listening to a series of overlapping grains.

As the chunk (grain) size increases the grain phasor frequency decreases.

To raise the pitch, the grain phasor frequency would be increased. To lower the pitch, the phasor frequency goes negative and increases in a negative direction to reduce pitch further.

As you can see, while running this patch, the chunk size, pitch, and speed are all related by a single equation.

phasor frequency = ((pitch / 120)**2 – speed) / chunksize

  • where pitch is in cents (0 is normal)
  • speed is a scaling factor (1 is normal)
  • chunk (grain) size  is in ms.

So the input values interact with each other.

In addition, the grain player uses a technique called PSOLA. Pitch synchronous overlap and add. There are actually two grain players playing simultaneously 180 degrees out of phase. Each is windowed using a positive cosine function. This helps to reduce clicks by crossfading from one grain to the next.

There is some comb-filtering and ringing present on the audio. There are various techniques to reduce this, including:

  • trying different window functions
  • higher sample rates
  • changing the overlap
  • varying the grain size
Interesting artifacts:
  • reducing the grain size to several ms. causes oscillation similar to the Karplus-Strong effect
  • increasing the grain size to around 1000 ms. causes a feedback delay effect due to the out of phase grain players
  • setting the overlap to anything other than .5 causes random phase cancellation
Manual or automated scrubbing.

There is also an option to manually scrub the file. This way you can listen to the texture of grains of various sizes from various points in the file.

You can also set random automatic scrubbing to branch to various points in the file.

Web video streaming in Max

Stream realtime video from a web browser into Max or any program that uses Syphon.

CefWithSyphon (developed by Vibeke Bertelsen) launches a web browser and Syphon server. The Max patch operates a Syphon client that receives a video stream from the server and makes it available to Jitter objects.

 download

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

folder: web-video-streaming

patch: jit.gl.syphonclient.maxhelp

externals: 
  • jit.gl.syphonclient.mxo:

Note: externals are included with max-projects but can also be downloaded here: http://syphon.v002.info

other dependencies (app) 
  • CefWithSyphon.app

Download the CefWIthSyphon app from here:  https://github.com/vibber/CefWithSyphon – A Mac OS binary is available and has been tested with Mac OS 10.9.2

Instructions
  • Open the client example /jit.gl.syphonclient.maxhelp in  Max
  • Run the CefWithSyphon app. It will launch a browser
  • The browser content should now stream to the clientcontext window in Max 
  • If not streaming, click the “getavailableservers” message and select the correct server/client from menu objects outlined in red