friday lunchtime lecture: making music with open data
TRANSCRIPT
-
8/11/2019 Friday lunchtime lecture: Making music with open data
1/31
TROUBLE AT
T'LEEDSDATAMILL:
OOMPAH.PY
BIG DATA MEETS BIG BRASS/
/Nicholas H.Tollervey @ntoll
Simon Davy @bloodearnest
http://twitter.com/bloodearnesthttp://github.com/bloodearnesthttp://twitter.com/ntollhttp://ntoll.org/ -
8/11/2019 Friday lunchtime lecture: Making music with open data
2/31
AGENDAOompah.huh..? (Nicholas & Simon)
Data analysis. (Simon)Musical mischief. (Nicholas)Questions. (You)Performance! (Enderby Brass Band)
-
8/11/2019 Friday lunchtime lecture: Making music with open data
3/31
OOMPAH.HUH..?
-
8/11/2019 Friday lunchtime lecture: Making music with open data
4/31
"WE TELL STORIES..."
-
8/11/2019 Friday lunchtime lecture: Making music with open data
5/31
LDM HACK DAYCan we tell an engaging story about Leeds with data?
-
8/11/2019 Friday lunchtime lecture: Making music with open data
6/31
http://leedsdatamill.org/dataset/leeds-city-centre-footfall-
data
http://leedsdatamill.org/dataset/leeds-city-centre-footfall-data -
8/11/2019 Friday lunchtime lecture: Making music with open data
7/31
-
8/11/2019 Friday lunchtime lecture: Making music with open data
8/31
CRAZY IDEA #1Turn the footfall data into music.
-
8/11/2019 Friday lunchtime lecture: Making music with open data
9/31
CRAZY IDEA #2
-
8/11/2019 Friday lunchtime lecture: Making music with open data
10/31
CRAZY IDEA #2What musical genre epitomizes Leeds?
-
8/11/2019 Friday lunchtime lecture: Making music with open data
11/31
-
8/11/2019 Friday lunchtime lecture: Making music with open data
12/31
Our aim was to write Python scripts that turned raw footfalldata into music for brass band called "Rhythm of the City".
And so, oompah.pywas ironically checked into Github.
-
8/11/2019 Friday lunchtime lecture: Making music with open data
13/31
-
8/11/2019 Friday lunchtime lecture: Making music with open data
14/31
DATA ANALYSIS
MUNGING
-
8/11/2019 Friday lunchtime lecture: Making music with open data
15/31
EXCEL + MESSY DATA = AARGH!
Please use CSV
-
8/11/2019 Friday lunchtime lecture: Making music with open data
16/31
Tuesdayname | median | min histogram max|-------------------------------------------------------------------------00:00 : 33.0 ms [ 1.0 ___ _ __ _ _ _ 382.0]
01:00 : 30.0 ms [ 4.0
________ __ _____ ___ 397.0]02:00 : 28.0 ms [ 5.0 ____ __ _ ____ _ 321.0]03:00 : 23.0 ms [ 5.0 _______ _ ____ __ 264.0]04:00 : 12.0 ms [ 2.0
______ __ _ ___ __ 180.
0]
05:00 : 17.0 ms [ 1.0
___ ____ __ __ __ 186.0]06:00 : 64.0 ms [ 6.0
_
_ ___ 163.0]07:00 : 205.0 ms [ 5.0 ___ ___ _ _ _ ____ 405.0]08:00 : 470.0 ms [ 12.0 _ __ ___ _ ____ 745.0]
09:00 : 554.0 ms [ 14.0 _____
_
______ 1096.0]10:00 : 931.0 ms [ 24.0 __ _ _ ____ ____ 1970.0]11:00 : 1357.0 ms [ 0.0 _ _ _____
______ 2
478.0]12:00 : 1823.0 ms [ 56.0 ___ _ __ _ ________ _ 5652.0]
-
8/11/2019 Friday lunchtime lecture: Making music with open data
17/31
TIME TRAVEL FTW
WEEK = {}
WEND = {}
forf inglob.glob('*.csv'):
voice = f.split('.')[0].lower().replace(' ', '_')
WEEK[voice] = defaultdict(list)
WEND[voice] = defaultdict(list)
withopen(f) asfp:
forrow incsv.DictReader(fp): t = row['Hour']
d = row['WeekDay']
ifd.lower() in('saturday', 'sunday'):
data = WEND
else:
data = WEEK
data[voice][t].append(int(row['Count']))
-
8/11/2019 Friday lunchtime lecture: Making music with open data
18/31
PITCH
defpitch(data, scale):
"""Generate notes from the scale driven by the data."""
index = 0 ford indata:
index = (index + d) % len(scale)
yieldscale[index]
-
8/11/2019 Friday lunchtime lecture: Making music with open data
19/31
DURATION
defrhythm(data, mn, mx):
"""Produce note durations from provided patterns,
based on mean intensity
"""
i = threshold(data)
pattern = patterns[i]
# use the data to chose which pattern, # so the process is deterministic
index = 0
ford indata:
index = (index + d) % len(pattern)
forduration inpattern[index]:
yieldduration
yieldNone # indicates a bar has been produced
-
8/11/2019 Friday lunchtime lecture: Making music with open data
20/31
VOICE OF THE STREET
defvoice(data, scale, mn, mx, length=8):
"""Generate a voice from the data, combining pitch and rhythm""" bars = 0 note_iter = pitch(data, scale) forduration inrhythm(data, mn, mx): ifduration isNone: bars += 1 yield'|' ifbars == length:
raiseStopIteration() elifduration[0] == 'r': yieldduration else: note = next(note_iter) if'%s'induration: # more complex templated duration (e.g. tuplets) yieldduration % note
else: yield"%s%s"% (note, duration)
-
8/11/2019 Friday lunchtime lecture: Making music with open data
21/31
MUSICAL
MISCHIEF
-
8/11/2019 Friday lunchtime lecture: Making music with open data
22/31
BLOOPS!
0:00
-
8/11/2019 Friday lunchtime lecture: Making music with open data
23/31
Charles E.Ives
-
8/11/2019 Friday lunchtime lecture: Making music with open data
24/31
Music affects because of the effects of sound.
Music engages us to listen.
Music, in some sense, tells a story in sound (there is adiscernable narrative).
-
8/11/2019 Friday lunchtime lecture: Making music with open data
25/31
CAN WE REVEAL THE STORY
OF THE DATA THROUGH
MUSIC?
-
8/11/2019 Friday lunchtime lecture: Making music with open data
26/31
ELEMENTS OF MUSIC
-
8/11/2019 Friday lunchtime lecture: Making music with open data
27/31
ELEMENTS OF MUSIC
Pitch: how high or low a note sounds.Rhythm: a sequence of different durations.Melody = Pitch + Rhythm.Timbre: the quality of a sound (e.g. the difference
between a flute and violin).Dynamics: loudness.Key: the set of available pitches.Harmony: how pitches sound together as polyphony.
Texture: how the harmony is "voiced".Etc, etc...
-
8/11/2019 Friday lunchtime lecture: Making music with open data
28/31
A MUSICAL MAPPINGThe ingredients for generating "Rhythm of the City".
Each instrument group in the band represents a specificarea of the city. Ergo, cameras/locations aredifferentiated by timbre.The amount of footfall in a location changes the intensity
of dynamics and rhythm (more footfall = louder / busiermelodies).Use "nice" sounding pentatonic keys.Time of day is indicated by key.
Each hour of the day is represented by an eight barfragment.Tubular bells sound out the hours every eight bars.
THE RESULT!
-
8/11/2019 Friday lunchtime lecture: Making music with open data
29/31
THE RESULT!
-
8/11/2019 Friday lunchtime lecture: Making music with open data
30/31
DOES IT WORK..?
IT'S TUBA TIME!
-
8/11/2019 Friday lunchtime lecture: Making music with open data
31/31
IT'S TUBA TIME!
1am, 7am, 12 noon