@@ -280,7 +280,7 @@ def load_stft(
280280 stft_db = 10 * np .log10 (abs_sq_stft / abs_sq_stft .max () + 1e-20 )
281281 # Retrieve time vector in seconds corresponding to STFT
282282 time_vec = librosa .frames_to_time (
283- range (stft_db .shape [1 ]), sr = sr , hop_length = hop_length , n_fft = n_fft
283+ range (stft_db .shape [1 ]), sr = sr , hop_length = hop_length , n_fft = win_length
284284 )
285285
286286 # Remove frequencies that we do not need [FREQ_MIN - FREQ_MAX]
@@ -1113,10 +1113,9 @@ def extract_contour_keypoints(
11131113 'slope/hi[avg].y_px/x_px' : float (np .mean (der1 [: knee_idx + 1 ])),
11141114 'slope/mid[avg].y_px/x_px' : float (np .mean (der1 [knee_idx : heel_idx + 1 ])),
11151115 'slope/lo[avg].y_px/x_px' : float (np .mean (der1 [heel_idx :])),
1116- 'slope[box].y_px/x_px' : float (0.5 * (der1 [0 ] + der1 [- 1 ])),
1117- 'slope/hi[box].y_px/x_px' : float (0.5 * (der1 [0 ] + der1 [knee_idx ])),
1118- 'slope/mid[box].y_px/x_px' : float (0.5 * (der1 [knee_idx ] + der1 [heel_idx ])),
1119- 'slope/lo[box].y_px/x_px' : float (0.5 * (der1 [heel_idx ] + der1 [- 1 ])),
1116+ 'slope[box].y_px/x_px' : - float ((y_ [- 1 ] - y_ [0 ]) / (x_ [- 1 ] - x_ [0 ] + 1e-10 )),
1117+ 'slope/hi[box].y_px/x_px' : - float ((y_ [fc_idx ] - y_ [0 ]) / (x_ [fc_idx ] - x_ [0 ] + 1e-10 )),
1118+ 'slope/lo[box].y_px/x_px' : - float ((y_ [- 1 ] - y_ [fc_idx ]) / (x_ [- 1 ] - x_ [fc_idx ] + 1e-10 )),
11201119 }
11211120
11221121 return path_ , points , slopes
@@ -1405,6 +1404,7 @@ def compute_wrapper(
14051404 annotations = None ,
14061405 bitdepth = 16 ,
14071406 mask_secondary_effects = False ,
1407+ plot_uncompressed_amplitude = False ,
14081408 debug = False ,
14091409 ** kwargs ,
14101410):
@@ -1843,12 +1843,20 @@ def compute_wrapper(
18431843 datas = [
18441844 (output_paths , 'jpg' , stft_db ),
18451845 ]
1846+ if plot_uncompressed_amplitude :
1847+ datas += [
1848+ (output_paths , 'waveplot.jpg' , waveplot ),
1849+ ]
18461850 else :
18471851 datas = []
18481852 if 'stft_db' in segments :
18491853 datas += [
18501854 (compressed_paths , 'compressed.jpg' , segments ['stft_db' ]),
18511855 ]
1856+ if 'waveplot' in segments :
1857+ datas += [
1858+ (compressed_paths , 'compressed.waveplot.jpg' , segments ['waveplot' ]),
1859+ ]
18521860
18531861 # Create masked image
18541862 if 'costs' in segments and 'stft_db' in segments :
0 commit comments