mzk

- music theory helper
git clone git://git.acid.vegas/mzk.git
Log | Files | Refs | Archive | README | LICENSE


8 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/screens/circle.png b/.screens/circle.png
Binary files differ.
diff --git a/screens/intervals_scales.png b/.screens/intervals_scales.png
Binary files differ.
diff --git a/screens/scale.png b/.screens/scale.png
Binary files differ.
diff --git a/README.md b/README.md
@@ -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)
 \ No newline at end of file
diff --git a/mzk/__pycache__/constants.cpython-39.pyc b/mzk/__pycache__/constants.cpython-39.pyc
Binary files differ.
diff --git a/mzk/__pycache__/functions.cpython-39.pyc b/mzk/__pycache__/functions.cpython-39.pyc
Binary files differ.
diff --git a/mzk/functions.py b/mzk/functions.py
@@ -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:]) + '│')
diff --git a/mzk/main.py b/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':