Permalink
Browse files

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.
  • Loading branch information...
CRiddler authored and peircej committed May 16, 2018
1 parent 6ffa413 commit b07f8fb1998069385600ef18d89bceef80b008ad
Showing with 9 additions and 9 deletions.
  1. +9 −9 psychopy/sound/backend_sounddevice.py
@@ -427,15 +427,15 @@ def _setSndFromArray(self, thisArray):
"into sound with channels={}"
.format(self.sndArr.shape, self.channels))
# is this stereo?
if self.stereo == -1: # auto stereo. Try to detect
if self.sndArr.shape[1] == 1:
self.stereo = 0
elif self.sndArr.shape[1] == 2:
self.stereo = 1
else:
raise IOError("Couldn't determine whether array is "
"stereo. Shape={}".format(self.sndArr.shape))
# is this stereo?
if self.stereo == -1: # auto stereo. Try to detect
if self.sndArr.shape[1] == 1:
self.stereo = 0
elif self.sndArr.shape[1] == 2:
self.stereo = 1
else:
raise IOError("Couldn't determine whether array is "
"stereo. Shape={}".format(self.sndArr.shape))
self._nSamples = thisArray.shape[0]
if self.stopTime == -1:
self.stopTime = self._nSamples/float(self.sampleRate)

0 comments on commit b07f8fb

Please sign in to comment.