Making progress on chord generation
This commit is contained in:
parent
703aacb1d5
commit
400703d72f
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 168 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
@ -1,9 +1,9 @@
|
||||
# mzk
|
||||
> music theory helper
|
||||
|
||||
![](screens/circle.png)
|
||||
![](screens/intervals_scales.png)
|
||||
![](screens/scale.png)
|
||||
![](.screens/circle.png)
|
||||
![](.screens/intervals_scales.png)
|
||||
![](.screens/scale.png)
|
||||
|
||||
## Information
|
||||
This repository originally started off as a means of using Python to learn music theory, specifcally guitar theory, since the basis of musical sound can be described mathematically *(in acoustics)* and exhibits a remarkable array of number properties.
|
||||
@ -27,7 +27,7 @@ Using the root of C, we can apply the pattern of the major scale to the C chroma
|
||||
* Scale/chord ASCII coloring
|
||||
|
||||
## Mirrors
|
||||
- [acid.vegas](https://acid.vegas/mzk)
|
||||
- [acid.vegas](https://git.acid.vegas/mzk)
|
||||
- [GitHub](https://github.com/acidvegas/mzk)
|
||||
- [GitLab](https://gitlab.com/acidvegas/mzk)
|
||||
- [SuperNETs](https://git.supernets.org/acidvegas/mzk)
|
BIN
mzk/__pycache__/constants.cpython-39.pyc
Normal file
BIN
mzk/__pycache__/constants.cpython-39.pyc
Normal file
Binary file not shown.
BIN
mzk/__pycache__/functions.cpython-39.pyc
Normal file
BIN
mzk/__pycache__/functions.cpython-39.pyc
Normal file
Binary file not shown.
@ -28,6 +28,20 @@ def get_pattern(pattern):
|
||||
elif step == '3' : new_pattern.append('WH')
|
||||
return ' '.join(new_pattern)
|
||||
|
||||
def chord_notes(type, key):
|
||||
notes = scale_notes(type, key)
|
||||
pattern = constants.chords[type]['pattern']
|
||||
_notes = [key,]
|
||||
for step in pattern.split()[1:]: #1 b3 5
|
||||
if len(step) == 2:
|
||||
if step[:1] == 'b':
|
||||
_notes.append(notes[int(step)-2])
|
||||
elif step[:1] == '#':
|
||||
_notes.append(notes[int(step)])
|
||||
else:
|
||||
_notes.append(notes[int(step)-1])
|
||||
return _notes
|
||||
|
||||
def scale_notes(type, key):
|
||||
last = 0
|
||||
all_notes = chromatic_scale(key)*2
|
||||
@ -146,13 +160,13 @@ def print_intervals():
|
||||
print('└───────────┴────────────────────┴───────┘')
|
||||
print(print_intervals.__doc__)
|
||||
|
||||
def print_scale(root, type, full=False):
|
||||
def print_scale(root, type, full=False, chord=False):
|
||||
frets = (24,147) if full else (12,75)
|
||||
print(f'{root.upper()} {type.upper()} SCALE'.center(frets[1]))
|
||||
print(' ┌' + '┬'.join('─'*5 for x in range(frets[0])) + '┐')
|
||||
print('0 │' + '│'.join(str(x).center(5) for x in range(1,frets[0]+1)) + '│')
|
||||
print(' ├' + '┼'.join('─'*5 for x in range(frets[0])) + '┤')
|
||||
notes = scale_notes(type, root)
|
||||
notes = chord_notes(type, root) if chord else scale_notes(type, root)
|
||||
for string in ('eBGDAE'):
|
||||
string_notes = generate_scale_string(string, notes, full)
|
||||
print(string + ' │' + '│'.join(note.center(5, '-') for note in string_notes[1:]) + '│')
|
||||
|
11
mzk/main.py
11
mzk/main.py
@ -12,17 +12,18 @@ import functions
|
||||
if len(sys.argv) != 2:
|
||||
functions.print_help()
|
||||
else:
|
||||
if sys.argv[1].startswith('--chord='):
|
||||
print(sys.argv[1])
|
||||
if sys.argv[1] == '--chords':
|
||||
functions.print_chords()
|
||||
elif sys.argv[1].startswith('--chord='):
|
||||
chord = sys.argv[1][8:]
|
||||
key = chord.split('_')[0].upper()
|
||||
type = chord[len(key)+1:].lower()
|
||||
if key in constants.notes and type in constants.scales:
|
||||
functions.print_chord(key, type)
|
||||
if key in constants.notes and type in constants.chords:
|
||||
functions.print_scale(key, type, chord=True)
|
||||
else:
|
||||
print('error: invalid key or chord type\n\n')
|
||||
functions.print_help()
|
||||
elif sys.argv[1] == '--chords':
|
||||
functions.print_chords()
|
||||
elif sys.argv[1] == '--circle':
|
||||
functions.print_circle_of_fifths()
|
||||
elif sys.argv[1] == '--intervals':
|
||||
|
Loading…
Reference in New Issue
Block a user