Spaces:
Running
Running
visakh7843
commited on
Commit
•
5a2d25b
1
Parent(s):
c8b9105
removed unwanted prints
Browse files
music.py
CHANGED
@@ -104,7 +104,6 @@ def music_gen(difficulty,time_Signature, Key_Signature):
|
|
104 |
last = index
|
105 |
elif "M:" in line:
|
106 |
#time signature
|
107 |
-
print(line)
|
108 |
if selected_timeSign == "4/4":
|
109 |
if "4/4" in line or "C|" in line:
|
110 |
accepted = True
|
@@ -112,11 +111,10 @@ def music_gen(difficulty,time_Signature, Key_Signature):
|
|
112 |
accepted = True
|
113 |
elif line.find("K:") and key_enforced:
|
114 |
#key signature
|
115 |
-
print(line)
|
116 |
if selected_keySign in line:
|
117 |
key_accepted = True
|
118 |
|
119 |
-
print("Training on {} songs...".format(len(corpus)))
|
120 |
|
121 |
# MARKOV PART
|
122 |
# n-gram length for markov model
|
@@ -142,10 +140,8 @@ def music_gen(difficulty,time_Signature, Key_Signature):
|
|
142 |
|
143 |
# choose a random song length from list of song lengths in corpus
|
144 |
lengthofsong = random.choice([len(x) for x in corpus if len(x) > 10])
|
145 |
-
print("Song length will be {}".format(lengthofsong))
|
146 |
song_len = [len(x) for x in corpus if len(x)>10]
|
147 |
song_len.sort()
|
148 |
-
print("Song lengths",song_len)
|
149 |
firstnote = markov.generate(model, n, max_iterations=3)[0]
|
150 |
# print "first note: {}".format(firstnote)
|
151 |
|
@@ -153,8 +149,6 @@ def music_gen(difficulty,time_Signature, Key_Signature):
|
|
153 |
song = writesong(lengthofsong, firstnote)
|
154 |
dob = datetime.datetime.now().strftime('%H%M%S')
|
155 |
|
156 |
-
print(dob)
|
157 |
-
print(song)
|
158 |
modifier = format(dob)
|
159 |
path = "gen_songs_abc/song_"+modifier
|
160 |
# make song file
|
@@ -180,7 +174,6 @@ def music_gen(difficulty,time_Signature, Key_Signature):
|
|
180 |
|
181 |
|
182 |
newsong = open(os.path.abspath(songname), 'w')
|
183 |
-
print(songname)
|
184 |
newsong.writelines(songbeginning)
|
185 |
for i in range(lastpart):
|
186 |
newsong.write(" | ".join(song[i:i+numOfnotes]) + "\n")
|
|
|
104 |
last = index
|
105 |
elif "M:" in line:
|
106 |
#time signature
|
|
|
107 |
if selected_timeSign == "4/4":
|
108 |
if "4/4" in line or "C|" in line:
|
109 |
accepted = True
|
|
|
111 |
accepted = True
|
112 |
elif line.find("K:") and key_enforced:
|
113 |
#key signature
|
|
|
114 |
if selected_keySign in line:
|
115 |
key_accepted = True
|
116 |
|
117 |
+
# print("Training on {} songs...".format(len(corpus)))
|
118 |
|
119 |
# MARKOV PART
|
120 |
# n-gram length for markov model
|
|
|
140 |
|
141 |
# choose a random song length from list of song lengths in corpus
|
142 |
lengthofsong = random.choice([len(x) for x in corpus if len(x) > 10])
|
|
|
143 |
song_len = [len(x) for x in corpus if len(x)>10]
|
144 |
song_len.sort()
|
|
|
145 |
firstnote = markov.generate(model, n, max_iterations=3)[0]
|
146 |
# print "first note: {}".format(firstnote)
|
147 |
|
|
|
149 |
song = writesong(lengthofsong, firstnote)
|
150 |
dob = datetime.datetime.now().strftime('%H%M%S')
|
151 |
|
|
|
|
|
152 |
modifier = format(dob)
|
153 |
path = "gen_songs_abc/song_"+modifier
|
154 |
# make song file
|
|
|
174 |
|
175 |
|
176 |
newsong = open(os.path.abspath(songname), 'w')
|
|
|
177 |
newsong.writelines(songbeginning)
|
178 |
for i in range(lastpart):
|
179 |
newsong.write(" | ".join(song[i:i+numOfnotes]) + "\n")
|