Newbie SWMixer / numpy help - AssertionError
Peter Chant
REMpeteOVE at CAPpetezilla.ITALSco.uk
Sat Feb 7 09:46:17 EST 2009
Hello,
I'm a bit of a python newby. I want to play and record sound
simultaneously. SWMixer seems able to do this but the examples use WAV
files. I'm trying to play a test tone. Can anyone give me a steer as to
why this fails?
import sys
import swmixer
import numpy
swmixer.init(samplerate=44100, chunksize=1024, stereo=False,
microphone=True)
#snd = swmixer.Sound("test1.wav")
time = 1
freq = 440
time = numpy.linspace(0,1,44100*time) # 44100 numbers between 0 and 1
tone_data = numpy.sin(time*2*numpy.pi*freq) # A above Middle C
snd = swmixer.Sound(tone_data)
snd.play(loops=-1)
I know this may be in a little at the deep end for someone who has just
started to learn python, but I find I learn a lot faster if I try to do
something that is useful.
Pete
--
http://www.petezilla.co.uk
More information about the Python-list
mailing list