Created
March 15, 2021 05:25
-
-
Save AyishaR/66afa617473f1fa238b8293f5ea55aaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hop_len=int(win_len/4) # default | |
# fft_len=pow(2, int(np.log2(win_len)+1)) | |
fft_len = 2048 | |
win_len = fft_len | |
hop_len = int(win_len/4) | |
def spectrogramOp(X): | |
spectrogram_out = librosa.core.stft(X, n_fft=fft_len, hop_length=hop_len, win_length=win_len, center=True) | |
return np.absolute(spectrogram_out) | |
input_spectrogram = np.empty((input_audio.shape[0], int(fft_len/2 + 1), int(desired_samples/hop_len + 1))).astype(np.float32) | |
i = 0 ; | |
for input in input_audio: | |
input_spectrogram[i] = spectrogramOp(input) | |
i = i + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment