标签:数字 create cer creat amp pre bsp port span
1 import stdarray 2 import math 3 import stddraw 4 import stdaudio 5 import stdio 6 SPS = 44100 7 CONCERT_A = 440.0 8 while not stdio.isEmpty(): 9 pitch = stdio.readInt() 10 duration = stdio.readFloat() 11 hz = CONCERT_A * (2 ** (pitch/12.0)) 12 n = int(SPS * duration) 13 samples = stdarray.create1D(n+1, 0.0) 14 for i in range(n+1): 15 samples[i] = math.sin(2.0 * math.pi * i * hz / SPS) 16 stdaudio.playSamples(samples) 17 stdaudio.wait()
标签:数字 create cer creat amp pre bsp port span
原文地址:http://www.cnblogs.com/cdf4745/p/7282749.html