asigalov61 commited on
Commit
74acb77
·
verified ·
1 Parent(s): 70bf766

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -55,6 +55,7 @@ def plot_ms_SONG(ms_song,
55
  return_plt = False,
56
  timings_multiplier=1,
57
  plot_curve_values=None,
 
58
  save_plot=''
59
  ):
60
 
@@ -87,18 +88,17 @@ def plot_ms_SONG(ms_song,
87
 
88
  if plot_curve_values is not None:
89
 
90
- min_val = min(plot_curve_values)
91
- max_val = max(plot_curve_values)
92
- spcva = [((value - min_val) / (max(max_val - min_val, 0.00001))) * 100 for value in plot_curve_values]
93
-
94
- mult = int(math.ceil(max(add_arrays(start_times, durations)) / len(spcva)))
95
- pcv = [value for value in spcva for _ in range(mult)][:int(max(add_arrays(start_times, durations)))+mult]
96
-
97
- x = np.arange(len(pcv))
98
- x_smooth = np.linspace(x.min(), x.max(), 300)
99
- spl = make_interp_spline(x, pcv, k=3)
100
- y_smooth = spl(x_smooth)
101
- ax.plot(x_smooth, y_smooth, color='white')
102
 
103
  # Set the limits of the plot
104
  ax.set_xlim([min(start_times), max(add_arrays(start_times, durations))])
 
55
  return_plt = False,
56
  timings_multiplier=1,
57
  plot_curve_values=None,
58
+ plot_curve_notes_step=200
59
  save_plot=''
60
  ):
61
 
 
88
 
89
  if plot_curve_values is not None:
90
 
91
+ stimes = start_times[::plot_curve_notes_step]
92
+
93
+ min_val = min(plot_curve_values)
94
+ max_val = max(plot_curve_values)
95
+ spcva = [((value - min_val) / (max(max_val - min_val, 0.00001))) * 100 for value in plot_curve_values]
96
+
97
+ x = stimes
98
+ x_smooth = np.linspace(x.min(), x.max(), 300)
99
+ spl = make_interp_spline(x, spcva, k=9)
100
+ y_smooth = spl(x_smooth)
101
+ ax.plot(x_smooth, y_smooth, color='white')
 
102
 
103
  # Set the limits of the plot
104
  ax.set_xlim([min(start_times), max(add_arrays(start_times, durations))])