blob: ac054719d1c1c320c4fe593650403c15904b4af5 [file] [log] [blame]
Guido van Rossum3a80c8d1994-10-02 11:33:59 +00001#
2# Hum - The singing macintosh
3#
4import macspeech
5import sys
6import string
7
8dict = { 'A':57, 'A#':58, 'B':59, 'C':60, 'C#':61, 'D':62, 'D#':63,
9 'E':64, 'F':65, 'F#':66, 'G':67, 'G#':68}
10
11vd = macspeech.GetIndVoice(2)
12vc = vd.NewChannel()
13print 'Input strings of notes, as in A B C C# D'
14while 1:
15 print 'S(tr)ing-',
16 str = sys.stdin.readline()
17 if not str:
18 break
19 str = string.split(str[:-1])
20 data = []
21 for s in str:
22 if not dict.has_key(s):
23 print 'No such note:', s
24 else:
25 data.append(dict[s])
26 print data
27 for d in data:
28 vc.SetPitch(float(d))
29 vc.SpeakText('la')
30 while macspeech.Busy():
31 pass