Spaces:
Runtime error
Runtime error
loop
Browse files
app.py
CHANGED
|
@@ -65,9 +65,11 @@ def convert_table_to_audio(markdown_table, resolution=8, bpm = 120.0):
|
|
| 65 |
pm.instruments.append(pm_inst)
|
| 66 |
|
| 67 |
note_length = (60. / bpm) * (4.0 / resolution) # note duration
|
| 68 |
-
|
|
|
|
| 69 |
for i in range(len(rhythm_pattern)):
|
| 70 |
for j in range(1, len(rhythm_pattern[i])):
|
|
|
|
| 71 |
inst = rhythm_pattern[i][0].strip().upper()
|
| 72 |
velocity = 0
|
| 73 |
if 'x' == rhythm_pattern[i][j].strip():
|
|
@@ -84,7 +86,7 @@ def convert_table_to_audio(markdown_table, resolution=8, bpm = 120.0):
|
|
| 84 |
audio_data = pm.fluidsynth()
|
| 85 |
|
| 86 |
# cut off the reverb section
|
| 87 |
-
audio_data = audio_data[:int(SR*note_length*
|
| 88 |
return audio_data
|
| 89 |
|
| 90 |
def get_answer(question):
|
|
|
|
| 65 |
pm.instruments.append(pm_inst)
|
| 66 |
|
| 67 |
note_length = (60. / bpm) * (4.0 / resolution) # note duration
|
| 68 |
+
|
| 69 |
+
beat_num = resolution
|
| 70 |
for i in range(len(rhythm_pattern)):
|
| 71 |
for j in range(1, len(rhythm_pattern[i])):
|
| 72 |
+
beat_num = j # for looping
|
| 73 |
inst = rhythm_pattern[i][0].strip().upper()
|
| 74 |
velocity = 0
|
| 75 |
if 'x' == rhythm_pattern[i][j].strip():
|
|
|
|
| 86 |
audio_data = pm.fluidsynth()
|
| 87 |
|
| 88 |
# cut off the reverb section
|
| 89 |
+
audio_data = audio_data[:int(SR*note_length*beat_num)] # for looping, cut the tail
|
| 90 |
return audio_data
|
| 91 |
|
| 92 |
def get_answer(question):
|