Exemplo n.º 1
0
filter_spectrum(spectrum2)
spectrum2.scale(440)
plt.subplot(3,3,4)
spectrum2.plot(high=10000, color='red')
plt.title("方波")
plt.subplot(3,3,5)
wave2.plot(color='red')
plt.title('方波变换前')
plt.subplot(3,3,6)
spectrum2.make_wave().plot(color='red')
plt.title("方变换后")
spectrum1.make_wave.write(filename='output2-3.wav')


wave3=SawtoothSignal(freq=440).make_wave(duration=0.5)
spectrum3 = wave3.make_spectrum()
filter_spectrum(spectrum3)
spectrum3.scale(440)
plt.subplot(3,3,7)
spectrum3.plot(high=10000, color='green')
plt.title("方波")
plt.subplot(3,3,8)
wave3.plot(color='green')
plt.title('方波变换前')
plt.subplot(3,3,9)
spectrum3.make_wave().plot(color='green')
plt.title("方变换后")
plt.show()


Exemplo n.º 2
0
plt.subplot(231)
plt.title("trangle")

trangle.plot()
trangle.write("三角波声音.wav")
play("三角波声音.wav", flags=1)
square = SquareSignal(freq=440).make_wave(duration=0.01, framerate=10000)
plt.subplot(232)
plt.title("square")
square.plot()
square.write("方波声音.wav")
play("方波声音.wav", flags=1)
sawtooth = SawtoothSignal(freq=440).make_wave(duration=0.01, framerate=10000)
plt.subplot(233)
plt.title("sawtooth")
sawtooth.plot()
sawtooth.write("斜波声音.wav")
play("斜波声音.wav", flags=1)

spectrum_tra = trangle.make_spectrum()
filter_spectrum(spectrum_tra)
plt.subplot(234)
spectrum_tra.plot()

spectrum_squ = square.make_spectrum()
filter_spectrum(spectrum_squ)
plt.subplot(235)
spectrum_squ.plot()

spectrum_saw = sawtooth.make_spectrum()
filter_spectrum(spectrum_saw)