1 | commit a4bccd73624babb4682e5dfa278894dd8c7c92f3 |
2 | Author: acidvegas <acid.vegas@acid.vegas> |
3 | Date: Thu Jul 25 00:58:26 2019 -0400 |
4 | |
5 | fixed docstring whitepace |
6 | --- |
7 | mzk/functions.py | 35 ++++++++++++++++------------------- |
8 | 1 file changed, 16 insertions(+), 19 deletions(-) |
9 | |
10 | diff --git a/mzk/functions.py b/mzk/functions.py |
11 | index b3cf09a..1c8db9e 100644 |
12 | --- a/mzk/functions.py |
13 | +++ b/mzk/functions.py |
14 | @@ -12,7 +12,7 @@ def generate_notes(key): |
15 | |
16 | def generate_scale(string, scale_notes, full=False): |
17 | notes = generate_notes(string.upper())*2 if full else generate_notes(string.upper()) |
18 | - notes.append(notes[0]) # add root note to the end |
19 | + notes.append(notes[0]) |
20 | for index,note in enumerate(notes): |
21 | if note in scale_notes: |
22 | notes[index] = notes[index].center(5, '-') |
23 | @@ -32,7 +32,7 @@ def scale(type, key): |
24 | last = 0 |
25 | notes = generate_notes(key) |
26 | scale_notes = [notes[0],] |
27 | - for step in scales[type]: |
28 | + for step in constants.scales[type]: |
29 | last += int(step) |
30 | if last >= len(notes): |
31 | last -= len(notes) |
32 | @@ -57,8 +57,7 @@ def print_chord(): |
33 | E A D G B e''') |
34 | |
35 | def print_circle_of_fifths(): |
36 | - ''' |
37 | - definition: |
38 | + '''definition: |
39 | the relationship among the 12 tones of the chromatic scale, their corresponding key signatures, & the associated major/minor keys |
40 | |
41 | accidentals: |
42 | @@ -77,8 +76,7 @@ def print_circle_of_fifths(): |
43 | minor sixth |
44 | minor third |
45 | minor seventh |
46 | - perfect fourth |
47 | - ''' |
48 | + perfect fourth''' |
49 | circle = constants.circle.replace('\n',' \n') + ' ' # todo: fix this |
50 | for note in ('major','C','F','B♭','E♭','A♭','D♭','C♯','G♭/F♯','B','C♭','E','A','D','G'): # todo: reverse |
51 | circle = circle.replace(f' {note} ', f' \033[91m{note}\033[0m ') |
52 | @@ -87,16 +85,15 @@ def print_circle_of_fifths(): |
53 | for note in ('minor','a','d','g','c','f','b♭','e♭/d♯','g♯','c♯','f♯','b','c'): |
54 | circle = circle.replace(f' {note} ', f' \033[92m{note}\033[0m ') |
55 | print(circle) |
56 | - #print(print_circle_of_fifths.__doc__) |
57 | + print(print_circle_of_fifths.__doc__) |
58 | |
59 | def print_intervals(): |
60 | - ''' |
61 | - definition: |
62 | + '''definition: |
63 | the distance between two notes or pitches |
64 | |
65 | note: |
66 | - semitone - half step |
67 | - tone - whole step (b to c & e to f is a tone) |
68 | + semitone - half step (b/c & e/f is a half step) |
69 | + tone - whole step |
70 | |
71 | types: |
72 | harmonic interval - notes played simultaneously |
73 | @@ -110,8 +107,7 @@ def print_intervals(): |
74 | major/minor - 2nds, 3rds, 6ths, 7ths |
75 | perfect - 4ths, 5ths, octaves |
76 | diminished - minor/perfect - 1 semitone |
77 | - augmented - major/perfect + 1 semitone |
78 | - ''' |
79 | + augmented - major/perfect + 1 semitone''' |
80 | print(' I N T E R V A L S ') |
81 | print('┌───────────┬──────────────────┬───────┐') |
82 | print('│ semitones │ quality │ short │') |
83 | @@ -119,7 +115,7 @@ def print_intervals(): |
84 | for interval, info in constants.intervals.items(): |
85 | print('│ {0} │ {1} │ {2} │'.format(str(info['semitones']).rjust(9), interval.ljust(16), info['short_name'].ljust(5))) |
86 | print('└───────────┴──────────────────┴───────┘') |
87 | - #print(print_intervals.__doc__) |
88 | + print(print_intervals.__doc__) |
89 | |
90 | def print_scale(root, type, full=False): |
91 | frets = (24,147) if full else (12,75) |
92 | @@ -132,22 +128,23 @@ def print_scale(root, type, full=False): |
93 | string_notes = generate_scale(string, scale_notes, full) |
94 | print(string + ' │' + '│'.join(note.center(5, '-') for note in string_notes[1:]) + '│') |
95 | print(' └' + '┴'.join('─'*5 for x in range(frets[0])) + '┘') |
96 | - print((', '.join(scale_notes) + ' / ' + get_pattern(scales[type])).rjust(frets[1])) |
97 | + print((', '.join(scale_notes) + ' / ' + get_pattern(constants.scales[type])).rjust(frets[1])) |
98 | |
99 | def print_scales(): |
100 | - ''' |
101 | - definition: |
102 | + '''definition: |
103 | any set of musical notes ordered by fundamental frequency or pitch |
104 | |
105 | note: |
106 | 1 - half step |
107 | 2 - whole step |
108 | 3 - whole step half step''' |
109 | - print(' S C A L E S ') |
110 | + print('S C A L E S'.center(43)) |
111 | print('┌───────────────────────┬─────────────────┐') |
112 | print('│ name │ intervals │') |
113 | print('├───────────────────────┼─────────────────┤') |
114 | for name, pattern in constants.scales.items(): |
115 | print(f'│ {name.ljust(21)} │ {get_pattern(pattern).rjust(15)} │') |
116 | print('└───────────────────────┴─────────────────┘') |
117 | - #print(print_scales.__doc__) |
118 | + print(print_scales.__doc__) |
119 | + |
120 | +print_scales() |