- Removing the smilies
- Added functionality to change the graphic when a button was pressed
- Removed the OSC control - due to how sensitive the APC Mini sliders were, it looked quite amateurish (as they pick up every jolt as you move).
- Put in new graphics (here, I only had time to find some black and white ideograms of a skull and a 'warning') sign plus an "X" I drew in the two minutes before the gig.
- Added an option for graphics to wrap around (in the taxi on the way to the gig).

# Category Archives: creative code

# Up to date on videos

## Audio Reactive Critters

## Graphics experiments

### Rendering fat lines with Shoebot

### Animating fat lines with Shoebot

### Learning about 2D vectors

I have some basic code to find the length of a Bezier Curve and a point along it, I seem to have talked myself into implementing this in Cairo, so that's the next stage, from there path effects and text-on-a-path will be the next stage.# Progress so far

# Daily graphic 2

Todays daily graphic I'm getting familiar with grids (in shoebot), Vector maths from the planar library .. this started from the grid example from shoebot / nodebox.

Shoebot Code Below the fold

(more…)

# Everyday graphic

Not sure how practical it is, but will try and upload a new graphic everyday .. to start with will probably be quite basic 🙂 Here is the first, some moving granular thingies..

Shoebot code:

import random from math import sin, cos size(800, 800) colours=ximport("colors") def draw(): background(colors.aliceblue()) scale(1, 1) nostroke() fill(0.1, 0.2, 0.3) random.seed(0) for y in xrange(0, HEIGHT, 80): wiggle = sin(FRAME * 0.1) xs = 2.0 + (cos(y * 0.1) + sin(y) * 8.1) distance = 1.0 / HEIGHT * y fill(1.0, 1.0-distance, 0, distance) for x in xrange(0, 60): xpos = ((xs * FRAME-x * 40) % (WIDTH + 40)) - 20 circle(xpos, y + (wiggle * random.random() * 20.0), 20 + (wiggle * 2.0) * distance * 8.0) #xs = -sin(y) * 4.0 #for x in xrange(0, 60): # circle(WIDTH-xs * WIDTH - FRAME + x * 40, y+40, 20)

To run this, install shoebot and type: sbot -w granuals.sbot

# Shoebot experiment – perlin noise..

# pip install noiseThen to run;

sbot -w perlin-circlescape1.botHere's a video of them in action - See below the break for the code - (more…)

# Animated skulls – processingjs

Here's a little creative coding I did with processingjs a while back. Move the mouse to move the skulls.

# Moving things in shoebot – simple particles…

OK, part 3 - now for something fun - extending parts 1 + 2 into a simple particle system.

Particles, generally means - a lot of things moving around (the particles) and a way to generate them, an "emitter"

Here we're going to take the code from the previous two parts and add a couple of things to make a basic particle system.

Note - shoebot, isn't the fastest; but we do get nice looking results.

Here's a video of our arrows as particles (arrowsplosion!):

# Simple python spectrograph with shoebot

Seeing"Realtime FFT Graph of Audio WAV File or Microphone Input with Python..." on python.reddit.com reminded me of one I'd built in python with shoebot.

While it works OK, I feel like I'm missing a higher level audio library (especially having seen Minim, for C++ and Java).

To run it in shoebot:

sbot -w audiobot.bot

### audiobot.bot

# Major library imports import atexit import pyaudio from numpy import zeros, short, fromstring, array from numpy.fft import fft NUM_SAMPLES = 512 SAMPLING_RATE = 11025 def setup(): size(350, 260) speed(SAMPLING_RATE / NUM_SAMPLES) _stream = None def read_fft(): global _stream pa = None def cleanup_audio(): if _stream: _stream.stop_stream() _stream.close() pa.terminate() if _stream is None: pa = pyaudio.PyAudio() _stream = pa.open(format=pyaudio.paInt16, channels=1, rate=SAMPLING_RATE, input=True, frames_per_buffer=NUM_SAMPLES) atexit.register(cleanup_audio) audio_data = fromstring(_stream.read(NUM_SAMPLES), dtype=short) normalized_data = audio_data / 32768.0 return fft(normalized_data)[1:1+NUM_SAMPLES/2] def flatten_fft(scale = 1.0): """ Produces a nicer graph, I'm not sure if this is correct """ for i, v in enumerate(read_fft()): yield scale * (i * v) / NUM_SAMPLES def triple(audio): '''return bass/mid/treble''' c = audio.copy() c.resize(3, 255 / 3) return c def draw(): '''Draw 3 different colour graphs''' global NUM_SAMPLES audio = array(list(flatten_fft(scale = 80))) freqs = len(audio) bass, mid, treble = triple(audio) colours = (0.5, 1.0, 0.5), (1, 1, 0), (1, 0.2, 0.5) fill(0, 0, 1) rect(0, 0, WIDTH, 400) translate(50, 200) for spectrum, col in zip((bass, mid, treble), colours): fill(col) for i, s in enumerate(spectrum): rect(i, 0, 1, -abs(s)) else: translate(i, 0) audio = array(list(flatten_fft(scale = 80)))