2007-08-06

groovy中如何播放Star Wars - Darth Vader 主题曲

关键字: groovy,jfugue,star wars,darth vader
看Groovy in Action中有这段播放星战Vader的theme, 就试了一下, 还真有趣 ^o^

先从jfugue.org www.jfugue.org/download.html
下载jfugue.jar, 放到classpath里面

建立StarWars.groovy

import org.jfugue.*

def darthVaderTheme = new Pattern('T160 I[Cello] ' +
        'G3q G3q G3q Eb3q Bb3i G3qi Eb3q Bb3i G3hi')

new Player().play darthVaderTheme

搞定! 音乐播放出来还真像, 哈哈!
评论
agile_boy 2007-08-06
cool
lordhong 2007-08-06
稍微改了下, 连续播放10次...
def player = new Player();

10.times {
    player.play darthVaderTheme
}
发表评论

您还没有登录,请登录后发表评论

lordhong
搜索本博客
我的相册
037d85c1-c907-38c6-8640-2b52c9d299cb-thumb
IMG_0308
共 45 张
最近加入圈子
存档
最新评论