Browse Source

added unix-like transforming functions and stripped alpha of the chordifyer

Noah 4 years ago
parent
commit
2db7a9ba14
7 changed files with 117 additions and 1 deletions
  1. 53 0
      src/chordify
  2. 13 0
      src/double
  3. 1 1
      src/gizmo_transforming_functions.py
  4. 13 0
      src/half
  5. 18 0
      src/higher-octave
  6. 18 0
      src/lower-octave
  7. 1 0
      tests/onlyc

+ 53 - 0
src/chordify

@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+
+# program to chordify all notes
+
+# TODO: This program is not yet finished, this is a very early stage alpha
+# with all non-working parts removed
+
+# import needed gizmo funtions
+from gizmo_funtions import *
+from gizmo_transforming_functions import *
+
+# read from standard input
+stdin_list = stdin()
+
+# function that returns the major triads of a list
+def major_triad(input_list):
+    output_list = []
+    for i in stdin_list:
+        output_list.append(highes_note(i, 0))
+        output_list.append(highes_note(i, 4))
+        output_list.append(highes_note(i, 7))
+    return output_list
+
+# function that returns the minor triads of a list
+def minor_triad(input_list):
+    output_list = []
+    for i in stdin_list:
+        output_list.append(highes_note(i, 0))
+        output_list.append(highes_note(i, 3))
+        output_list.append(highes_note(i, 7))
+    return output_list
+
+# function that returns the augmented triads of a list
+def augmented_triad(input_list):
+    output_list = []
+    for i in stdin_list:
+        output_list.append(highes_note(i, 0))
+        output_list.append(highes_note(i, 4))
+        output_list.append(highes_note(i, 8))
+    return output_list
+
+# function that returns the diminished triads of a list
+def diminished_triad(input_list):
+    output_list = []
+    for i in stdin_list:
+        output_list.append(highes_note(i, 0))
+        output_list.append(highes_note(i, 3))
+        output_list.append(highes_note(i, 6))
+    return output_list
+
+gizmo_stdout(augmented_triad(stdin_list))
+# write to standard output
+#gizmo_stdout(stdin_list)

+ 13 - 0
src/double

@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+# doubles the tempo of all notes
+
+# import needed gizmo funtions
+from gizmo_funtions import gizmo_stdout, stdin
+from gizmo_transforming_functions import vergrösserung
+
+# read from standard input
+stdin_list = stdin()
+
+# write to standard output
+gizmo_stdout(vergrösserung(stdin_list))

+ 1 - 1
src/gizmo_transforming_functions.py

@@ -46,7 +46,7 @@ def interval(note_1, note_2):
     if note_1[1][1:2] == '-': pitch += 1
     if note_2[1][1:2] == '#': pitch += 1
     return pitch
-    
+
 """ actual functions """
 
 # changes tempo

+ 13 - 0
src/half

@@ -0,0 +1,13 @@
+#!/usr/bin/env python3
+
+# halfs the tempo of all notes
+
+# import needed gizmo funtions
+from gizmo_funtions import gizmo_stdout, stdin
+from gizmo_transforming_functions import verkleinerung
+
+# read from standard input
+stdin_list = stdin()
+
+# write to standard output
+gizmo_stdout(verkleinerung(stdin_list))

+ 18 - 0
src/higher-octave

@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+# highes the octave of all notes
+
+# import needed gizmo funtions
+from gizmo_funtions import gizmo_stdout, stdin
+from gizmo_transforming_functions import highes_note
+
+# read from standard input
+stdin_list = stdin()
+
+working_list = []
+
+for i in stdin_list:
+    working_list.append(highes_note(i, 12))
+
+# write to standard output
+gizmo_stdout(working_list)

+ 18 - 0
src/lower-octave

@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+# lowers the octave of all notes
+
+# import needed gizmo funtions
+from gizmo_funtions import gizmo_stdout, stdin
+from gizmo_transforming_functions import highes_note
+
+# read from standard input
+stdin_list = stdin()
+
+working_list = []
+
+for i in stdin_list:
+    working_list.append(highes_note(i, -12))
+
+# write to standard output
+gizmo_stdout(working_list)

+ 1 - 0
tests/onlyc

@@ -0,0 +1 @@
+1.00,C4