gfartenstein commited on
Commit
7027ad9
β€’
1 Parent(s): 74e60a6

Update spectro.py

Browse files
Files changed (1) hide show
  1. spectro.py +2 -2
spectro.py CHANGED
@@ -65,11 +65,10 @@ def spectrogram_from_image(
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,6 +85,7 @@ def spectrogram_from_image(
86
  return data
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
  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.convert('RGBA')).astype(np.float32)
72
 
73
  # Flip Y take a single channel
74
  data = data[::-1, :, 0]
 
85
  return data
86
 
87
 
88
+
89
  def spectrogram_from_waveform(
90
  waveform: np.ndarray,
91
  sample_rate: int,