We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c4ffbd commit 631378dCopy full SHA for 631378d
sounddevice.py
@@ -1524,8 +1524,12 @@ def write(self, data):
1524
data = np.asarray(data)
1525
_, dtype = _split(self._dtype)
1526
_, channels = _split(self._channels)
1527
- if data.ndim > 1 and data.shape[1] != channels:
1528
- raise ValueError('Number of channels must match')
+ if data.ndim < 2:
+ data = data.reshape(-1, 1)
1529
+ elif data.ndim > 2:
1530
+ raise ValueError('data must be one- or two-dimensional')
1531
+ if data.shape[1] != channels:
1532
+ raise ValueError('number of channels must match')
1533
if data.dtype != dtype:
1534
raise TypeError('dtype mismatch: {!r} vs {!r}'.format(
1535
data.dtype.name, dtype))
0 commit comments