Changed conditionals in to account for when audio data is None.
@@ -213,6 +213,7 @@ class AudioSignal(object):
elif not isinstance(value, np.ndarray):
raise ValueError('Type of self.audio_data must be of type np.ndarray!')
+ else:
if value.ndim > 1 and value.shape[constants.CHAN_INDEX] > value.shape[constants.LEN_INDEX]:
warnings.warn('self.audio_data is not as we expect it. Transposing signal...')
value = value.T
@@ -220,11 +221,11 @@ class AudioSignal(object):
if value.ndim > 2:
raise ValueError('self.audio_data cannot have more than 2 dimensions!')
- self._audio_data = value
-
if self._audio_data.ndim < 2:
self._audio_data = np.expand_dims(self._audio_data, axis=constants.CHAN_INDEX)
+ self._audio_data = value
+
self.set_active_region_to_default()
@property
