def get_next_power_2(n):

    power = 1
    while (power < n):
        power *= 2
    if power > 1:
        return power / 2
    else:
        return 1
Returns the closest number that is smaller than n that is a power of 2.
dataset/ETHPy150Open Agerrr/Automated_Music_Transcription/first_peaks_method.py/get_next_power_2