Playing bird calls in Max

Using the xeno-canto API

Note: 2024/01/21 – patch not working in repository, but has been fixed locally with updates to birdcall4.maxpat.

(updated 1/25/2021)

This Max patch retrieves bird call data from the xeno-canto API, then plays an mp3 file of the bird call using the URL from the query.

If you’d like to modify this patch to play the sounds of other birds, you can get the species names from: http://www.xeno-canto.org

Click to hear the bird call from the patch:

download:

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

folder: bird-calls

files

Max
  • bird-call4.maxpat
  • nothing-detector.maxpat (for tracking progress of html request)

authorization

  • none required

instructions

  • Open the Max patch: bird-call4.maxpat
  • Select a bird from the menu. Wait a few seconds. If the hit-counter increases above zero then the search was successful.
  • Click the button to start audio.
  • Click the button to play a random recording from the query

notes

There are two html queries. The first query retrieves an array of recording records for a selected bird. The second query downloads the .mp3 file with the actual recording.

The patch uses [dict] and [maxurl] to format execute the first query. Then it uses [jit.uldl] to download the .mp3 file.

New York Times article search API

update 6/2014 – This version of the API appears to be broken. Will need to update the example below.

Note: As of June 1, 2014, version 1 of the Article Search API has been deprecated. Please use version 2.

original post

http://developer.nytimes.com/docs/article_search_api

Example that works (except for the api key):

http://api.nytimes.com/svc/search/v1/article?query=dubstep&begin_date=20121101&end_date=20121130&api-key=123

I loaded the result file from this query into a max patch: JSON_readwrite-nyt-test and printed out the title and body of the first article returned.

There are examples in the above link and explanation of using ‘facets’ which give you stuff like counts of articles and mentions of things like corporation names & other common things. Also some logic tricks for doing complex queries.

 

final notes on attempts to convert XML to JSON in Max

update: this conversion may be built into Max 6.1.7… [js]

For now I am using the following method:

  • Write xml using jit.textfile
  • use aka.shell to convert xml to json using python script xml2json.py (modified header)
  • read the json file in using method in JSON_Readwrite.maxhelp

Its not elegant but it works on the MAC – without installing additional software, like node.js and all of its packages.

update: 3 weeks later. Have been using the above method and also calling curl from aka.shell – writing XML files to /tmp – Then following steps 2 and 3 above. Works fine.

 

 

 

 

JSON parser in Max

by Peter Nyboer

update 6/2014 – Peter Nyboer’s method has been used successfully with most of the Internet sensors projects: https://reactivemusic.net/?p=5859 But as of Max 6.1.8 JSON parsing is built into Max js object.

original post

This post may have a real answer. It reads and writes JSON files. Note the the actual patch from Peter Nyoeber is near the bottom of the post. I have downloaded it into max teaching example/JSON_readwrite.maxhelp

http://cycling74.com/forums/topic.php?id=33601

All the rest of the stuff in this post has not been tested…

json to dict?

http://cycling74.com/forums/topic.php?id=40390

See if we can figure out this xml to json converter

http://cycling74.com/forums/topic.php?id=38631

another twitter4j thing but I can’t figure it out yet

 

http://cycling74.com/forums/topic.php?id=41843

 

test of WordPress text-expander plugin

Following this line, is some text to expand…

It uses shortcodes for the formatting…

[ expand title ]
text
[ /expand ]

 

this
is
some
text

Here is a Max patch in compressed text format. Enclose it in <pre> </pre> tags

----------begin_max5_patcher----------
528.3ocyU0ziaBCD8L7qvBodZCD7GXC6sH0iUUUppm5tph.N65JvNBbTy1U6
+8ZafDRhVET2UzdH1iey3g27xLvy9dAqU64sAfaAeG348rummCxB30e1KnNe
eQUdqKr.I+Wp0+LXQmKMeu1AuoQU29T8ZU0fqs45hGExG9QCuP28DHwQwK.P
paKEaWQlUv88WYiRpk40bWFW0HxOjLqmVwucdfDyE6fk6pExJt1QM3QP0N84
nhRWVMbOLaHqcgoeZKuieAAf6sddw22tr3sIIMlzyABoFroRkquptfhcaYvY
QWvWpKrWWWVz+68TeDZdy0aVPtMb7+plE57zrrswznb8VjtQGb5rnFwWpFjf
+hRtl21l+.+hZd0pu7IvcAIDTDhbWf4+5kzknXHB.iuESyqMNgLHDhvHi6u8
0OZ.97xUfPfY0fDNb6DygSLMyR86DJi0ev5GBO2D16EhRhRoVravQDBiYvFr
BA2DGQIevEXHlFkAy5roYQrzNSHEEkhs2GRIQIz96bfyGRwwr1URiKAXZDEO
xzDzH2iKdyS7TdMx4fTWIj7B0NoSuIWq6paMAxralB68p6BM0YMzDm0b7xUb
m8oKWoYwOsarUsqoXHU8eA.br5J4sZgLWKTxQwvNIlGEkkb43ohZQ4VkYnsm
BuxKClJinSfQYyJiXSfQjYmQv+qXDZBZD8MvHygW7+yzP0RM
-----------end_max5_patcher-----------

Detecting an IR Beam Break using the Arduino IR Library

A simple electric eye circuit

By Ken Shirriff

http://www.arcfn.com/2010/03/detecting-ir-beam-break-with-arduino-ir.html

update 5/2014 – For current information, see the musical stairs project – using this IR library with sensors from Adafruilt: https://reactivemusic.net/?p=12300

original post

I was able to build a version of this using some ir receivers from radio shack. The receivers were different – one received a relatively narrow angle beam, while the other one seemed to pick up everything in the room. So, although this method works, it will require some hardware tweaking.

Here’s my Arduino code for this… Note that the code runs 2 beams but the photos and videos only show one in the circuit.

#include <IRremote.h>
// tz 12/26/2012
/* This works with the basic IR beam layout of an
IR emitter and IR receiver from radio shack - when you break the 
beam, like with your hand the LED on D13 lights up.

*/
#define PIN_IR 3
#define PIN_DETECT 2
#define PIN_STATUS 13

#define PIN_DETECT_B 7
#define PIN_STATUS_B 8

int counter = 0;
int stat = 0;
int stat_B = 0;

IRsend irsend;
void setup()
{
   Serial.begin(9600); // open the serial port
  pinMode(PIN_DETECT, INPUT);
  pinMode(PIN_STATUS, OUTPUT);

    pinMode(PIN_DETECT_B, INPUT);
  pinMode(PIN_STATUS_B, OUTPUT);
  irsend.enableIROut(38);
  irsend.mark(0);
}

void loop() {
//  digitalWrite(PIN_STATUS, !digitalRead(PIN_DETECT));
irsend.space(0);
delay(1);
irsend.mark(0);
stat = digitalRead(PIN_DETECT);
digitalWrite(PIN_STATUS, stat);

stat_B = !digitalRead(PIN_DETECT_B);
digitalWrite(PIN_STATUS_B, stat_B);
delay(1);

counter++;
if(counter > 1000) {
  Serial.print("A: ");
  Serial.print(stat);
  Serial.print(" B: ");
  Serial.print(stat_B);
  Serial.println();
  counter = 0;
}
}

 

 

music production demo projects

Current Ableton Live example projects for Music Production course at Gould Academy. Eventually these will all be student projects.

Brooks Layman – remixes (Fall trimester 2012)

http://zerokidz.com/music/?p=202

Seven Nation Army

http://zerokidz.com/music/?p=158

Saxophone Loop thing

http://zproject.wikispaces.com/live+saxophone+loops

Several versions  on the black macbook – the recent files menu should give a clue.

Some notes about an unfinished version…

https://reactivemusic.net/?p=1973

Kinect Air Piano adapted from Ryan Challinor

Example of playing a Midi Instrument using Kinect sensor

Components

  • Ableton Live
  • Max for Live
  • Kinect
  • Synapse

File Location: kinect/myLiveSets/lefthandpiano Project/leftHandPiano.als

Use left hand to play a few piano notes by horizontal movement

Dubkinect by Ryan Challinor

Example of playing a Midi Instrument using Kinect sensor

Components

  • Ableton Live
  • Max for Live
  • Kinect
  • Synapse

Location: kinect/synapse examples/dubkinect Project/dubkinect.als

More information about Synapse and Ryan Challinor: http://synapsekinect.tumblr.com/

Instructions

It tracks lots of joints, but to start, place hands together above head and pull apart quickly, then use left arm (vertical) for volume, right hand horizontal for wobble, right hand vertical for pitch, and so on.

“Shining Star” (slice to midi)

How to warp an entire song, then make it into a keyboard sampler by using slice to midi and applying it to a sampler or simpler device

file: ableton teaching projects/shining star Project

https://reactivemusic.net/?p=2427

Singing Dunes

Simulation of the eerie sounds of shifting sand dunes using Analog and Operator synthesizers.

file: ableton teaching projects/singing dunes project

https://reactivemusic.net/?p=3620

Call Me Maybe remix set

Examples of setting up beats and melodies to do a remix

file: ableton teaching projects/jepsen2/test1 Project/callMeMaybe3.als

takes a while to load up… This was one of my first attempts to use Ableton to do something like this and now in retrospect, this sounds a bit lame, or tame.

Warping

https://reactivemusic.net/?p=1424

Clip envelopes

https://reactivemusic.net/?p=1419

project notes

https://reactivemusic.net/?p=1415

Also check out this example of using grain/warp stretches in this same project folder

file: ableton teaching projects/jepsen2/test1 Project/callMeMaybe3.als

animal beat

example of making a beat with animal sound effects

file: ableton teaching projects/animal beat 1 Project

gangnam style

example of how to make the synth bass riff for “Gangnam Style” – includes, side chaining compressor.

file: ableton teaching projects/basic beat thing Project/g3.als

without side chaining:

file: ableton teaching projects/basic beat thing Project/gangnam style.als

Infinite Gangnam Style

https://reactivemusic.net/?p=3945

How to make Gangnam style bass with Sylenth

https://reactivemusic.net/?p=2264

peas morph

An example of remixing by transposing samples in a Black Eyed Peas song

file: ableton teaching projects/basic beat thing Project/peas morph.als

Foster The People (warp and remix by adding drum machine)

“Call it What you Want” by Foster the People – warped and then combined with a drum machine beat

file: ableton teaching projects/basic beat thing Project/call it what you want example.als

Another jazzy example:

file: ableton teaching projects/basic beat thing Project/sunny side.als

 bieber fills

Example of how to slow down an entire track by loading into sample and using pitch bend

file: ableton teaching projects/basic beat thing Project/bieber-fills.als

Notes: Ableton – special effects, slowing down the master track

An interesting cover: dirty loops “Baby”

dummy clips field recorder (and launchpad)

What happens when you apply a set of envelopes and effects to some random source, like a band warming up or an orchestra tuning?

file: ableton teaching projects/dummy clips example Project/dummy clips band recorder 11-08.als

A dummy clip is actually an empty audio clip which contains some kind of processing – so what ever gets routed through it is processed as if it were the clip inside of it. This allows you to automation on various samples without hardcoding the automation into the track.

Read notes carefully before trying to use this

notes: Ableton dummy clips field recorder

An example using above set and jamming it with launchpad:

Band Rehearsal Remix

More notes on dummy clips to do fades or select a path in an effects rack

Ableton – using dummy clips

making beats

A quick example of beatgridding plus effects

file: ableton teaching projects/makingBeatsAbletonLesson Project

multitrack recording

A very rough example of some audio recording mixed with Midi tracks

file: ableton teaching projects/multitrack recording arrangement Project

obama vocoder example

How to modulate a synthesizer with spoken word.

file: ableton teaching projects/obama vocoder example project

Ableton vocoder example and tutorials

sound fx beat

Using annoying sound fx to create a drum beat

file: ableton teaching projects/sound fx beat Project

sununu project

Using Ableton to edit a news program

file: ableton teaching projects/sununu project

twitter vote

Play different midi notes based on twitter feed.

Uses ‘processing’ to grab twitter information and send it to Max for Live using OSC messages. There is a multiplexer receiver which gets all the twitter messages, then breaks them out by sending them to separate UDP ports for each midi “channel” since Live doesn’t allow multiple midi channels per track.

NOTE: to make this work you need to change the midi channels in the m4l twitter recv devices so they are different for each track you insert them in. It works with up to 3 channels

file: file: ableton teaching projects/vote Project

processing file:

file: documents/processing/osc_max_testing

This processing file is basically the same code as the mood lamp. But I changed the hashtag to #gop so it would keep working.

 

 

 

 

 

 

interactive media arts demo projects

Current example projects for the Interactive Media Arts course at Gould Academy. Eventually this list will be all student projects.

Light Saber Simulator by Erick Robicseke

From Fall trimester 2012.

Triggers light saber sounds by using Kinect sensor to detect arm movement

Components

  • Max/MSP
  • Kinect
  • Synapse

A video of the project is at Cycling74.com http://cycling74.com/project/light-saber-simulator

Note: I haven’t actually tried to run this yet without Erick helping to make it work.

Kinect Air Piano adapted from Ryan Challinor

Note for Kinect projects: It can be difficult to get Synapse to recognize your skeleton. I have had good results being about 10 feet away from the sensor – and making sure it can see your whole body.

Example of playing a Midi Instrument using Kinect sensor

Components

  • Ableton Live
  • Max for Live
  • Kinect
  • Synapse

File Location: kinect/myLiveSets/lefthandpiano Project/leftHandPiano.als

Use left hand to play a few piano notes by horizontal movement

Dubkinect by Ryan Challinor

Example of playing a Midi Instrument using Kinect sensor

Components

  • Ableton Live
  • Max for Live
  • Kinect
  • Synapse

Location: kinect/synapse examples/dubkinect Project/dubkinect.als

More information about Synapse and Ryan Challinor: http://synapsekinect.tumblr.com/

Instructions

It tracks lots of joints, but to start, place hands together above head and pull apart quickly, then use left arm (vertical) for volume, right hand horizontal for wobble, right hand vertical for pitch, and so on.

Wiimote light IR Light Painting and Synth controller

[note] – need to build a new IR pointer or get one – the switch and battery are a bit flakey and that messes up the drawing at times.

Musical light painting using Wiimote and homemade IR device.

Components

  • Max/MSP
  • Osculator
  • Wiimote

– musical light painter location: max teaching examples/tz examples/ir4.maxpat

  • turn on osculator and make sure wii is transmitting raw IR data
  • turn on audio and sound
  • turn on qmetro for jitter

– The hacky synth thing is at Location: max teaching examples/tz examples/wiimote_ir_xy_synth.maxpat – make sure to:

  • 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 (see below)
  • experiment with the ‘gate’ toggle in the middle of the patch
Osculator notes:
  • The real Wii remotes work better than the neko versions
  • check the output port (gear icon) to make sure it matches the one in max, for example 9000 or 9005
  • recently using wii3.oscd
  • If the indicators in osculator are yellow, then it probably means you havent set output routings in event type and value. Use: OSC routing and the funny pacman symbol
  • make sure osculator/wiimote is connected and sending raw IR data
Wiimote Bicycle Engine

Triggers engine simulation by using wiimote taped to spokes of a bicycle wheel. The speed of the wheel is translated to the speed of the engine sound. Still needs some work.

  • Max/MSP
  • Osculator
  • Wiimote

files max teaching examples/tz examples

  • 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.,

[update] there are some issues with this – 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! why? – 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.

Car Engine Simulation with OBD-II Sensor

Reads OBD-II bluetooth sensor from car and uses information to control an engine simulation. (Max/MSP, OBD-II sensor)

Location: automax. files:

  • rpm4.maxpat
  • waveguide-engine2e-1.maxpat

Need to run through the initialization sequence to make it work – note this patch needs to have metro streaming of data because it doesn’t change frequently enough to get a smooth engine sound.

Star Trek Transporter

Simulates TOS Star Trek transporter (Max/MSP, Jitter (Vizzie), Korg Nano Controller)

Files are in pd/

  • vizzie-transport2
  • transporter_TOS2-var

Make sure audio is on, vizzie is on, nano controller is plugged in – then press the lower right button in channel nine of the nano controller to start transporter

Guitar Hero Controller

[update – last tried this in December 2012 and ran into a few issues with setup]

Use a Guitar Hero controller play synthesizer in Max.

components

  • Guitar Hero Controller
  • Max/MSP

This patch (buzz_360) has some issues, but it shows how to use and calibrate a Guitar Hero guitar controller in Max/MSP. You will need to get a driver working. See the previous Guitar Hero post about how to do that.

file location: guitarhero/fretbuzz_v0.2/buzz_360_tz3.maxpat

There’s no way to make this work clean for a demo without taking apart the whole button driver patch (buzz_setup_360) and it has some serious max6 compatibility issues. So it just needs to be calibrated every time for now.

Use the GRY mode for a demo…

Before using it, restart Max.

Works in Max6 – need to calibrate first, don’t worry about tilt and whammy for this app but you need to calibrate them first anyway by pressing the X toggle, tilt, then unpress, or it wont work. when you calibrate the buttons, the X toggle should disappear. then save and untoggle the config box.

mode selection example: hold back button, press and hold the green button, then let go of back (that loads mode G)

download link:

http://theguitarzeros.com/download_fretbuzz.php

Cool modes: (guitar)

RY – solo mode – hold down frets and twiddle

GRY – 2 hand tap mode – orange does major 3rd up shift – holding flipper down does one button thing

GB – uses tilt sensor

also Y – power chords

 

To set a mode, hold “back”, then select the color code keys, then release “back”

Irish Train Data Visualization

[update – now part of internet-sensors project]

Collect current train position data from Ireland display it as point data on an XY grid.

components:

  • Max/MSP
  • node.js
  • Web browser
  • Irish train API

 

server files in: hoo/

To run server,

# node max-train1.js

Max files are in: maxNode-jsTest

  • max-train2.maxpat
  • train-drawing3.maxpat

The presets go from low res to high res on Dublin. You can play back train-data1.txt by clicking read message on the data recorder. set metro set to 1 for high speed. Need to manually clear the lcd and lcdsprites in the drawing section.

Green Screen Demo

[update: this really needs an external camera and a large green area]

An example of live chroma-keying, ie. green screen

components

  • Max/MSP – Jitter
  • builtin camera

files in: max teaching examples/

greenScreen1.maxpat

to use:

  • click open (screen grab)
  • click read (moves/nd2.mov)
  • click start/stop toggle
  • in the grab viewer, select the background color to chromakey, by clicking with mouse
Lego Drum Sensor

uses contact microphone for musical effects (patch by Matthew Davidson?)

components

  • Max/MSP
  • Contact Mic

files in: max teaching examples/PM1_piezo_translator

run: _piezo.maxpat

  • plug in mic before you load max and set input to port
  • turn dsp on
  • ******set input to 2 (or 1 )and turn up level
  • try master preset 5
  • also try sample1
Text Rain by Camille Utterback

Uses video tracking to interact with people and affect projection of letters falling on screen

components

(unknown)

 http://camilleutterback.com/projects/text-rain/

Touch OSC controller

Shows how to use an ipod or iphone as a controller

components

  • Max/MSP
  • ipod touch
  • touchOSC

file in: max teaching examples/tz examples

tz-synth-4-touchOSC.maxpat

need to setup touchOSC on the ipod to send to the host which Max is running on – using port 8000 to send data.

Try one of the last presets for a reasonable synth sound. Then use the top (horizontal ) slider in the touchOSC simple layout.

New York Times Archive Search Visualization (Jer Thorpe)

Graphs occurences of Winnie The Pooh characters in the NYTimes since 1985

components

  • processing
  • NYT API

file in: Documents/processing/NYT_GraphMaker/NYT_GraphMaker.pde

Replace occurrences of pooh, kanga, tigger, with whatever, like chocolate, strawberry, cherry, vanilla – then run it. It takes a minute or so to generate the graph. To read the graph start at 12:00 (1985) and read radially clock wise to 2012

Circuit Bent cat alarm

Whenever the cat crosses the path of an electric eye it triggers the gun.

components

  • electric eye
  • toy ray gun

PVC Saxophone with fx processing

PVC tubes with a saxophone mouthpiece hooked into a Roland Sound Canvas for fx processing.

Musical Pants by Ryan Linn

Built with sensors made from foam rubber and pennies – to trigger an icube-x midi controller running into a midi-synthesizer. Ryan did this project at Gould Academy.

http://zproject.wikispaces.com/musical+pants

Music From Weather Data (Cycling74)

Monthly weather data from 4 cities controls a midi piano synthesizer (max/MSP)

Example is a tutorial patch in Max | Help | Max Tutorials | Data | 02dDataScaling.maxpat

This tutorial is one of the best examples of how to connect Max with data to make music and cool visualization…

Stock market music case study

The fluctuations in stock market quotes and volume are converted into musical notes.

components

  • Max/MSP
  • php, mysql, html, javascript

http://zproject.wikispaces.com/stock+market+music

Arduino Twitter election mood light

An adaptation of the classic Arduino mood light which translates twitter mentions of political candidates into voltage levels.

Arduino Files: documents/arduino/networked_lamp.ino

Processing Files: documents/processing/sketch_may15a

needs some testing – also need to clean up file names, get a schematic, etc.,