|
6 | 6 | from synthesizer import Player, Synthesizer, Waveform |
7 | 7 |
|
8 | 8 |
|
9 | | -BASE = 261.626 # C4 |
10 | | - |
11 | | - |
12 | 9 | def main(): |
13 | 10 | player = Player() |
14 | 11 | player.open_stream() |
15 | 12 |
|
16 | 13 | print("play major chord") |
17 | 14 | synthesizer = Synthesizer(osc1_waveform=Waveform.sine, osc1_volume=1.0, use_osc2=False) |
18 | | - chord = [BASE, BASE * 2.0 ** (4 / 12.0), BASE * 2.0 ** (7 / 12.0)] |
| 15 | + chord = ["C4", "E4", "G4"] |
19 | 16 | player.play_wave(synthesizer.generate_chord(chord, 3.0)) |
20 | 17 | time.sleep(0.5) |
21 | 18 |
|
22 | 19 | print("play minor chord") |
23 | | - chord = [BASE, BASE * 2.0 ** (3 / 12.0), BASE * 2.0 ** (7 / 12.0)] |
| 20 | + chord = ["C4", "Eb4", "G4"] |
24 | 21 | player.play_wave(synthesizer.generate_chord(chord, 3.0)) |
25 | 22 | time.sleep(0.5) |
26 | 23 |
|
27 | 24 | print("play sus4 chord") |
28 | | - chord = [BASE, BASE * 2.0 ** (5 / 12.0), BASE * 2.0 ** (7 / 12.0)] |
| 25 | + chord = ["C4", "F4", "G4"] |
29 | 26 | player.play_wave(synthesizer.generate_chord(chord, 3.0)) |
30 | 27 | time.sleep(0.5) |
31 | 28 |
|
32 | 29 | print("play 7th chord") |
33 | | - chord = [BASE, BASE * 2.0 ** (4 / 12.0), BASE * 2.0 ** (7 / 12.0), BASE * 2.0 ** (10 / 12.0)] |
| 30 | + chord = ["C4", "E4", "G4", "Bb4"] |
34 | 31 | player.play_wave(synthesizer.generate_chord(chord, 3.0)) |
35 | 32 | time.sleep(0.5) |
36 | 33 |
|
37 | 34 | print("play add9 chord") |
38 | | - chord = [BASE, BASE * 2.0 ** (4 / 12.0), BASE * 2.0 ** (7 / 12.0), BASE * 2.0 ** (14 / 12.0)] |
| 35 | + chord = ["C4", "E4", "G4", "D5"] |
39 | 36 | player.play_wave(synthesizer.generate_chord(chord, 3.0)) |
40 | 37 | time.sleep(0.5) |
41 | 38 |
|
42 | 39 | print("play chord sequence") |
43 | | - chord = [BASE * 2.0 ** (2 / 12.0), BASE * 2.0 ** (5 / 12.0), BASE * 2.0 ** (9 / 12.0), BASE * 2.0 ** (12 / 12.0)] |
| 40 | + chord = ["D4", "F4", "A4", "C5"] |
44 | 41 | player.play_wave(synthesizer.generate_chord(chord, 1.0)) |
45 | | - chord = [BASE * 2.0 ** (2 / 12.0), BASE * 2.0 ** (7 / 12.0), BASE * 2.0 ** (11 / 12.0)] |
| 42 | + chord = ["D4", "G4", "B4"] |
46 | 43 | player.play_wave(synthesizer.generate_chord(chord, 1.0)) |
47 | | - chord = [BASE, BASE * 2.0 ** (4 / 12.0), BASE * 2.0 ** (7 / 12.0), BASE * 2.0 ** (12 / 12.0)] |
| 44 | + chord = ["E4", "G4", "C5"] |
48 | 45 | player.play_wave(synthesizer.generate_chord(chord, 1.0)) |
49 | 46 |
|
50 | 47 |
|
|
0 commit comments