
One of my favourite visualisations from 2009 came in the form of a 3D Waveform experiment, authored by the consistently brilliant Mr.doob. Although I’m certain it did the rounds quite a bit at the time, I thought it deserved revisiting, as an example of the earlier developments of the three.js library currently under development by alteredqualia and Mr.doob himself.
I played about with this one quite a lot. You can produce quite eye-meltingly harsh results if you push heightened and randomised integers into the peak values. The endpoint of which, for me, was feasting my eyes on enormous gelatinous blocks of colour over the Occulation pieces by Mark Fell (I would(n’t) recommend doing this). (I’m divided as to whether to recommend giving that a go).
However I reverted back to almost the starting settings of the original experiment for this, backing it with the tough sounds of Pangea – Won’t Hurt. After Ben sent me this I thought this experiment was almost designed for that track. However, you can have a go yourself, as described on doob’s original post you just need a few lines of python and a wav (encode an mp3 as a wav if you don’t have a wav) and you’re away:
This isn’t necessarily sacrosanct. If you have any problems with this, I respond reasonably well to tweets
import math
import struct
import wave
import sys
#w = wave.open(sys.argv[1], 'rb')
w = wave.open('/Users/acastofthousands/web/gl-ob/doobism/wonthurt.wav', 'rb')
# We assume 44.1k @ 16-bit, can test with getframerate() and getsampwidth().
sum = 0
value = 0;
delta = 0;
amps = [ ]
for i in xrange(0, w.getnframes()):
# Assume stereo, mix the channels.
data = struct.unpack('
sum += (data[0]*data[0] + data[1]*data[1]) / 2
# 44100 / 30 = 1470
if (i != 0 and (i % 1470) == 0):
value = int(math.sqrt(sum / 1470.0) / 10)
amps.append(value - delta)
delta = value
sum = 0
print amps
Worth watching into its various breakdowns, here's the demo
Read More