打印

用ruby编写的音乐

用ruby编写的音乐

复制内容到剪贴板
代码:
require "win32/sound"
include Win32
Sound.beep(440, 200)
Sound.beep(440, 200)
Sound.beep(680, 200)
Sound.beep(680, 200)
Sound.beep(740, 200)
Sound.beep(740, 200)
Sound.beep(680, 400)

Sound.beep(620, 200)
Sound.beep(620, 200)
Sound.beep(560, 200)
Sound.beep(560, 200)
Sound.beep(500, 200)
Sound.beep(500, 200)
Sound.beep(400, 400)

Sound.beep(680, 200)
Sound.beep(680, 200)
Sound.beep(620, 200)
Sound.beep(620, 200)
Sound.beep(560, 200)
Sound.beep(560, 200)
Sound.beep(500, 400)

Sound.beep(680, 200)
Sound.beep(680, 200)
Sound.beep(620, 200)
Sound.beep(620, 200)
Sound.beep(560, 200)
Sound.beep(560, 200)
Sound.beep(500, 400)

Sound.beep(440, 200)
Sound.beep(440, 200)
Sound.beep(680, 200)
Sound.beep(680, 200)
Sound.beep(740, 200)
Sound.beep(740, 200)
Sound.beep(680, 400)

Sound.beep(620, 200)
Sound.beep(620, 200)
Sound.beep(560, 200)
Sound.beep(560, 200)
Sound.beep(500, 200)
Sound.beep(500, 200)
Sound.beep(400, 400)
很有意思:)

TOP

beep方法内的数字代表什么?

TOP

ri Win32::Sound::beep
复制内容到剪贴板
代码:
----------------------------------------------------- Win32::Sound::beep
     Win32::Sound::beep(frequency, duration)
------------------------------------------------------------------------
     Generates simple tones on the speaker. The function is synchronous;
     it does not return control to its caller until the sound finishes.

     The frequency (in Hertz) must be between 37 and 32767. The duration
     is in milliseconds.
First they ignore you, then they laugh at you, then they fight you, then you win.

TOP

厉害
满天都是小星星

TOP

我靠,厲害啊,听了,哈哈!

TOP

强,不知我的主板喇叭能支持吧!

TOP