So I wasn't able to figure out the JACK problem yet, but I did find a solution that I think will suit my needs (at least for now). I downloaded pyaudio [
sudo apt-get install python-pyaudio python3-pyaudio] and was able to create sounds using the example script pasted below. Compared to the pyo commands this method seems a lot less elegant, but the timing consistency seems to be decent enough and it works!
I'm still getting a bunch of JACK errors in the output window, but these don't seem to affect my experiment timing or the production of the sounds (perhaps there's a way to disable these warnings)?
I'll update this thread again if I figure out a solution to the Ubuntu JACK issue.
Thanks again for your help.
Tom
###################################################################
import math
import pyaudio
#sudo apt-get install python-pyaudio
PyAudio = pyaudio.PyAudio
#See http://en.wikipedia.org/wiki/Bit_rate#Audio
BITRATE = 16000 #number of frames per second/frameset.
#See http://www.phy.mtu.edu/~suits/notefreqs.html
FREQUENCY = 261.63 #Hz, waves per second, 261.63=C4-note.
LENGTH = 1.2232 #seconds to play sound
NUMBEROFFRAMES = int(BITRATE * LENGTH)
RESTFRAMES = NUMBEROFFRAMES % BITRATE
WAVEDATA = ''
for x in xrange(NUMBEROFFRAMES):
WAVEDATA = WAVEDATA+chr(int(math.sin(x/((BITRATE/FREQUENCY)/math.pi))*127+128))
#fill remainder of frameset with silence
for x in xrange(RESTFRAMES):
WAVEDATA = WAVEDATA+chr(128)
p = PyAudio()
stream = p.open(format = p.get_format_from_width(1),
channels = 1,
rate = BITRATE,
output = True)
stream.write(WAVEDATA)
stream.stop_stream()
stream.close()
p.terminate()
##################################################################