Spaces:
Running
Running
Upload TMIDIX.py
Browse files
TMIDIX.py
CHANGED
@@ -9625,44 +9625,46 @@ def escore_notes_to_text_description(escore_notes, song_name='', artist_name='')
|
|
9625 |
mood = MOOD_SCALES[mood_scale]
|
9626 |
|
9627 |
#==============================================================================
|
9628 |
-
|
9629 |
-
escore_averages = escore_notes_averages(escore_notes, return_ptcs_and_vels=True)
|
9630 |
-
|
9631 |
-
if escore_averages[0] < 8:
|
9632 |
-
rythm = 'fast'
|
9633 |
-
|
9634 |
-
elif 8 <= escore_averages[0] <= 12:
|
9635 |
-
rythm = 'average'
|
9636 |
-
|
9637 |
-
elif escore_averages[0] > 12:
|
9638 |
-
rythm = 'slow'
|
9639 |
-
|
9640 |
-
if escore_averages[1] < 16:
|
9641 |
-
tempo = 'fast'
|
9642 |
-
|
9643 |
-
elif 16 <= escore_averages[1] <= 24:
|
9644 |
-
tempo = 'average'
|
9645 |
-
|
9646 |
-
elif escore_averages[1] > 24:
|
9647 |
-
tempo = 'slow'
|
9648 |
-
|
9649 |
-
if escore_averages[2] < 50:
|
9650 |
-
tone = 'bass'
|
9651 |
-
|
9652 |
-
elif 50 <= escore_averages[2] <= 70:
|
9653 |
-
tone = 'midrange'
|
9654 |
|
9655 |
-
|
9656 |
-
tone = 'treble'
|
9657 |
-
|
9658 |
-
if escore_averages[3] < 80:
|
9659 |
-
dynamics = 'quiet'
|
9660 |
-
|
9661 |
-
elif 80 <= escore_averages[3] <= 100:
|
9662 |
-
dynamics = 'average'
|
9663 |
|
9664 |
-
|
9665 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9666 |
|
9667 |
#==============================================================================
|
9668 |
|
@@ -9704,26 +9706,28 @@ def escore_notes_to_text_description(escore_notes, song_name='', artist_name='')
|
|
9704 |
description += '.'
|
9705 |
|
9706 |
description += '\n'
|
9707 |
-
|
9708 |
-
description += 'It has '
|
9709 |
|
9710 |
-
|
9711 |
-
description += tempo + ' tempo, '
|
9712 |
-
description += tone + ' tone and '
|
9713 |
-
description += dynamics + ' dynamics.'
|
9714 |
|
9715 |
-
|
|
|
|
|
|
|
|
|
|
|
9716 |
|
9717 |
-
|
9718 |
|
9719 |
-
|
9720 |
-
description += 'is played on a solo ' + instruments[0] + '.'
|
9721 |
|
9722 |
-
|
9723 |
-
|
9724 |
-
description += ', '.join(instruments[:-1]) + ' and ' + instruments[-1] + '.'
|
9725 |
|
9726 |
-
|
|
|
|
|
|
|
|
|
9727 |
|
9728 |
if drums_present:
|
9729 |
description += 'The drum track has predominant '
|
|
|
9625 |
mood = MOOD_SCALES[mood_scale]
|
9626 |
|
9627 |
#==============================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9628 |
|
9629 |
+
if pitches:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9630 |
|
9631 |
+
escore_averages = escore_notes_averages(escore_notes, return_ptcs_and_vels=True)
|
9632 |
+
|
9633 |
+
if escore_averages[0] < 8:
|
9634 |
+
rythm = 'fast'
|
9635 |
+
|
9636 |
+
elif 8 <= escore_averages[0] <= 12:
|
9637 |
+
rythm = 'average'
|
9638 |
+
|
9639 |
+
elif escore_averages[0] > 12:
|
9640 |
+
rythm = 'slow'
|
9641 |
+
|
9642 |
+
if escore_averages[1] < 16:
|
9643 |
+
tempo = 'fast'
|
9644 |
+
|
9645 |
+
elif 16 <= escore_averages[1] <= 24:
|
9646 |
+
tempo = 'average'
|
9647 |
+
|
9648 |
+
elif escore_averages[1] > 24:
|
9649 |
+
tempo = 'slow'
|
9650 |
+
|
9651 |
+
if escore_averages[2] < 50:
|
9652 |
+
tone = 'bass'
|
9653 |
+
|
9654 |
+
elif 50 <= escore_averages[2] <= 70:
|
9655 |
+
tone = 'midrange'
|
9656 |
+
|
9657 |
+
elif escore_averages[2] > 70:
|
9658 |
+
tone = 'treble'
|
9659 |
+
|
9660 |
+
if escore_averages[3] < 80:
|
9661 |
+
dynamics = 'quiet'
|
9662 |
+
|
9663 |
+
elif 80 <= escore_averages[3] <= 100:
|
9664 |
+
dynamics = 'average'
|
9665 |
+
|
9666 |
+
elif escore_averages[3] > 100:
|
9667 |
+
dynamics = 'loud'
|
9668 |
|
9669 |
#==============================================================================
|
9670 |
|
|
|
9706 |
description += '.'
|
9707 |
|
9708 |
description += '\n'
|
|
|
|
|
9709 |
|
9710 |
+
if pitches:
|
|
|
|
|
|
|
9711 |
|
9712 |
+
description += 'It has '
|
9713 |
+
|
9714 |
+
description += rythm + ' rythm, '
|
9715 |
+
description += tempo + ' tempo, '
|
9716 |
+
description += tone + ' tone and '
|
9717 |
+
description += dynamics + ' dynamics.'
|
9718 |
|
9719 |
+
description += '\n'
|
9720 |
|
9721 |
+
description += 'The song '
|
|
|
9722 |
|
9723 |
+
if len(instruments) == 1:
|
9724 |
+
description += 'is played on a solo ' + instruments[0] + '.'
|
|
|
9725 |
|
9726 |
+
else:
|
9727 |
+
description += 'features ' + NUMERALS[len(instruments)-1] + ' instruments: '
|
9728 |
+
description += ', '.join(instruments[:-1]) + ' and ' + instruments[-1] + '.'
|
9729 |
+
|
9730 |
+
description += '\n'
|
9731 |
|
9732 |
if drums_present:
|
9733 |
description += 'The drum track has predominant '
|