Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
|
@@ -51,7 +51,7 @@ r'''############################################################################
|
|
| 51 |
|
| 52 |
###################################################################################
|
| 53 |
|
| 54 |
-
__version__ = "26.4.
|
| 55 |
|
| 56 |
print('=' * 70)
|
| 57 |
print('TMIDIX Python module')
|
|
@@ -10076,12 +10076,12 @@ def escore_notes_to_text_description(escore_notes,
|
|
| 10076 |
|
| 10077 |
#==============================================================================
|
| 10078 |
|
| 10079 |
-
feat_dict['
|
| 10080 |
feat_dict['tempo'] = None
|
| 10081 |
feat_dict['tone'] = None
|
| 10082 |
feat_dict['dynamics'] = None
|
| 10083 |
|
| 10084 |
-
feat_dict_vals['
|
| 10085 |
feat_dict_vals['tempo'] = -1
|
| 10086 |
feat_dict_vals['tone'] = -1
|
| 10087 |
feat_dict_vals['dynamics'] = -1
|
|
@@ -10091,15 +10091,15 @@ def escore_notes_to_text_description(escore_notes,
|
|
| 10091 |
escore_averages = escore_notes_averages(escore_notes, return_ptcs_and_vels=True)
|
| 10092 |
|
| 10093 |
if escore_averages[0] < (128 / timings_divider):
|
| 10094 |
-
|
| 10095 |
ryv = 0
|
| 10096 |
|
| 10097 |
elif (128 / timings_divider) <= escore_averages[0] <= (192 / timings_divider):
|
| 10098 |
-
|
| 10099 |
ryv = 1
|
| 10100 |
|
| 10101 |
elif escore_averages[0] > (192 / timings_divider):
|
| 10102 |
-
|
| 10103 |
ryv = 2
|
| 10104 |
|
| 10105 |
if escore_averages[1] < (256 / timings_divider):
|
|
@@ -10138,12 +10138,12 @@ def escore_notes_to_text_description(escore_notes,
|
|
| 10138 |
dynamics = 'loud'
|
| 10139 |
dyn = 2
|
| 10140 |
|
| 10141 |
-
feat_dict['
|
| 10142 |
feat_dict['tempo'] = tempo.title()
|
| 10143 |
feat_dict['tone'] = tone.title()
|
| 10144 |
feat_dict['dynamics'] = dynamics.title()
|
| 10145 |
|
| 10146 |
-
feat_dict_vals['
|
| 10147 |
feat_dict_vals['tempo'] = tev
|
| 10148 |
feat_dict_vals['tone'] = tov
|
| 10149 |
feat_dict_vals['dynamics'] = dyn
|
|
@@ -10237,7 +10237,7 @@ def escore_notes_to_text_description(escore_notes,
|
|
| 10237 |
else:
|
| 10238 |
description += 'TThis drum track has '
|
| 10239 |
|
| 10240 |
-
description +=
|
| 10241 |
description += tempo + ' tempo, '
|
| 10242 |
description += tone + ' tone and '
|
| 10243 |
description += dynamics + ' dynamics.'
|
|
|
|
| 51 |
|
| 52 |
###################################################################################
|
| 53 |
|
| 54 |
+
__version__ = "26.4.19"
|
| 55 |
|
| 56 |
print('=' * 70)
|
| 57 |
print('TMIDIX Python module')
|
|
|
|
| 10076 |
|
| 10077 |
#==============================================================================
|
| 10078 |
|
| 10079 |
+
feat_dict['rhythm'] = None
|
| 10080 |
feat_dict['tempo'] = None
|
| 10081 |
feat_dict['tone'] = None
|
| 10082 |
feat_dict['dynamics'] = None
|
| 10083 |
|
| 10084 |
+
feat_dict_vals['rhythm'] = -1
|
| 10085 |
feat_dict_vals['tempo'] = -1
|
| 10086 |
feat_dict_vals['tone'] = -1
|
| 10087 |
feat_dict_vals['dynamics'] = -1
|
|
|
|
| 10091 |
escore_averages = escore_notes_averages(escore_notes, return_ptcs_and_vels=True)
|
| 10092 |
|
| 10093 |
if escore_averages[0] < (128 / timings_divider):
|
| 10094 |
+
rhythm = 'fast'
|
| 10095 |
ryv = 0
|
| 10096 |
|
| 10097 |
elif (128 / timings_divider) <= escore_averages[0] <= (192 / timings_divider):
|
| 10098 |
+
rhythm = 'average'
|
| 10099 |
ryv = 1
|
| 10100 |
|
| 10101 |
elif escore_averages[0] > (192 / timings_divider):
|
| 10102 |
+
rhythm = 'slow'
|
| 10103 |
ryv = 2
|
| 10104 |
|
| 10105 |
if escore_averages[1] < (256 / timings_divider):
|
|
|
|
| 10138 |
dynamics = 'loud'
|
| 10139 |
dyn = 2
|
| 10140 |
|
| 10141 |
+
feat_dict['rhythm'] = rhythm.title()
|
| 10142 |
feat_dict['tempo'] = tempo.title()
|
| 10143 |
feat_dict['tone'] = tone.title()
|
| 10144 |
feat_dict['dynamics'] = dynamics.title()
|
| 10145 |
|
| 10146 |
+
feat_dict_vals['rhythm'] = ryv
|
| 10147 |
feat_dict_vals['tempo'] = tev
|
| 10148 |
feat_dict_vals['tone'] = tov
|
| 10149 |
feat_dict_vals['dynamics'] = dyn
|
|
|
|
| 10237 |
else:
|
| 10238 |
description += 'TThis drum track has '
|
| 10239 |
|
| 10240 |
+
description += rhythm + ' rhythm, '
|
| 10241 |
description += tempo + ' tempo, '
|
| 10242 |
description += tone + ' tone and '
|
| 10243 |
description += dynamics + ' dynamics.'
|