Q: Sound production with python?

Kare Sjolander kare at speech.kth.se
Wed Mar 20 06:47:13 EST 2002


Using Snack (http://www.speech.kth.se/snack) you would use the following
commands to generate a note sequence.

from Tkinter import *
from tkSnack import *

root = Tkinter.Tk()
initializeSnack(root)

s = Sound()
filt = Filter('generator', 440, 30000, 0.0, 'sine', 8000)

def beep(freq):
   filt.configure(freq)
   s.play(filter=filt,blocking=1)

beep(261.6)
beep(293.7)
beep(329.7)
beep(349.3)

This should get you started
Kare

"A.Newby" wrote:

> Being a beginner fiddle player, as well as a beginner python programmer, I
> want to write a little prog that trains the sense of pitch.
>
> How envisage it working is thus...
>
> It plays a simple 4 note melody, then repeats the melody with one of the
> notes (selected randomly) slightly off pitch ... say by 20% or 10% or 5%.
> The user then has to detect which note was off.
>
> What modules and commands should I use to generate this sounds? What's the
> best way to go about it?
>
> --
> cdewin at dingoblue.net.au




More information about the Python-list mailing list