Ruby 在 Windows 下播放声音

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require "win32ole"

sound = WIN32OLE.new("MCI.MMcontrol")

wav = "c:\\windows\\media\\The Microsoft Sound.wav"
sound.fileName = wav

sound.autoEnable = true

sound.command = "Open"
sound.command = "Play"

sleep 7