Board logo

标题: 如何让一个批处理鸣唱? [打印本页]

作者: uiopuiop     时间: 2008-9-24 22:36    标题: 如何让一个批处理鸣唱?

有没有什么办法让一个批处理读取一个文本文件,然后“鸣唱”?

类似与汇编编写的音乐一样。

http://zhidao.baidu.com/question/28984103.html?fr=qrl

本人作品见三楼,多多指教。。。

[ Last edited by uiopuiop on 2008-9-25 at 07:39 PM ]
作者: tireless     时间: 2008-9-24 22:48
可以鸣叫,可以说话,唱歌...
作者: uiopuiop     时间: 2008-9-24 23:02    标题: JAMES BOND -- 007主题曲

JAMES BOND 主题曲, 已经更新,完整版本看附件,化了我一晚上敲键盘打出来的。。。。。吹牛ING)

看到KIX 的脚本可以做到,不知道有没有其他更容易的办法。
如果有软件能将一个MP3转换成这些字符串就好了。

WKIX32.EXE play.kix

play.kix (JAMES BOND 主题曲)
-----------------------------------------------------------
PLAY        "0g256t 0g8d247f 4d165f 247f 8d262f 4d165f 262f 8d277f 4d165f
        277f   8d262f   4d165f 262f 8d247f 4d165f 247f 8d262f 4d165f
        262f   8d277f   4d165f 277f 8d262f"
-------------------------------------------------------------
The string or file consists of a sequence of commands indicating the frequency and duration of the tones to play. The following commands are available:
•        F or f - frequency
This command causes a tone to be produced at the current frequency. The initial current frequency is 1000Hz. To change the value, indicate the desired frequency immediately followed by the f character. For example, to produce a tone at 1500Hz, specify 1500F.
•        G or g - gap
This command sets the number of timer ticks (1 second = 18 ticks) of silence between individual tones. The number of timer ticks between tones is specified as a number immediately followed by G. The initial value is 0.
•        D or d - duration
This command sets the length (in timer ticks) of each tone. For example, to make each tone last about a third of a second, use the command 6d.
•        T or t - tempo
This command scales the duration of each tone. This allows you to change the duration of a series of tones globally, without having to change each of the individual duration commands.A tempo value of 256 indicates normal tempo. A value of 4df lasts:
•        2 timer ticks, when the tempo is set to 128
•        4 timer ticks, when the tempo is set to 256
•        8 timer ticks, when the tempo is set to 512

还可以播放WAV文件:
play2.kix
play file "C:\WINDOWS\Media\Windows XP Shutdown.wav"

[ Last edited by uiopuiop on 2008-9-25 at 06:08 PM ]
附件 1: 007.music.zip (2008-9-25 17:34, 148.11 K,下载次数: 63)

作者: uiopuiop     时间: 2008-9-24 23:18


  Quote:
Originally posted by tireless at 2008-9-24 10:48 PM:
可以鸣叫,可以说话,唱歌...

请问高手是如何让批处理 “说话” 的?  哈哈,播放WAV文件不算哦。
作者: tireless     时间: 2008-9-24 23:21
以下引自 http://bbs.verybat.org/viewthrea ... hlight=%CB%B5%BB%B0
@echo off
title 爆笑机器人说话(发音不太标准)
echo 国语:好好学习,天天向上!认真学习P处理。
mshta vbscript:createobject("sapi.spvoice").speak("hou hou share she, tian tian xiang shang, ren zhen share she P chu li.")(window.close)

@echo off
title 爆笑机器人说话(发音不太标准)
echo 鸟语?!:大家好,俺是机器人,俺也学习批处理,俺最稀罕非常批处理,俺在东北
mshta vbscript:createobject("sapi.spvoice").speak("dar jia hou, an she ji qi ren, an year share she P chu li, an zui she han fei chuang P chu li, an zai dong bei")(window.close)
----------------------------------------------------------------------------
可爱批处理——听听鬼佬说中文
http://bbs.verybat.org/thread-4101-1-1.html

[ Last edited by tireless on 2008-9-24 at 03:28 AM ]
作者: uiopuiop     时间: 2008-9-24 23:43
强! 无语。。。。

学无止境。

不知道有没有让批处理鸣叫 (不用第三方工具)的方法?

[ Last edited by uiopuiop on 2008-9-24 at 11:44 PM ]
作者: zqz0012005     时间: 2008-9-25 00:45
echo 
那个黑点是在cmd中按Ctrl+G生成的
作者: uiopuiop     时间: 2008-9-25 11:34


  Quote:
Originally posted by zqz0012005 at 2008-9-25 12:45 AM:
echo 
那个黑点是在cmd中按Ctrl+G生成的

就一个嘟音,有没有其他的声音啊?

echo ^G>test.txt

type test.txt (鸣叫一次)

或者: 先 echo ^@type ^>nul 2^>^&1 >test.bat


test.bat 内容为:
type >nul 2>&1

或者:echo echo >test.bat
test.bat (鸣叫两次)

或者: 想什么时候叫就什么时候叫

set beep=
echo %beep% %beep% %beep%

[ Last edited by uiopuiop on 2008-9-25 at 02:43 PM ]
作者: bluewaterx     时间: 2008-9-25 15:34
你试试,包你满意

@echo off
echo set mp3=createobject("wmplayer.ocx")>ps.vbs
echo mp3.url="%windir%\Help\Tours\WindowsMediaPlayer\Audio\Wav\wmpaud5.wav">>ps.vbs
echo wscript.sleep 1000>>ps.vbs
echo wscript.sleep mp3.currentmedia.duration*1000>>ps.vbs
echo wscript.quit(1)>>ps.vbs
start ps.vbs
作者: uiopuiop     时间: 2008-9-25 18:14
不错,看看我3楼附件里的作品。如果再跳点动画就更COOL了。
作者: bluewaterx     时间: 2008-9-25 18:25


  Quote:
Originally posted by uiopuiop at 2008-9-25 06:14 PM:
不错,看看我3楼附件里的作品。如果再跳点动画就更COOL了。

我机箱里的腊巴线我没插,开机时的嘀嘀声半夜听起来太吵了坏了-.=
作者: zqz0012005     时间: 2008-9-25 18:46
要说正宗中文,见此贴:利用TTS实现中英文混读
http://bbs.verybat.org/thread-13024-1-1.html

最简单的纯vbs音乐播放器
http://bbs.verybat.org/thread-13026-1-1.html
作者: radem     时间: 2008-9-26 00:47
verybat不是关了吗
作者: tireless     时间: 2008-10-1 15:57    标题: 3 个鸣叫的 .com 文件

CHIME.COM 一段旋律
http://upload.cn-dos.net/img/805.rar

RING.COM 铃声
http://upload.cn-dos.net/img/806.rar

SIREN.COM 警报声
http://upload.cn-dos.net/img/807.rar

以上三个文件的参数:
                            n 鸣叫次数 (默认为 1)
                            /c 直到用户按键才停止鸣叫
作者: kaikai163     时间: 2008-10-3 13:07
太强大了!
作者: uiopuiop     时间: 2008-10-3 20:43    标题: 生日快乐 的汇编的蜂鸣器音乐代码

下载了生日快乐的汇编代码,但不知道则么用MASM32 Editor编译。

代码见附件,有哪位懂汇编的人帮忙编译一下。(搞成*.com 文件)
能加上类似与14楼的*.com的 参数最好。(参数:  n 鸣叫次数  /c 直到用户按键才停止鸣叫 )


参考:
汇编的蜂鸣器音乐代码
http://bbs.pediy.com/showthread.php?t=27972

架设WIN32汇编程序的开发环境 -http://blog.chinaunix.net/u/25102/showart_250486.html

[ Last edited by uiopuiop on 2008-10-3 at 20:50 ]
附件 1: happy_birthday v1.zip (2008-10-3 20:43, 1.17 K,下载次数: 2)