Error: "name data undefined"
On Fri, Sep 14, 2012 at 12:33 AM, eryksun <eryk...@gmail.com> wrote: > On Thu, Sep 13, 2012 at 11:48 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ > <dvnsa...@gmail.com> wrote: > > > > As far as programming volume is concerned winsound.Beep has only > frequency > > and duration. pyaudio module appears to have provision for volume > control. > > You should be able to add a wave header to a raw byte string. For example: > > > import wave > import winsound > from cStringIO import StringIO > > def get_wave(data): > f = StringIO() > w = wave.open(f, 'w') > w.setnchannels(1) # mono > w.setsampwidth(2) # 2 bytes > w.setframerate(48000) # samples/second > w.writeframes(data) > return f.getvalue() > > > Then play the sound like this (_untested_): > > > wave_data = get_wave(data) > windsound.PlaySound(wave_data, winsound.SND_MEMORY) > > > > -- regards, Sarma.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor