Skip to content

Commit 817ff92

Browse files
committed
Show more meaningful error message if audio input has > 2 dimensions
1 parent bc07f8e commit 817ff92

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sounddevice.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,9 @@ def check_data(self, data, mapping, device):
24612461
data = np.asarray(data)
24622462
if data.ndim < 2:
24632463
data = data.reshape(-1, 1)
2464+
elif data.ndim > 2:
2465+
raise ValueError(
2466+
'audio data to be played back must be one- or two-dimensional')
24642467
frames, channels = data.shape
24652468
dtype = _check_dtype(data.dtype)
24662469
mapping_is_explicit = mapping is not None

0 commit comments

Comments
 (0)