naotokui commited on
Commit
bb201df
1 Parent(s): db68f64

added: weak beat

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -69,10 +69,15 @@ def convert_table_to_audio(markdown_table, resolution=8, bpm = 120.0):
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
  if 'x' == rhythm_pattern[i][j].strip():
 
 
 
 
73
  if inst in MIDI_NOTENUM.keys():
74
  midinote = MIDI_NOTENUM[inst]
75
- note = pretty_midi.Note(velocity=80, pitch=midinote, start=note_length * (j-1)+0.05, end=note_length * j)
76
  pm_inst.notes.append(note)
77
 
78
  # convert to audio
 
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():
74
+ velocity = 120
75
+ if 'o' == rhythm_pattern[i][j].strip():
76
+ velocity = 65
77
+ if velocity > 0:
78
  if inst in MIDI_NOTENUM.keys():
79
  midinote = MIDI_NOTENUM[inst]
80
+ note = pretty_midi.Note(velocity=velocity, pitch=midinote, start=note_length * (j-1)+0.05, end=note_length * j)
81
  pm_inst.notes.append(note)
82
 
83
  # convert to audio