Fantasia on an Artificial Chorale #30

I’ve been working on the algorithmic aspect of this music making enterprise for a while. What I’m doing is not strictly Deep Learning, and not just algorithmic music either. It’s more of a hybrid of the two. In this case, I took one of the 16 voice chorales made with the coconet deep learning model, and then serially modifying each of the four component chorales through a set of algorithms, sort of like the layers in a deep learning model, but really more of simple modifications based on information about the notes. I start out by evaluating all the simultaneous notes to find those that are not in the scale that the chorale is in. These are lengthened up to 5 times their original length. At a later step those steps get a gradual crescendo applied to them. Steps that only use the notes in the key, G minor, get a decrescendo. I arpeggiate it in another step. I then double the voices from 4 to eight. Finally it is sent through a function that shifts the octaves of some notes up. I’ve set that up so that I can specify the percent of notes to have their octaves increase, and then clump that percent of notes into strings of 33 and 45 notes at a time. The effect is sort of shimmering, as some of the notes are higher, but then they are also played at their normal octave at the same time. That’s a filter that I created today.


Here’s the python code for those interested in that sort of thing.


file_stub = 'chorale_HP80063.npy' # one of about a hundred artificial chorales that the model created
dirname = 'wake_up_chorales' # the original chorale is called Wake Up, Wake Up, You Sleepers by J.S. Bach.
chorale = np.load(os.path.join(dirname,file_stub)) + 30
chorale = s.expand_and_concatenate(chorale, expand_codes)
chorale = s.transpose_up_segment(chorale,root) # restore the original key of G minor

masks = np.array([[16,18,2,6,3],[16,18,4,4,2],[16,20,1,4,3],[16,20,2,2,2]]) # arpeggiation mask

concat_chorale = np.empty((4,0),dtype=int)
concat_challenging_steps = np.empty((0,4),dtype=int)
previous_size = 0
for i in range(4): # for each of the four chorales stacked in a 16 voice array, take them one at a time.
sub_chorale = chorale[i*4:(i+1)*4,:]
scores = s.assign_scores_to_time_steps(sub_chorale, root, mode)
range_of_steps = s.find_challenging_time_steps(scores, sub_chorale)
range_in_tune = s.find_in_tune_time_steps(sub_chorale, range_of_steps)
sub_chorale, challenging_steps, in_tune_steps = \
s.expand_challenging_time_steps(sub_chorale, range_of_steps, range_in_tune, high = 6)
sub_chorale = s.arpeggiate(sub_chorale,s.shaded_mask((masks[i,0],masks[i,1]),masks[i,2],masks[i,3]),masks[i,4])
concat_chorale = np.concatenate((concat_chorale, sub_chorale),axis = 1) # add this chorale to the chain of chorales
challenging_steps += previous_size
previous_size += sub_chorale.shape[1]
concat_challenging_steps = np.concatenate((concat_challenging_steps,challenging_steps),axis=0)

chorale = np.concatenate((concat_chorale,concat_chorale),axis = 0) # double the voices from 4 to 8.
# 15% of the time increase the octave of a note, clump the changes in groups of 33 and 45
chorale = s.octave_shift(s.octave_shift(chorale, 0.15, 45), 0.15, 33)

Published by

Prent Rodgers

Musician seduced into capitalism.