def chord_fade(chord1, chord2, synth, length): env = Controller(0) env.lineto(length / 2, 1) env.lineto(length, 0) a = Layer([synth(x, length / 2) for x in notes(chord1)]) b = Layer([synth(x, length / 2) for x in notes(chord2)]) return Chain([a, b]) * env
def block6(): l = BEAT * 14 return Chain([ chord_fade('D4 E4 G4 C5', 'C4 D4 F4 Bb4', synth1, l), chord_fade('A3 Bb3 D4 G4', 'G3 A3 C4 F4', synth1, l), chord_fade('Ab3 D4 E4 G4 C5', 'G3 C4 D4 F4 Bb4', synth1, l), chord_fade('E3 A3 Bb3 D4 G4', 'D3 G3 A3 C4 F4', synth1, l), ])
def block1(p): return ( synth1(p + 7, BEAT * 1.5) + Chain([ synth1(p + 4, BEAT * 0.5), synth1(p + 2, BEAT * 0.5), synth1(p, BEAT * 0.5), ]) )
def practice_block(pitches, note_length): beat = 60 / tempo osc1 = multi_saw([1.0, .00]) freqs = [p2f(x) for x in pitches] tick_decay = 0.001 tick1 = Sine(3000) * ExpDecay(tick_decay) tick1.mlength = beat tick = Sine(1500) * ExpDecay(tick_decay) tick.mlength = beat ticks = Chain([tick1] + [tick] * ceil(len(freqs) * note_length + 3)) ch = Chain(start_offset=beat * 4) for freq in freqs: ch.add(osc1(freq).take(beat * note_length)) return ch * 0.2 + ticks
def main(): scale_pitches = notes(scale) pitch_range = notes(note_range) i_start = lowest_index(scale_pitches, pitch_range[0]) pitches = [] for x in steps: for y in pattern: pitches.append(scale_pitch(scale_pitches, x + y + i_start)) n_lengths = note_lengths + list(reversed(note_lengths[1:-1])) a = Chain([practice_block(pitches, x) for x in n_lengths]) a = Chain([a] * 1000) a.play()
def block5(): a = Chain([ block3(note('C4')) * .9, block3(note('Bb3')) * .9, ]) return Chain([a, a])
def chord_fade(chord1, chord2, synth, length): env = Controller(0) env.lineto(length / 2, 1) env.lineto(length, 0) a = Layer([synth(x, length / 2) for x in notes(chord1)]) b = Layer([synth(x, length / 2) for x in notes(chord2)]) return Chain([a, b]) * env def block6(): l = BEAT * 14 return Chain([ chord_fade('D4 E4 G4 C5', 'C4 D4 F4 Bb4', synth1, l), chord_fade('A3 Bb3 D4 G4', 'G3 A3 C4 F4', synth1, l), chord_fade('Ab3 D4 E4 G4 C5', 'G3 C4 D4 F4 Bb4', synth1, l), chord_fade('E3 A3 Bb3 D4 G4', 'D3 G3 A3 C4 F4', synth1, l), ]) a = block5() b = block6() b.play() a = Chain([a] * 128) a = a * 0.9 a.play() # a = synth1(note('C4'), 1) # a.play()