Updated git url & added mirrors

This commit is contained in:
Dionysus 2023-05-08 23:59:37 -04:00
parent e9326b22d9
commit 703aacb1d5
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
6 changed files with 70 additions and 26 deletions

View File

@ -1,6 +1,6 @@
ISC License ISC License
Copyright (c) 2019, acidvegas <acid.vegas@acid.vegas> Copyright (c) 2021, acidvegas <acid.vegas@acid.vegas>
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above purpose with or without fee is hereby granted, provided that the above

View File

@ -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! 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 ## Todo
* Dynamic table sizing based on item/key lengths * Dynamic table sizing based on item/key lengths
* Finish chord generation * Finish chord generation
* Color support for windows * Color support for windows
* Scale/chord ASCII coloring * 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)

View File

@ -1,7 +1,25 @@
#!/usr/bin/env python #!/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 # 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 circle = ''' major
C C
@ -62,10 +80,10 @@ intervals = {
'major_sixth' : {'semitones':9, 'short_name':'M6'}, 'major_sixth' : {'semitones':9, 'short_name':'M6'},
'minor_seventh' : {'semitones':10, 'short_name':'m7'}, 'minor_seventh' : {'semitones':10, 'short_name':'m7'},
'major_seventh' : {'semitones':11, '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') numerals = ('I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII')
scale_degrees = ('tonic','supertonic','mediant','subdominant','dominant''submediant','subtonic') scale_degrees = ('tonic','supertonic','mediant','subdominant','dominant''submediant','subtonic')
@ -73,7 +91,6 @@ scales = {
'algerian' : '2131131', 'algerian' : '2131131',
'aeolian' : '2122122', 'aeolian' : '2122122',
'blues' : '321132', 'blues' : '321132',
'chromatic' : '1111111',
'dorian' : '2122212', 'dorian' : '2122212',
'half_whole_diminished' : '12121212', 'half_whole_diminished' : '12121212',
'harmonic_minor' : '2122131', 'harmonic_minor' : '2122131',
@ -89,4 +106,4 @@ scales = {
'phrygian' : '1222122', 'phrygian' : '1222122',
'whole_half_diminished' : '21212121', 'whole_half_diminished' : '21212121',
'whole_tone' : '2222222' 'whole_tone' : '2222222'
} }

View File

@ -1,17 +1,17 @@
#!/usr/bin/env python #!/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 # functions.py
import constants import constants
def generate_notes(key): def chromatic_scale(key):
notes = ['A','A#','B','C','C#','D','D#','E','F','F#','G','G#'] notes = list(constants.notes)
while notes[0] != key: while notes[0] != key:
notes.append(notes.pop(0)) notes.append(notes.pop(0))
return notes return notes
def generate_scale(string, scale_notes, full=False): def generate_scale_string(string, scale_notes, full=False):
notes = generate_notes(string.upper())*2 if full else generate_notes(string.upper()) notes = chromatic_scale(string.upper())*2 if full else chromatic_scale(string.upper())
notes.append(notes[0]) notes.append(notes[0])
for index,note in enumerate(notes): for index,note in enumerate(notes):
if note in scale_notes: if note in scale_notes:
@ -28,18 +28,16 @@ def get_pattern(pattern):
elif step == '3' : new_pattern.append('WH') elif step == '3' : new_pattern.append('WH')
return ' '.join(new_pattern) return ' '.join(new_pattern)
def scale(type, key): def scale_notes(type, key):
last = 0 last = 0
notes = generate_notes(key) all_notes = chromatic_scale(key)*2
scale_notes = [notes[0],] scale_notes = [all_notes[0],]
for step in constants.scales[type]: for step in constants.scales[type]:
last += int(step) last += int(step)
if last >= len(notes): scale_notes.append(all_notes[last])
last -= len(notes)
scale_notes.append(notes[last])
return scale_notes return scale_notes
def print_chord(): def print_chord(root, type):
# todo: finish this # todo: finish this
print('◯ ⬤ ') print('◯ ⬤ ')
print(''' print('''
@ -55,6 +53,20 @@ def print_chord():
E A D G B e''') E A D G B e''')
print(''' ◯ ◯
E A D G B e''')
def print_circle_of_fifths(): def print_circle_of_fifths():
'''definition: '''definition:
@ -125,15 +137,14 @@ def print_intervals():
for interval, info in constants.intervals.items(): 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('{0}{1}{2}'.format(str(info['semitones']).rjust(9), interval.ljust(14), info['short_name'].ljust(5)))
print('└───────────┴────────────────┴───────┘') print('└───────────┴────────────────┴───────┘')
print('\nC O M P O U N D I N T E R V A L S'.center(42))
print('C O M P O U N D I N T E R V A L S'.center(42))
print('┌───────────┬────────────────────┬───────┐') print('┌───────────┬────────────────────┬───────┐')
print('│ semitones │ quality │ short │') print('│ semitones │ quality │ short │')
print('├───────────┼────────────────────┼───────┤') print('├───────────┼────────────────────┼───────┤')
for interval, info in constants.compound_intervals.items(): 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('{0}{1}{2}'.format(str(info['semitones']).rjust(9), interval.ljust(18), info['short_name'].ljust(5)))
print('└───────────┴────────────────────┴───────┘') print('└───────────┴────────────────────┴───────┘')
print(trim(print_intervals.__doc__)) print(print_intervals.__doc__)
def print_scale(root, type, full=False): def print_scale(root, type, full=False):
frets = (24,147) if full else (12,75) 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('' + ''.join(''*5 for x in range(frets[0])) + '')
print('0 │' + ''.join(str(x).center(5) for x in range(1,frets[0]+1)) + '') print('0 │' + ''.join(str(x).center(5) for x in range(1,frets[0]+1)) + '')
print('' + ''.join(''*5 for x in range(frets[0])) + '') print('' + ''.join(''*5 for x in range(frets[0])) + '')
scale_notes = scale(type, root) notes = scale_notes(type, root)
for string in ('eBGDAE'): 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(string + '' + ''.join(note.center(5, '-') for note in string_notes[1:]) + '')
print('' + ''.join(''*5 for x in range(frets[0])) + '') 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(): def print_scales():
'''definition: '''definition:

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/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 # main.py
import sys import sys