tim97803 发表于 2008-8-21 14:38:04

北京欢迎你

新出炉,初试编的,应该没编错吧。
A:
:set f "659,784,659,578,659,578,659,659,578,440,523,659,578,578,523,440,523,578,659,784,578,659,880,784,392,578,523";:set d "500ms,500ms,500ms,500ms,500ms,500ms,1s,750ms,250ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,1500ms";:set i 0 ;:while ($i<27) do={:beep len=[:pick $d $i ($i+1)] freq=([:pick $f $i ($i+1)]);:delay [:pick $d $i ($i+1)];:set i ($i+1)}

B:
:set f "578,523,440,523,578,659,784,578,659,880,784,784,659,578,659,578,523,784,880,659,440,659,578,578,523";:set d "500ms,1500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,2s,500ms,500ms,500ms,500ms,750ms,250ms,1s,500ms,500ms,500ms,500ms,1500ms";:set i 0 ;:while ($i<25) do={:beep len=[:pick $d $i ($i+1)] freq=([:pick $f $i ($i+1)]);:delay [:pick $d $i ($i+1)];:set i ($i+1)}

C:
:set f "659,784,1046,784,880,784,880,784,659,659,784,784,659,784,880,1046,1175,1046,784,659,578,784,659,659,659,784,1046,784,880,1046,1175,1046,784,659,784,1046,880,659,578,659,880,1318,1175,1175,1046";:set d "500ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,1s,500ms,2s,500ms,500ms,500ms,500ms,1500ms,500ms,750ms,250ms,500ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,1500ms,500ms,3500ms";:set i 0 ;:while ($i<45) do={:beep len=[:pick $d $i ($i+1)] freq=([:pick $f $i ($i+1)]);:delay [:pick $d $i ($i+1)];:set i ($i+1)}

整合整首:
:set f "A,A,B,A,B,C,A,B,C,C,B,C,A,B,C,C,C,C";:set d "16,16,16,16,16,32,16,16,32,32,16,16,16,16,32,32,32,32";:set i 0 ;:while ($i<18) do={/system script run ([:pick $f $i ($i+1)]);:delay ([:pick $d $i ($i+1)]);:set i ($i+1)}


音符频率对应表
mculover 发表于 2005-12-26 9:08:47
音符 频率/HZ 半周期/us 音符 频率/HZ 半周期/us
------------------------------------------
低1DO 262 1908 #4FA# 740 0676
#1DO# 277 1805 中5SO 784 0638
低2RE 294 1700 #5SO# 831 0602
#2RE# 311 1608 中6LA 880 0568
低3M 330 1516 #6LA# 932 0536
低4FA 349 1433 中7SI 988 0506
#4FA# 370 1350 高1DO 1046 0478
低5SO 392 1276 #DO# 1109 0451
#5SO# 415 1205 高2RE 1175 0426
低6LA 440 1136 #2RE# 1245 0402
#6LA# 466 1072 高3M 1318 0372
低7SI 494 1012 高4FA 1397 0358
中1DO 523 0956 #4FA# 1480 0338
#1DO# 554 0903 高5SO 1568 0319
中2RE 578 0842 #5S0# 1661 0292
#2RE# 622 0804 高6LA 1760 0284
中3M 659 0759 #6LA# 1865 0268
中4FA 698 0716 高7SI 1976 0253

[ 本帖最后由 tim97803 于 2008-8-22 10:28 编辑 ]

tim97803 发表于 2008-8-21 14:44:17

歌词


hcb 发表于 2008-8-21 15:39:54

不错,下次你应该改进一下,弄一个通用的脚本,自动的把频率和音符进行转换,就不要写那么长的脚本了,最终只要给出一个乐谱就能播放

tim97803 发表于 2008-8-21 16:25:38

用excle就能用公式替换出来吧
用ROS就不会了
最后部分用脚本写大概是这样吧
:set f "659,784,1046,784,880,784,880,784,659,659,784,784,659,784,880,1046,1175,1046,784,659,578,784,659,659,659,784,1046,784,880,1046,1175,1046,784,659,784,1046,880,659,578,659,880,1318,1175,1175,1046";:set d "500ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,500ms,1s,500ms,2s,500ms,500ms,500ms,500ms,1500ms,500ms,750ms,250ms,500ms,500ms,500ms,500ms,1500ms,500ms,500ms,500ms,500ms,500ms,1500ms,500ms,3500ms";:set i 0 ;:while ($i<45) do={:beep len=[:pick $d $i ($i+1)] freq=([:pick $f $i ($i+1)]);:delay [:pick $d $i ($i+1)];:set i ($i+1)}

ee007 发表于 2008-8-21 20:08:08

继 驱蚊脚本, 你知道我在等你吗之后的倾城巨作!!!!!:lol :lol

ksw520 发表于 2008-8-21 23:17:26

高人作品

wlnlby 发表于 2008-8-22 08:57:06

有意思,很有意思的东西

马甲 发表于 2008-8-22 19:53:50

哈哈,出手非凡,再接再厉

y8160000 发表于 2008-8-23 09:37:04

这个不错,做得还可以,就是输入太麻烦啦

tim97803 发表于 2008-8-23 11:50:44

从整道整合那部分效果来看,只要你把每个音符写成一个小脚本,就可以实现输入简谱就可以放歌呐。
例如建立以下脚本:

脚本1::beep length=500ms frequency=523 :delay 500ms
脚本2::beep length=500ms frequency=578 :delay 500ms
脚本3::beep length=500ms frequency=659 :delay 500ms
脚本4::beep length=500ms frequency=698 :delay 500ms
脚本5::beep length=500ms frequency=784 :delay 500ms
脚本6::beep length=500ms frequency=880 :delay 500ms
脚本7::beep length=500ms frequency=988 :delay 500ms

在f中代入简谱, d代入节拍 ($i<8)这里这8是音符的个数,然后音乐就出来了
:set f "5,1,2,3,4,5,1,1";:set d "1,500ms,500ms,500ms,500ms,500ms,1,1";:set i 0 ;:while ($i<8) do={/system script run ([:pick $f $i ($i+1)]);:delay ([:pick $d $i ($i+1)]);:set i ($i+1)}

[ 本帖最后由 tim97803 于 2008-8-23 12:28 编辑 ]

小狼 发表于 2008-8-25 20:03:12

:L
还能正经点不……
页: [1]
查看完整版本: 北京欢迎你