Spaces:
Runtime error
Runtime error
gfartenstein
commited on
Commit
Β·
5a622c2
1
Parent(s):
302a17b
Update spectro.py
Browse files- spectro.py +2 -2
spectro.py
CHANGED
@@ -65,10 +65,11 @@ def spectrogram_from_image(
|
|
65 |
) -> np.ndarray:
|
66 |
"""
|
67 |
Compute a spectrogram magnitude array from a spectrogram image.
|
|
|
68 |
TODO(hayk): Add image_from_spectrogram and call this out as the reverse.
|
69 |
"""
|
70 |
# Convert to a numpy array of floats
|
71 |
-
data = np.array(image
|
72 |
|
73 |
# Flip Y take a single channel
|
74 |
data = data[::-1, :, 0]
|
@@ -85,7 +86,6 @@ def spectrogram_from_image(
|
|
85 |
return data
|
86 |
|
87 |
|
88 |
-
|
89 |
def spectrogram_from_waveform(
|
90 |
waveform: np.ndarray,
|
91 |
sample_rate: int,
|
|
|
65 |
) -> np.ndarray:
|
66 |
"""
|
67 |
Compute a spectrogram magnitude array from a spectrogram image.
|
68 |
+
|
69 |
TODO(hayk): Add image_from_spectrogram and call this out as the reverse.
|
70 |
"""
|
71 |
# Convert to a numpy array of floats
|
72 |
+
data = np.array(image).astype(np.float32)
|
73 |
|
74 |
# Flip Y take a single channel
|
75 |
data = data[::-1, :, 0]
|
|
|
86 |
return data
|
87 |
|
88 |
|
|
|
89 |
def spectrogram_from_waveform(
|
90 |
waveform: np.ndarray,
|
91 |
sample_rate: int,
|