Skip to content

Commit b07f8fb

Browse files
CRiddlerpeircej
authored andcommitted
FIX: sounddevice stereo auto detection
sound device backend was not running the code to determine whether audio was mono or stereo. This is because the `if/elif` block of code to do this was indented too far in and never able to run. Moving this block of code out one indentation level allows the stereo attribute to be detected and properly reassigned based on the sound array's features.
1 parent 6ffa413 commit b07f8fb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

psychopy/sound/backend_sounddevice.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -427,15 +427,15 @@ def _setSndFromArray(self, thisArray):
427427
"into sound with channels={}"
428428
.format(self.sndArr.shape, self.channels))
429429

430-
# is this stereo?
431-
if self.stereo == -1: # auto stereo. Try to detect
432-
if self.sndArr.shape[1] == 1:
433-
self.stereo = 0
434-
elif self.sndArr.shape[1] == 2:
435-
self.stereo = 1
436-
else:
437-
raise IOError("Couldn't determine whether array is "
438-
"stereo. Shape={}".format(self.sndArr.shape))
430+
# is this stereo?
431+
if self.stereo == -1: # auto stereo. Try to detect
432+
if self.sndArr.shape[1] == 1:
433+
self.stereo = 0
434+
elif self.sndArr.shape[1] == 2:
435+
self.stereo = 1
436+
else:
437+
raise IOError("Couldn't determine whether array is "
438+
"stereo. Shape={}".format(self.sndArr.shape))
439439
self._nSamples = thisArray.shape[0]
440440
if self.stopTime == -1:
441441
self.stopTime = self._nSamples/float(self.sampleRate)

0 commit comments

Comments
 (0)