今晚回家总觉得生活有点失去了节奏。原因很简单:从今天开始世界杯都要等到22:00开始了,作为球迷就再也没有19:30就可以看球的幸福了。做点什么呢?等待总是很漫长的,书看得也感觉到累了。听一首诗吧,要是有人给我朗诵首 “Youth青春”就好了。没有有声电子书,这确实感觉有点难度。不过不怕,因为.Net框架系统自带了不同性别,不同年龄朗诵者,再加上可爱的IronPython看来可以实现的,趁着比赛开始试一把吧!
import clr
clr.AddReference("System.Speech")
from System.Speech import Synthesis
speaker = Synthesis.SpeechSynthesizer()

poem = """Youth is not a time of life; it is a state of mind. It is not a matter of rosy cheeks, red lips and supple knees. It is a matter of the will, a quality of the imagination, vigor of the emotions; it is the freshness of the deep spring of life. Youth means a temperamental predominance of courage over timidity, of the appetite for adventure over the love of ease. This often exits in a man of 60, more than a boy of 20.nobody grows merely by the number of years; we grow old by deserting our ideas. Years may wrinkle the skin, but to give up enthusiasm wrinkles the soul. Worry, fear, self-distrust1 bows the heart and turns the spirit back to dust."""

speaker.Speak(poem)

    真的可以啊~虽然朗诵没什么感情,总体效果一般,但凑合吧,总算有声音了。不信你也可以试试哦,几行代码就搞定了。
再说一句,中文也可以哦,效果还挺好的。
 
参考: