Skip to content

Instantly share code, notes, and snippets.

@drsm79
Last active May 14, 2018 22:30
Show Gist options
  • Save drsm79/b351d171e600dea0f428dfc42e028d38 to your computer and use it in GitHub Desktop.
Save drsm79/b351d171e600dea0f428dfc42e028d38 to your computer and use it in GitHub Desktop.
Fibonacci to chord sequence
def fib_next(current, previous):
return current + previous, current, int(oct(current + previous).strip('L')[-1])
scale = ['F', 'g', 'a', 'Bb', 'C', 'd', 'em7b5', 'F']
def runme(iterations=False):
pattern = [0, 1]
previous, current = pattern
n = 0
while len(pattern) < 5 or (pattern[:4] != pattern[-4:]):
current, previous, pelem = fib_next(current, previous)
print current, previous, pelem, scale[pelem]
pattern.append(pelem)
n += 1
if iterations and n > iterations:
break
printable_pattern = []
for p in pattern:
printable_pattern.append(scale[p])
print ' '.join(printable_pattern)
print n
@drsm79
Copy link
Author

drsm79 commented May 14, 2018

F g g a Bb d F d d a F g F g g a - sounds quite nice as it goes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment