about summary refs log tree commit diff
path: root/makePitches.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2023-09-18 10:57:23 -0400
committerZach DeCook <zachdecook@librem.one>2023-09-18 10:57:23 -0400
commitaec787a79191085f04c1c7ef83dabf152709487d (patch)
tree55b140b59d4855cb2dc707a35699e1294497c92e /makePitches.py
parent0e39f9ce1641e9b5d9118c97b6118c8a6b555e6f (diff)
downloadHexBoard-aec787a79191085f04c1c7ef83dabf152709487d.tar.gz
Microtones: Add 31-TET, and add script for calculating pitches in hertz
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)