Spaces:
Sleeping
Sleeping
Update librosa/core/__init__.py
Browse files- librosa/core/__init__.py +7 -3
librosa/core/__init__.py
CHANGED
|
@@ -7,7 +7,6 @@ import numpy as np
|
|
| 7 |
def stft(y, n_fft=2048, hop_length=512, win_length=2048, center=True, window=None, **kwargs):
|
| 8 |
"""
|
| 9 |
Minimal STFT stub compatible with Spleeter.
|
| 10 |
-
Ignores the `window` argument because we always use Hann window.
|
| 11 |
"""
|
| 12 |
y = tf.convert_to_tensor(y, dtype=tf.float32)
|
| 13 |
|
|
@@ -19,7 +18,10 @@ def stft(y, n_fft=2048, hop_length=512, win_length=2048, center=True, window=Non
|
|
| 19 |
window_fn=tf.signal.hann_window,
|
| 20 |
pad_end=True
|
| 21 |
)
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
def istft(Z, hop_length=512, win_length=2048, window=None, **kwargs):
|
|
@@ -31,5 +33,7 @@ def istft(Z, hop_length=512, win_length=2048, window=None, **kwargs):
|
|
| 31 |
frame_step=hop_length,
|
| 32 |
window_fn=tf.signal.hann_window
|
| 33 |
)
|
| 34 |
-
|
|
|
|
|
|
|
| 35 |
|
|
|
|
| 7 |
def stft(y, n_fft=2048, hop_length=512, win_length=2048, center=True, window=None, **kwargs):
|
| 8 |
"""
|
| 9 |
Minimal STFT stub compatible with Spleeter.
|
|
|
|
| 10 |
"""
|
| 11 |
y = tf.convert_to_tensor(y, dtype=tf.float32)
|
| 12 |
|
|
|
|
| 18 |
window_fn=tf.signal.hann_window,
|
| 19 |
pad_end=True
|
| 20 |
)
|
| 21 |
+
|
| 22 |
+
# Convert to numpy safely
|
| 23 |
+
return np.array(Z)
|
| 24 |
+
|
| 25 |
|
| 26 |
|
| 27 |
def istft(Z, hop_length=512, win_length=2048, window=None, **kwargs):
|
|
|
|
| 33 |
frame_step=hop_length,
|
| 34 |
window_fn=tf.signal.hann_window
|
| 35 |
)
|
| 36 |
+
|
| 37 |
+
return np.array(audio)
|
| 38 |
+
|
| 39 |
|