asigalov61 commited on
Commit
9fce27b
·
verified ·
1 Parent(s): 0702bd5

Upload TMIDIX.py

Browse files
Files changed (1) hide show
  1. TMIDIX.py +11 -15
TMIDIX.py CHANGED
@@ -9599,27 +9599,23 @@ def escore_notes_to_text_description(escore_notes, song_name='', artist_name='')
9599
 
9600
  pitches = [e[4] for e in escore_notes if e[3] != 9]
9601
 
9602
- key = -1
9603
-
9604
  if pitches:
9605
  key = SEMITONES[statistics.mode(pitches) % 12]
9606
 
9607
  #==============================================================================
9608
-
9609
- cscore = chordify_score([1000, escore_notes])
9610
-
9611
- tones_chords = Counter()
9612
-
9613
- for c in cscore:
9614
- if len([e for e in c if e[3] != 9]) > 0:
9615
- tones_chords[tuple(sorted(set([e[4] % 12 for e in c if e[3] != 9])))] += 1
9616
-
9617
- mood = 'Major'
9618
-
9619
- most_common_tones_chords = [check_and_fix_tones_chord(list(c[0])) for c in tones_chords.most_common(10)]
9620
 
9621
- if most_common_tones_chords:
 
 
 
 
9622
 
 
 
 
 
 
 
9623
  mood_scale = statistics.mode(tones_chords_to_types(most_common_tones_chords, return_chord_type_index=True)) % 3
9624
 
9625
  mood = MOOD_SCALES[mood_scale]
 
9599
 
9600
  pitches = [e[4] for e in escore_notes if e[3] != 9]
9601
 
 
 
9602
  if pitches:
9603
  key = SEMITONES[statistics.mode(pitches) % 12]
9604
 
9605
  #==============================================================================
 
 
 
 
 
 
 
 
 
 
 
 
9606
 
9607
+ if pitches:
9608
+
9609
+ cscore = chordify_score([1000, escore_notes])
9610
+
9611
+ tones_chords = Counter()
9612
 
9613
+ for c in cscore:
9614
+ if len([e for e in c if e[3] != 9]) > 0:
9615
+ tones_chords[tuple(sorted(set([e[4] % 12 for e in c if e[3] != 9])))] += 1
9616
+
9617
+ most_common_tones_chords = [check_and_fix_tones_chord(list(c[0])) for c in tones_chords.most_common(10)]
9618
+
9619
  mood_scale = statistics.mode(tones_chords_to_types(most_common_tones_chords, return_chord_type_index=True)) % 3
9620
 
9621
  mood = MOOD_SCALES[mood_scale]