diff --git a/_soundfile_data b/_soundfile_data index f1655ba..d9887ef 160000 --- a/_soundfile_data +++ b/_soundfile_data @@ -1 +1 @@ -Subproject commit f1655ba375f306c4b3b179e1fb603d71b50ce179 +Subproject commit d9887ef926bb11cf1a2526be4ab6f9dc690234c0 diff --git a/soundfile.py b/soundfile.py index dde887e..04433db 100644 --- a/soundfile.py +++ b/soundfile.py @@ -1332,8 +1332,8 @@ def _check_dtype(self, dtype): def _array_io(self, action, array, frames): """Check array and call low-level IO function.""" - if self.channels not in (1,2): - raise ValueError("Cannot convert: file has {0} channels, but only 1 or 2 is supported".format(self.channels)) + if array.ndim not in (1,2): + raise ValueError("Invalid shape: {0!r} ({1})".format(array.shape, "0 dimensions not supported" if array.ndim < 1 else "too many dimensions")) array_channels = 1 if array.ndim == 1 else array.shape[1] if array_channels != self.channels: raise ValueError("Invalid shape: {0!r} (Expected {1} channels, got {2})".format(array.shape, self.channels, array_channels))