Spaces:
Running
Running
Update steganography.py
Browse files- steganography.py +4 -0
steganography.py
CHANGED
@@ -56,6 +56,10 @@ def create_text_image(text, font, base_width=512, height=256, margin=10, letter_
|
|
56 |
def spectrogram_image_to_audio(image, sr=DEFAULT_SAMPLE_RATE):
|
57 |
flipped_image = np.flipud(image)
|
58 |
S = flipped_image.astype(np.float32) / 255.0 * 100.0
|
|
|
|
|
|
|
|
|
59 |
y = librosa.griffinlim(S, n_iter=60, window='hann', n_fft=N_FFT, hop_length=N_FFT//4)
|
60 |
return y
|
61 |
|
|
|
56 |
def spectrogram_image_to_audio(image, sr=DEFAULT_SAMPLE_RATE):
|
57 |
flipped_image = np.flipud(image)
|
58 |
S = flipped_image.astype(np.float32) / 255.0 * 100.0
|
59 |
+
|
60 |
+
# Ensure the spectrogram has the correct shape
|
61 |
+
S = librosa.util.fix_length(S, size=N_MELS)
|
62 |
+
|
63 |
y = librosa.griffinlim(S, n_iter=60, window='hann', n_fft=N_FFT, hop_length=N_FFT//4)
|
64 |
return y
|
65 |
|