Noah Vogt 4 years ago
parent
commit
dda7e63d87
3 changed files with 16 additions and 16 deletions
  1. 1 1
      src/final-converter
  2. 6 6
      src/motiv_gen
  3. 9 9
      src/thema-gen

+ 1 - 1
src/final-converter

@@ -7,7 +7,7 @@ import sys
 if sys.platform == 'linux':
 if sys.platform == 'linux':
     environment.set('musicxmlPath', '/usr/bin/musescore')
     environment.set('musicxmlPath', '/usr/bin/musescore')
 elif sys.platform == 'darwin':
 elif sys.platform == 'darwin':
-    environment.set('musicxmlPath', 'Applications/MuseScore 3.5.app/')
+    environment.set('musicxmlPath', '/Applications/MuseScore 3.5.app/')
 else:
 else:
     print("Error: Please Use a Unix-like Operating System or change the source code")
     print("Error: Please Use a Unix-like Operating System or change the source code")
     exit()
     exit()

+ 6 - 6
src/motiv_gen

@@ -12,8 +12,8 @@ notes_list = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
 def normal_int (mu):
 def normal_int (mu):
     return int(round(random.normalvariate(mu, 3),0))
     return int(round(random.normalvariate(mu, 3),0))
 
 
-"""return a random value by first deciding if it should be negativ or 
-positive and then using normal distribution with mu 2 or -2 respectivly. standart 
+"""return a random value by first deciding if it should be negativ or
+positive and then using normal distribution with mu 2 or -2 respectivly. standart
 deviation is always 3 and could be changed in normal_int"""
 deviation is always 3 and could be changed in normal_int"""
 
 
 def compute_note_sequenz_int():
 def compute_note_sequenz_int():
@@ -31,8 +31,8 @@ def compute_note_sequenz_int():
 def half_note_duration(note):
 def half_note_duration(note):
     return verkleinerung([note])[0]
     return verkleinerung([note])[0]
 
 
-""" This should produce a motiv which can be used for further processing. There are three 
-command line arguments to change result first length in quarter notes, second velocity and for the 
+""" This should produce a motiv which can be used for further processing. There are three
+command line arguments to change result first length in quarter notes, second velocity and for the
 third it can be inputed a starting note"""
 third it can be inputed a starting note"""
 
 
 # these are default values, TODO: write it in order to change them as commandline arguments 
 # these are default values, TODO: write it in order to change them as commandline arguments 
@@ -71,11 +71,11 @@ motiv = []
 # temporarly all notes have duration 1.00 or 2.00
 # temporarly all notes have duration 1.00 or 2.00
 i = 0
 i = 0
 while i < motiv_length_in_quarter_notes:
 while i < motiv_length_in_quarter_notes:
-    if (i != motiv_length_in_quarter_notes - 1 and random.randint(0,3) == 1): 
+    if (i != motiv_length_in_quarter_notes - 1 and random.randint(0,3) == 1):
         # ~ 1/3 probability for 2.00
         # ~ 1/3 probability for 2.00
         motiv.append('2.00,')
         motiv.append('2.00,')
         i += 1
         i += 1
-    else: 
+    else:
         motiv.append('1.00,')
         motiv.append('1.00,')
     i += 1
     i += 1
 
 

+ 9 - 9
src/thema-gen

@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+
 
 
 # import needed gizmo funtions
 # import needed gizmo funtions
 from gizmo_funtions import *
 from gizmo_funtions import *
@@ -65,7 +65,7 @@ final_list = ['1.00,D4','1.00,C3']
 
 
 while not(first_equals_last_pitch(final_list)):
 while not(first_equals_last_pitch(final_list)):
     working_list = function_list
     working_list = function_list
-    
+
     # adjust working_list to the entered number
     # adjust working_list to the entered number
     if number < len(working_list):
     if number < len(working_list):
         # if smaller, simply randomize + cut/strip it
         # if smaller, simply randomize + cut/strip it
@@ -74,21 +74,21 @@ while not(first_equals_last_pitch(final_list)):
     elif number > len(working_list):
     elif number > len(working_list):
         for i in range(number-len(working_list)):
         for i in range(number-len(working_list)):
             working_list.append(random.choice(working_list))
             working_list.append(random.choice(working_list))
-    
+
     # randomize the list
     # randomize the list
     random.shuffle(working_list)
     random.shuffle(working_list)
-    
+
     # OPTIONAL: add some post procession here
     # OPTIONAL: add some post procession here
-    
+
     # now run each item through a list
     # now run each item through a list
     for i in range(number):
     for i in range(number):
         exec("list%s = %s" % (str(i),str(working_list[i])))
         exec("list%s = %s" % (str(i),str(working_list[i])))
-    
+
     # append lists
     # append lists
     final_list = []
     final_list = []
     for i in range(number):
     for i in range(number):
         exec("final_list.extend(list%s)" % (str(i)))
         exec("final_list.extend(list%s)" % (str(i)))
-    
+
     """
     """
     DEBUG:
     DEBUG:
 
 
@@ -103,10 +103,10 @@ while not(first_equals_last_pitch(final_list)):
     print(unzip_string)
     print(unzip_string)
     exec("for %s in zip(*[iter(final_list)]*%s): print(%s)" % (unzip_string, str(len(motiv_list)), unzip_string))
     exec("for %s in zip(*[iter(final_list)]*%s): print(%s)" % (unzip_string, str(len(motiv_list)), unzip_string))
     print(motiv_list)
     print(motiv_list)
-    
+
     print(first_equals_last_pitch(final_list))
     print(first_equals_last_pitch(final_list))
     print(interval('1.00C4','1.00C4'))
     print(interval('1.00C4','1.00C4'))
     """
     """
-    
+
 # finally, write to standard output
 # finally, write to standard output
 gizmo_stdout(final_list)
 gizmo_stdout(final_list)