3030 http://zafarrafii.com
3131 https://github.com/zafarrafii
3232 https://www.linkedin.com/in/zafarrafii/
33- 01/22 /21
33+ 01/23 /21
3434"""
3535
3636import numpy as np
@@ -1262,7 +1262,7 @@ def _periods(beat_spectrogram, period_range):
12621262 Compute the repeating period(s) from the beat spectrogram(spectrum) given a period range.
12631263
12641264 Input:
1265- beat_spectrogram: beat spectrogram (or spectrum) (number_frequencies, number_lags ) (or (number_lags, ))
1265+ beat_spectrogram: beat spectrogram (or spectrum) (number_lags, number_times ) (or (number_lags, ))
12661266 Output:
12671267 repeating_periods: repeating period(s) in lags (number_periods,) (or scalar)
12681268 """
@@ -1281,7 +1281,7 @@ def _periods(beat_spectrogram, period_range):
12811281 + 1
12821282 )
12831283
1284- # Else, compute the repeating periods as the argmax of the frequency channels given the period range
1284+ # Else, compute the repeating periods as the argmax for all the time frames given the period range
12851285 else :
12861286 repeating_periods = (
12871287 np .argmax (
@@ -1409,15 +1409,15 @@ def _mask(audio_spectrogram, repeating_period):
14091409 # Estimate the number of segments (including the last partial one)
14101410 number_segments = int (np .ceil (number_times / repeating_period ))
14111411
1412- # Zero-pad the end of the spectrogram to have a full last segment
1412+ # Pad the end of the spectrogram to have a full last segment
14131413 audio_spectrogram = np .pad (
14141414 audio_spectrogram ,
14151415 ((0 , 0 ), (0 , number_segments * repeating_period - number_times )),
14161416 "constant" ,
14171417 constant_values = 0 ,
14181418 )
14191419
1420- # Reshape the zero- padded spectrogram to a tensor of size (number_frequencies, number_times, number_segments)
1420+ # Reshape the padded spectrogram to a tensor of size (number_frequencies, number_times, number_segments)
14211421 audio_spectrogram = np .reshape (
14221422 audio_spectrogram ,
14231423 (number_frequencies , repeating_period , number_segments ),
0 commit comments