[Tutor] python and snack

Michael Lange klappnase at freenet.de
Sat Nov 22 18:11:37 EST 2003


On Sat, 22 Nov 2003 06:46:26 -0800 (PST)
mike re-v <mrmrmr50 at yahoo.com> wrote:

> please help
> #!/usr/bin/python
> 
> from Tkinter import *
> root = Tk()
> import tkSnack#!/usr/bin/python
> 
> from Tkinter import *
> root = Tk()
> import tkSnack
> tkSnack.initializeSnack(root)
> 
> mysound = tkSnack.Sound()
> mysound1 = tkSnack.Sound()
> mysound2 = tkSnack.Sound()
> afile = open('/home/re-v/good.wav','w')
> mysound.read('/home/re-v/clm/doggrowl.wav')
> mysound1.read('/home/re-v/clm/dogbark.wav')
> mysound2.read('/home/re-v/sound/scream.wav')
>  
> 	
> mysound.play()
> 	 
>         
> mysound1.play()
> 
> mysound2.play()
> this is the problem#>>>>>afile.write(mysound2)<<<<<
> root.mainloop()
> 
> 
> GOAL
> There are three sound files which are opened and
> played. Since thay are not blocked they play at the
> same time. I'd like to not only play thru the
> speakers, which the code does now{this is nice for
> interactive editing}, I'd also like to be able to save
> the sound in a file
> there is a method in snack .write
> mysound.write('foo.wav') however the 'play at the same
> time feature is needed.
> Thanks
> re-v
> 
I suppose you want to mix the 3 "mysounds" together into "afile", right?
Have you tried the tkSnack.Sound.mix() method ? I must admit that I have not,
but it looks like it might be the right thing for you.

Good luck

Michael



More information about the Tutor mailing list