Firmware for HexBoard MIDI controller
Diffstat (limited to 'makePitches.py')
-rwxr-xr-xmakePitches.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/makePitches.py b/makePitches.py
new file mode 100755
index 0000000..7829e52
--- /dev/null
+++ b/makePitches.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+import sys
+
+pitches=128
+
+# calculate integer values in hertz for equal-temperament scales
+def makePitches(root, tones, offset):
+ a = []
+ for index in range(offset, pitches+offset):
+ a.append(round(root*(2**(index/tones))))
+ return a
+
+if __name__ == '__main__':
+ offset = 0
+ if len(sys.argv) > 3:
+ offset = int(sys.argv[3])
+ pitches = makePitches(float(sys.argv[1]), int(sys.argv[2]), offset)
+ print(pitches)