By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,403 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,403 IT Pros & Developers. It's quick & easy.

tkSnack or other sound tool

P: n/a
I'm trying to play programmed music by iteratively applying filter
changes to a playing Sound object.

It almost seem to work but i can't control duration of sounds???

Using tkSnack 2.2.4 for Python (naturlīch!)
with python 2.3.some

Thanks,
Jean-Marc
(maybe I should investigate other tool for my synthesizing
experiments?, - which one then???)

PS my code:
from Tkinter import *
from tkSnack import *
import time
root = Tkinter.Tk()

initializeSnack(root)

s = Sound()

filt = Filter('generator', 440.0)
filt.configure(440, 1000, 00.7, "rectangle", 5000)

def play():
s.play(filter=filt)
for i in range(100):
filt.configure(i+440)

def stop():
s.stop()

f = Frame(root)
f.pack()

fb = Frame(root)
fb.pack(side='bottom')
Button(fb, bitmap='snackPlay', command=play).pack(side='left')
Button(fb, bitmap='snackStop', command=stop).pack(side='left')

root.mainloop()
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I'm not sure exactly what you mean by "can't control the duration...".
If you just want to call s.stop() at some specified time after starting
the sound, then use "after", as in:

def play():
s.play
...
root.after(1000, stop)

If it's something more complicated, please explain.

I'll be curious to see how this discussion goes. I'm using snack to play
simple sound files. On the whole it works, but sometimes I get snaps,
pops and other oddities.

-- Russell

In article <3d**************************@posting.google.com >,
jm*********@cvm.qc.ca (jmdeschamps) wrote:
I'm trying to play programmed music by iteratively applying filter
changes to a playing Sound object.

It almost seem to work but i can't control duration of sounds???

...
s = Sound()

filt = Filter('generator', 440.0)
filt.configure(440, 1000, 00.7, "rectangle", 5000)

def play():
s.play(filter=filt)
for i in range(100):
filt.configure(i+440)

def stop():
s.stop()
...

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.