From 703aacb1d539f5eb8e5c62019126915e69671ac0 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Mon, 8 May 2023 23:59:37 -0400 Subject: [PATCH] Updated git url & added mirrors --- LICENSE | 2 +- README.md | 18 ++++++++- mzk/__pycache__/constants.cpython-37.pyc | Bin 2215 -> 0 bytes mzk/constants.py | 27 ++++++++++--- mzk/functions.py | 47 ++++++++++++++--------- mzk/main.py | 2 +- 6 files changed, 70 insertions(+), 26 deletions(-) delete mode 100644 mzk/__pycache__/constants.cpython-37.pyc diff --git a/LICENSE b/LICENSE index 69997e8..4c8b212 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ ISC License -Copyright (c) 2019, acidvegas +Copyright (c) 2021, acidvegas Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/README.md b/README.md index e59e62a..b3c851b 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,24 @@ This repository originally started off as a means of using Python to learn music It is still a work in progress, so some functions and features may not work as excepted or at all. Would love some collaboration on this project! +## Notes +A chromatic scale is comprised of all the semitones between an octave: + A A# B C C# D D# E F F# G G# + +Using the root of C, we can apply the pattern of the major scale to the C chromatic scale: + C C# D D# E F F# G G# A A# B C + + C D E F G A B C + W W H W W W H + ## Todo * Dynamic table sizing based on item/key lengths * Finish chord generation * Color support for windows -* Scale/chord ASCII coloring \ No newline at end of file +* Scale/chord ASCII coloring + +## Mirrors +- [acid.vegas](https://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-37.pyc b/mzk/__pycache__/constants.cpython-37.pyc deleted file mode 100644 index e081a07795771c5e4f364976c60c87ba3355d0c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2215 zcmaJ>-EQMV6pkIoag!#L?Uuh?AW(ibENmJlZFdDi^k2Cssz9o$K`3&4CW#l@Q+b@Q z&6}*$7vQ4s5&t4P@Q-lv z>mh<4@X!Co0Scr58t70214lC*Eb18JAxVP;pP zeFxr^_C0uC+7IB7w2$FKX+MIGrES0`(tdhTCpxT>B78;+_?(pB3-}VAKoh=#r|>m= z1J9s^;~KQV#!Lsgunrrrd9h4Pc>Z&t`C?ow77C4fuE2T8qDtkSEQWXHbNhF459Vnz ztT(U!yd&Fw^ZIgzgb*Wt-9gMrPL|uAFNB=YaIcU8yR&lkeBDhlrf<(a%s7D;vM9r+ z6}4Y`O0T2L{M5Pl0A&#)OPH;!HqQz>m~}Gj&Nb8h|K1zjY@u6oywh2KsCu}bZf|yb zuEU5Z*0o@+35>6c_~yJ$qk*Bz7A9}+U@p5M7&y!`b}^oFZrJU6n>!Fv`!}U_Zuc~+ zhUv>``OzU4lb9#n%pNf=+6vNGB~xaMVpr1XKNK7vJsmw5+1* zsU<RX!}!rAJM^7KUfvi z9?^R}QtaWN_l^_onCQpoAER&JAfhLUc0%+MjGpv*O_P-HygZjw_!t+Ua5GtbR`MvZM(TlEXNBMex_Z^`fESoiP>vzVSbh3^zdl diff --git a/mzk/constants.py b/mzk/constants.py index 5a418db..3cac9c0 100644 --- a/mzk/constants.py +++ b/mzk/constants.py @@ -1,7 +1,25 @@ #!/usr/bin/env python -# mzk music theory helper - developed by acidvegas in python (https://acid.vegas/mzk) +# mzk music theory helper - developed by acidvegas in python (https://git.acid.vegas/mzk) # constants.py +chords = { + 'major' : {'symbol':'', 'pattern':'1 3 5'}, + 'minor' : {'symbol':'m', 'pattern':'1 b3 5'}, + '7th' : {'symbol':'7', 'pattern':'1 3 5 b7'}, + 'minor_7th' : {'symbol':'m7', 'pattern':'1 b3 5 b7'}, + 'major_7th' : {'symbol':'maj7', 'pattern':'1 3 5 7'}, + 'minor_7th_flat_5th' : {'symbol':'m7b5', 'pattern':'1 b3 b5 b7'}, + 'suspended_4th' : {'symbol':'sus4', 'pattern':'1 4 5'}, + 'diminished' : {'symbol':'dim', 'pattern':'1 b3 b5'}, + 'augmented' : {'symbol':'aug', 'pattern':'1 3 #5'}, + '6th' : {'symbol':'6', 'pattern':'1 3 5 6'}, + 'minor_6th' : {'symbol':'m6', 'pattern':'1 b3 5 6'}, + 'minor_6th_add_9th' : {'symbol':'6add9', 'pattern':'1 3 5 6 9'}, + '9th' : {'symbol':'9', 'pattern':'1 3 5 b7 9'}, + 'minor_9th' : {'symbol':'m9', 'pattern':'1 b3 5 b7 9'}, + 'major_9th' : {'symbol':'maj9', 'pattern':'1 3 5 7 9'} +} + circle = ''' major C @@ -62,10 +80,10 @@ intervals = { 'major_sixth' : {'semitones':9, 'short_name':'M6'}, 'minor_seventh' : {'semitones':10, 'short_name':'m7'}, 'major_seventh' : {'semitones':11, 'short_name':'M7'}, - 'perfect_octave' : {'semitones':12, 'short_name':'8va'} + 'perfect_octave' : {'semitones':12, 'short_name':'P8'} } -notes = ('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#') +notes = ('A', 'A#', 'B', 'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#') # Chromatic scale numerals = ('I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII') scale_degrees = ('tonic','supertonic','mediant','subdominant','dominant''submediant','subtonic') @@ -73,7 +91,6 @@ scales = { 'algerian' : '2131131', 'aeolian' : '2122122', 'blues' : '321132', - 'chromatic' : '1111111', 'dorian' : '2122212', 'half_whole_diminished' : '12121212', 'harmonic_minor' : '2122131', @@ -89,4 +106,4 @@ scales = { 'phrygian' : '1222122', 'whole_half_diminished' : '21212121', 'whole_tone' : '2222222' -} \ No newline at end of file +} diff --git a/mzk/functions.py b/mzk/functions.py index 8ab115c..58e8c24 100644 --- a/mzk/functions.py +++ b/mzk/functions.py @@ -1,17 +1,17 @@ #!/usr/bin/env python -# mzk music theory helper - developed by acidvegas in python (https://acid.vegas/mzk) +# mzk music theory helper - developed by acidvegas in python (https://git.acid.vegas/mzk) # functions.py import constants -def generate_notes(key): - notes = ['A','A#','B','C','C#','D','D#','E','F','F#','G','G#'] +def chromatic_scale(key): + notes = list(constants.notes) while notes[0] != key: notes.append(notes.pop(0)) return notes -def generate_scale(string, scale_notes, full=False): - notes = generate_notes(string.upper())*2 if full else generate_notes(string.upper()) +def generate_scale_string(string, scale_notes, full=False): + notes = chromatic_scale(string.upper())*2 if full else chromatic_scale(string.upper()) notes.append(notes[0]) for index,note in enumerate(notes): if note in scale_notes: @@ -28,18 +28,16 @@ def get_pattern(pattern): elif step == '3' : new_pattern.append('WH') return ' '.join(new_pattern) -def scale(type, key): +def scale_notes(type, key): last = 0 - notes = generate_notes(key) - scale_notes = [notes[0],] + all_notes = chromatic_scale(key)*2 + scale_notes = [all_notes[0],] for step in constants.scales[type]: last += int(step) - if last >= len(notes): - last -= len(notes) - scale_notes.append(notes[last]) + scale_notes.append(all_notes[last]) return scale_notes -def print_chord(): +def print_chord(root, type): # todo: finish this print('◯ ⬤ ') print('''╳ ╳ ╳ ╳ ╳ ╳ @@ -55,6 +53,20 @@ def print_chord(): │ │ │ │ │ │ └───┴───┴───┴───┴───┘ E A D G B e''') + print('''╳ ◯ ◯ +┌───┬───┬───┬───┬───┐ +│ │ │ │ │ │ +├───┼───┼───┼───⬤───┤ +│ │ │ │ │ │ +├───┼───⬤───┼───┼───┤ +│ │ │ │ │ │ +├───⬤───┼───┼───┼───┤ +│ │ │ │ │ │ +├───┼───┼───┼───┼───┤ +│ │ │ │ │ │ +└───┴───┴───┴───┴───┘ +E A D G B e''') + def print_circle_of_fifths(): '''definition: @@ -125,15 +137,14 @@ def print_intervals(): for interval, info in constants.intervals.items(): print('│ {0} │ {1} │ {2} │'.format(str(info['semitones']).rjust(9), interval.ljust(14), info['short_name'].ljust(5))) print('└───────────┴────────────────┴───────┘') - - print('C O M P O U N D I N T E R V A L S'.center(42)) + print('\nC O M P O U N D I N T E R V A L S'.center(42)) print('┌───────────┬────────────────────┬───────┐') print('│ semitones │ quality │ short │') print('├───────────┼────────────────────┼───────┤') for interval, info in constants.compound_intervals.items(): print('│ {0} │ {1} │ {2} │'.format(str(info['semitones']).rjust(9), interval.ljust(18), info['short_name'].ljust(5))) print('└───────────┴────────────────────┴───────┘') - print(trim(print_intervals.__doc__)) + print(print_intervals.__doc__) def print_scale(root, type, full=False): frets = (24,147) if full else (12,75) @@ -141,12 +152,12 @@ def print_scale(root, type, full=False): 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])) + '┤') - scale_notes = scale(type, root) + notes = scale_notes(type, root) for string in ('eBGDAE'): - string_notes = generate_scale(string, scale_notes, full) + string_notes = generate_scale_string(string, notes, full) print(string + ' │' + '│'.join(note.center(5, '-') for note in string_notes[1:]) + '│') print(' └' + '┴'.join('─'*5 for x in range(frets[0])) + '┘') - print((', '.join(scale_notes) + ' / ' + get_pattern(constants.scales[type])).rjust(frets[1])) + print((', '.join(notes) + ' / ' + get_pattern(constants.scales[type])).rjust(frets[1])) def print_scales(): '''definition: diff --git a/mzk/main.py b/mzk/main.py index 4a4e9f7..5da4d57 100644 --- a/mzk/main.py +++ b/mzk/main.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# mzk music theory helper - developed by acidvegas in python (https://acid.vegas/mzk) +# mzk music theory helper - developed by acidvegas in python (https://git.acid.vegas/mzk) # main.py import sys