Skip to content

Instantly share code, notes, and snippets.

View eamonnbell's full-sized avatar

Eamonn Bell (Personal) eamonnbell

View GitHub Profile
@eamonnbell
eamonnbell / NRTChart.py
Created May 26, 2013 12:41
Show the results of all possible selections of up to MAX_OPS NRTs acting on D minor. Very slow after MAX_OPS = 4.
import music21
import itertools
MAX_OPS = 6
c = music21.chord.Chord('D4 F4 A4')
display = music21.stream.Stream()
LRPcombs = music21.analysis.neoRiemannian.LRP_combinations
@eamonnbell
eamonnbell / NRTfinder.py
Last active December 17, 2015 18:59
Tries to account for chord changes in a Bach Chorale by brute-forcing the 24 unique LPR operations
import music21
# From Hook/Andrew Chung
LRPgroup = ['', 'P', 'LPRP', 'LPR', 'LRL', 'PRPL', 'LRLR', 'RLR', 'LPRPR', 'LRPR', 'PR', 'PRP',
'R', 'RP', 'LP', 'L', 'LPL', 'PL', 'RL', 'PLR', 'LPR', 'LR', 'PRPR', 'RPR']
LRPCombinations = music21.analysis.neoRiemannian.LRP_combinations
def getCanonicalTransform(source, target):
@eamonnbell
eamonnbell / in-c.py
Last active June 15, 2021 15:59
Generate a performance of Terry Riley's In C
import music21
import itertools
from random import randint
MIN_REPETITIONS = 4
MAX_REPETITIONS = 10
NUMBER_OF_PARTS = 10
motives = ['e4 e e', 'e8 f8 e4', 'r8 e f e', 'r8 e f g', 'e8 f g r',
@eamonnbell
eamonnbell / dbz.bas
Created August 28, 2013 03:00
DBZ.BAS, possibly the earliest computer program I ever worked on back in (no troll) primary school. QBASIC
acrd = 250
bcrd = 250
4676 CLS
PRINT "LadBroken - Betting Xtreme - Planet Namik Special!"
PRINT
INPUT "Better 1 : ", nba$
INPUT "Better 2 : ", nbb$
PRINT nba$; " : Credit E"; acrd
INPUT "How much do you want do bet? ", amnt
@eamonnbell
eamonnbell / map.py
Created May 25, 2014 19:22
RGB pitch/chroma - color mapping after Sapp (2001)
# Chroma - color mapping suggested by Sapp (2001)
# Sapp, Craig. "Harmonic Visualizations of Tonal Music"
# in the Proceedings of the International Computer Music Conference (ICMC) 2001, Havana, Cuba.
# Uses music21 pitch.Names (?)
color_map = {
'A': (127, 31, 255),
'B': (255, 127, 0),
'C': (0, 255, 0),
'D': (63, 95, 255),
@eamonnbell
eamonnbell / time_finder.py
Last active August 29, 2015 14:06
Time finder
import itertools
import operator
# Student availability represented as a vector of truth values
# aka a binary number. First entry is 9am etc.
time_vector_list = [0b11101001110111101100,
0b11100011110111101000,
0b11110011110111100001,
0b11110011110111100101,
@eamonnbell
eamonnbell / sort.sh
Last active August 29, 2015 14:26
Sort images by aspect ratio (requires ImageMagick)
identify *.pbm | \
gawk '{split($3,sizes,"x"); print $1,sizes[1]/sizes[2]}' | \
sed 's/\[.\]//' | \
sort -gk 2
@eamonnbell
eamonnbell / ts_videos.ipynb
Last active September 5, 2015 18:46
A computer-assisted exploration of visual themes in Taylor Swift's music videos
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@eamonnbell
eamonnbell / sketch.pde
Created September 26, 2015 19:47
boxes in 3D space - Janky first go at Processing.org
int n = 12;
void setup()
{
noStroke();
size(600, 600, P3D);
frameRate(24);
}