This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getCentralization(centrality, c_type): | |
c_denominator = float(1) | |
n_val = float(len(centrality)) | |
print (str(len(centrality)) + "," + c_type + "\n") | |
if (c_type=="degree"): | |
c_denominator = (n_val-1)*(n_val-2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
f = open('generate-and-interpret-output.csv','w') | |
iterations = 10000 | |
n_min = 5.0 #min constraint on n | |
n_max = 95.0 #max constraint on n | |
operator = 0 #operator for generation | |
#0 = add | |
#1 = sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#converts all midi files in the current folder | |
import glob | |
import os | |
import music21 | |
#converting everything into the key of C major or A minor | |
# major conversions | |
majors = dict([("A-", 4),("A", 3),("B-", 2),("B", 1),("C", 0),("D-", -1),("D", -2),("E-", -3),("E", -4),("F", -5),("G-", 6),("G", 5)]) |