Play sound from one side (lateralized) in PsychoPy

I’m trying to play sound from either the left or the right side / speaker / headphone side. So far, I haven’t found a solution to this problem. I can play sound but I can’t adjust it, so that the tone is lateralized.

from __future__ import division
from __future__ import print_function

logging.console.setLevel(logging.DEBUG)  # get messages about the sound lib as it loads

from psychopy import sound, core

print('Using %s (with %s) for sounds' % (sound.audioLib, sound.audioDriver))

alert = sound.Sound(700, secs=0.12, sampleRate=44100, stereo=True, hamming=True, volume=0.8)

alert.play()
core.wait(0.4)

core.quit()

Thanks!

You have to provide data that is different for each channel. In the code above, the left and right channel will both be the same 700 Hz tone. For example, you could create a stereo .wav file that has different content for each channel, and use that. Or you can do it programatically I think by creating a numpy array of two columns of numbers, one to play for each channel.