asigalov61 commited on
Commit
0ff99ed
·
verified ·
1 Parent(s): ebab7e4

Upload TMIDIX.py

Browse files
Files changed (1) hide show
  1. TMIDIX.py +70 -2
TMIDIX.py CHANGED
@@ -51,7 +51,7 @@ r'''############################################################################
51
 
52
  ###################################################################################
53
 
54
- __version__ = "25.9.19"
55
 
56
  print('=' * 70)
57
  print('TMIDIX Python module')
@@ -14900,7 +14900,7 @@ def add_smooth_melody_to_enhanced_score_notes(escore_notes,
14900
  melody_patch=40,
14901
  melody_start_chord=0,
14902
  min_notes_gap=0,
14903
- exclude_durs=[1, 2],
14904
  adv_flattening=True,
14905
  extend_durs=True,
14906
  max_mel_vels=127,
@@ -14959,6 +14959,74 @@ def add_smooth_melody_to_enhanced_score_notes(escore_notes,
14959
 
14960
  ###################################################################################
14961
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14962
  print('Module loaded!')
14963
  print('=' * 70)
14964
  print('Enjoy! :)')
 
51
 
52
  ###################################################################################
53
 
54
+ __version__ = "25.9.22"
55
 
56
  print('=' * 70)
57
  print('TMIDIX Python module')
 
14900
  melody_patch=40,
14901
  melody_start_chord=0,
14902
  min_notes_gap=0,
14903
+ exclude_durs=[1],
14904
  adv_flattening=True,
14905
  extend_durs=True,
14906
  max_mel_vels=127,
 
14959
 
14960
  ###################################################################################
14961
 
14962
+ def sorted_chords_to_full_chords(chords):
14963
+
14964
+ cchords = []
14965
+
14966
+ for c in chords:
14967
+ tones_chord = ALL_CHORDS_SORTED[c]
14968
+
14969
+ if tones_chord not in ALL_CHORDS_FULL:
14970
+ tones_chord = check_and_fix_tones_chord(tones_chord)
14971
+
14972
+ cchords.append(ALL_CHORDS_FULL.index(tones_chord))
14973
+
14974
+ return cchords
14975
+
14976
+ ###################################################################################
14977
+
14978
+ def full_chords_to_sorted_chords(chords):
14979
+
14980
+ cchords = []
14981
+
14982
+ for c in chords:
14983
+ tones_chord = ALL_CHORDS_FULL[c]
14984
+
14985
+ if tones_chord not in ALL_CHORDS_SORTED:
14986
+ tones_chord = check_and_fix_tones_chord(tones_chord, use_full_chords=False)
14987
+
14988
+ cchords.append(ALL_CHORDS_SORTED.index(tones_chord))
14989
+
14990
+ return cchords
14991
+
14992
+ ###################################################################################
14993
+
14994
+ def chords_to_escore_notes(chords,
14995
+ use_full_chords=False,
14996
+ chords_dtime=500,
14997
+ add_melody=True,
14998
+ add_texture=True,
14999
+ ):
15000
+
15001
+ if use_full_chords:
15002
+ CHORDS = ALL_CHORDS_FULL
15003
+
15004
+ else:
15005
+ CHORDS = ALL_CHORDS_SORTED
15006
+
15007
+ score = []
15008
+
15009
+ dtime = 0
15010
+
15011
+ dur = chords_dtime
15012
+
15013
+ for c in chords:
15014
+
15015
+ if add_melody:
15016
+ score.append(['note', dtime, dur, 3, CHORDS[c][0]+72, 115+CHORDS[c][0], 40])
15017
+
15018
+ for cc in CHORDS[c]:
15019
+ score.append(['note', dtime, dur, 0, cc+48, 30+cc+48, 0])
15020
+
15021
+ if random.randint(0, 1) and add_texture:
15022
+ score.append(['note', dtime, dur, 0, cc+60, 20+cc+60, 0])
15023
+
15024
+ dtime += chords_dtime
15025
+
15026
+ return score
15027
+
15028
+ ###################################################################################
15029
+
15030
  print('Module loaded!')
15031
  print('=' * 70)
15032
  print('Enjoy! :)')