From 817ff92ef997f22027999ddd2aa9f3d1cdcf16de Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Fri, 16 Jul 2021 20:29:59 +0200 Subject: Show more meaningful error message if audio input has > 2 dimensions --- sounddevice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sounddevice.py b/sounddevice.py index 3f34989..65ac26c 100644 --- a/sounddevice.py +++ b/sounddevice.py @@ -2461,6 +2461,9 @@ class _CallbackContext(object): data = np.asarray(data) if data.ndim < 2: data = data.reshape(-1, 1) + elif data.ndim > 2: + raise ValueError( + 'audio data to be played back must be one- or two-dimensional') frames, channels = data.shape dtype = _check_dtype(data.dtype) mapping_is_explicit = mapping is not None -- cgit v1.2.3