def __init__(self): self.stats = self.init_stats() m = self.music = Music( part_names=( 'oboe', 'oboe 2', 'oboe 3', # 'violin', # 'flute', # 'oboe', # 'clarinet', # 'alto_saxophone', # 'trumpet', # 'bass' ), starting_tempo_bpm=160) self.clusters = [m.ob, m.ob2, m.ob3] # self.clusters = [m.f, m.ob, m.cl] # self.thirds = [m.alto_saxophone, m.trumpet] # self.violin = m.violin # self.bass = m.bass # self.thirds_register = range(55, 81) cluster_lowest_pitch = 70 for i in self.clusters: i.cluster_range = [p for p in i.range if p >= cluster_lowest_pitch] self.first() self.go(120.0) self.stats['duration'] = self.music.duration_seconds() self.print_stats()
def __init__(self): m = self.music = Music( part_names=('violin', 'flute', 'oboe', 'clarinet', 'trumpet', 'alto_saxophone', 'vibraphone', 'bass'), starting_tempo_bpm=105) beat_duration = 60.0 / self.music.starting_tempo_bpm chords = generate_chords() for chord in chords: print print_chord(chord)
def __init__(self): m = self.music = Music( part_names=('oboe', 'clarinet', 'vibraphone', 'bass'), starting_tempo_bpm=105, output_dir_parent='output', output_dir_name='experiment9', ) self.scale = get_random_scale() for _ in range(5): self.make_it(20)
def __init__(self): self.stats = self.init_stats() m = self.music = Music( part_names=( 'oboe', 'guitar', ), starting_tempo_bpm=105 ) beat_duration = 60.0 / self.music.starting_tempo_bpm self.go()
def __init__(self): self.stats = self.init_stats() m = self.music = Music( part_names=( 'oboe', 'oboe 2', 'oboe 3', # 'english_horn', # 'english_horn 2', # 'soprano_recorder', # 'soprano_recorder 2', 'alto_recorder', 'alto_recorder 2', 'alto_recorder 3', # 'baritone_saxophone', # 'guitar', # 'guitar 2', # 'guitar 3', # 'piano', # 'piano 2', # 'organ', # 'organ 2', # 'violin', # 'flute', # 'oboe', # 'clarinet', # 'alto_saxophone', # 'trumpet', # 'bass' ), starting_tempo_bpm=160) beat_duration = 60.0 / self.music.starting_tempo_bpm self.clusters = [m.ob, m.ob2, m.ob3] cluster_lowest_pitch = 70 for i in self.clusters: i.cluster_range = [p for p in i.range if p >= cluster_lowest_pitch] self.clusters[0].add_note(pitch=84, duration=2) self.clusters[1].add_note(pitch=83, duration=2) self.clusters[2].add_note(pitch=82, duration=2) while beat_duration * self.clusters[0].duration() < 120.0: self.next() self.clusters = [m.a_rec, m.a_rec2, m.a_rec3] cluster_lowest_pitch = 70 for i in self.clusters: i.cluster_range = [p for p in i.range if p >= cluster_lowest_pitch] self.clusters[0].add_note(pitch=84, duration=2) self.clusters[1].add_note(pitch=83, duration=2) self.clusters[2].add_note(pitch=82, duration=2) while beat_duration * self.clusters[0].duration() < 120.0: self.next()
def __init__(self): m = self.music = Music( part_names=('oboe', 'bass_clarinet', 'vibraphone', 'bass'), starting_tempo_bpm=105, output_dir_parent='output', output_dir_name='experiment7-looping', ) harmony_loops = get_harmony_loops() loop = random.choice(harmony_loops) print loop chords = loop * 16 for i, chord in enumerate(chords): # print i chord_duration = 2 # random.choice([1, 2, 2, 2, 4]) for instrument in self.music.instruments: # print instrument.instrument_name remaining_duration = chord_duration while remaining_duration: duration_options = np.linspace(.25, remaining_duration, remaining_duration * 4) duration = random.choice(duration_options) remaining_duration -= duration if len(instrument) == 0: previous_pitch = random.choice( instrument.middle_register) else: previous_pitch = instrument[-1].pitch lowest = max( [previous_pitch - 5, instrument.safe_register[0]]) highest = min( [previous_pitch + 5, instrument.safe_register[-1]]) pitch_options = [ p for p in instrument.range if p % 12 in chord and lowest <= p <= highest and p is not previous_pitch ] # print pitch_options pitch = random.choice(pitch_options) instrument.add_note(pitch=pitch, duration=duration)
def __init__(self): m = self.music = Music( part_names=( # 'oboe', 'guitar', 'bass', ), starting_tempo_bpm=105) beat_duration = 60.0 / self.music.starting_tempo_bpm chords = generate_chords() for i, chord in enumerate(chords): print print_chord(chord) # self.gen(self.music.oboe, chord, n_notes_options=[1, 2, 4], radius=4) # self.gen(self.music.flute, chord, n_notes_options=[1, 2, 4], radius=4) self.gen(self.music.guitar, chord, n_notes_options=[4, 8], radius=4) self.gen(self.music.bass, chord, n_notes_options=[2, 4], radius=4)
def __init__(self): m = self.music = Music( part_names=('oboe', 'clarinet', 'vibraphone', 'bass'), starting_tempo_bpm=105, output_dir_parent='output', output_dir_name='experiment8', ) chords_loop = random.choice(get_harmony_loops()) rhythm = {} for instrument in self.music.instruments: rhythm[instrument.part_name] = self.make_rhythmic_figure(4) print chords_loop for instrument in self.music.instruments: for chord in chords_loop * 8: for duration in rhythm[instrument.part_name]: if len(instrument) == 0: previous_pitch = random.choice( instrument.middle_register) else: previous_pitch = instrument[-1].pitch lowest = max( [previous_pitch - 5, instrument.safe_register[0]]) highest = min( [previous_pitch + 5, instrument.safe_register[-1]]) pitch_options = [ p for p in instrument.safe_register if p % 12 in chord and lowest <= p <= highest and p is not previous_pitch ] pitch = random.choice(pitch_options) instrument.add_note(pitch=pitch, duration=duration)