Skip to content

Instantly share code, notes, and snippets.

@LukeberryPi
Created October 22, 2023 23:01
Show Gist options
  • Save LukeberryPi/7b7029c40fcbd3b438740c4d0c976ece to your computer and use it in GitHub Desktop.
Save LukeberryPi/7b7029c40fcbd3b438740c4d0c976ece to your computer and use it in GitHub Desktop.
a python program to select chords in a harmonic field
import random as rd
random = rd
tom = ['A','B','C','D','E','F','G']
number_chords = [3,4,5]
tom_a = ['A','Bm','C#m','D','E','F#m']
tom_b = ['B','C#m','D#m','E','F#','G#m']
tom_c = ['C','Dm','Em','F','G','Am']
tom_d = ['D','Em','F#m','G','A','Bm']
tom_e = ['E','F#m','G#m','A','B','C#m']
tom_f = ['F','Gm','Am','Bb','C','Dm']
tom_g = ['G','Am','Bm','C','D','Em']
tom_escolhido = random.choice(tom)
print('Tom: ',tom_escolhido)
if tom_escolhido == 'A':
print(random.choices(tom_a,k=random.choice(number_chords)))
if tom_escolhido == 'B':
print(random.choices(tom_b,k=random.choice(number_chords)))
if tom_escolhido == 'C':
print(random.choices(tom_c,k=random.choice(number_chords)))
if tom_escolhido == 'D':
print(random.choices(tom_d,k=random.choice(number_chords)))
if tom_escolhido == 'E':
print(random.choices(tom_e,k=random.choice(number_chords)))
if tom_escolhido == 'F':
print(random.choices(tom_f,k=random.choice(number_chords)))
if tom_escolhido == 'G':
print(random.choices(tom_g,k=random.choice(number_chords)))
print('BPM: ',random.randint(85,135))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment