使机箱内的小喇叭发出不同的声音
Mmsound.drv 是小喇叭的系统接口 ,很多API的书都有用法介绍
- 219 张晶
回答2:
使用VB中的beep语句,但这只能发出一种声音。如果想发出不同声音,可以
使用API函数。详情如下:(摘自VB-Helper)
Use the Beep API function.This example demonstrates two interesting things. First, it shows how to
make a beep of any frequency and duration rather than using the standard
tone you get with the Beep statement.Second, note that the Beep API function has the same name as Visual
Basic's Beep statement. To differentiate them, you can assign a new name
to the Beep API function in its Declare statement. It is known as "Beep"
in the library (the Alias statement) but it is known as APIBeep to the
program.You can use this technique to differentiate between functions with the
same name, or you can use it to give API functions a name that is easier
to write (for example, if the API name is very long).In the declarations section:Option Explicit
Private Declare Function APIBeep Lib "kernel32" Alias "Beep" ( _
ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
To make a beep lasting 500 milliseconds with frequency specified in the
TextBox txtFrequency (try 1000 for starters):Private Sub Command1_Click()
Dim frequency As Longfrequency = CLng(txtFrequency.Text)
APIBeep frequency, 500
End Sub
- Prisoner
Mmsound.drv 是小喇叭的系统接口 ,很多API的书都有用法介绍
- 219 张晶
回答2:
使用VB中的beep语句,但这只能发出一种声音。如果想发出不同声音,可以
使用API函数。详情如下:(摘自VB-Helper)
Use the Beep API function.This example demonstrates two interesting things. First, it shows how to
make a beep of any frequency and duration rather than using the standard
tone you get with the Beep statement.Second, note that the Beep API function has the same name as Visual
Basic's Beep statement. To differentiate them, you can assign a new name
to the Beep API function in its Declare statement. It is known as "Beep"
in the library (the Alias statement) but it is known as APIBeep to the
program.You can use this technique to differentiate between functions with the
same name, or you can use it to give API functions a name that is easier
to write (for example, if the API name is very long).In the declarations section:Option Explicit
Private Declare Function APIBeep Lib "kernel32" Alias "Beep" ( _
ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
To make a beep lasting 500 milliseconds with frequency specified in the
TextBox txtFrequency (try 1000 for starters):Private Sub Command1_Click()
Dim frequency As Longfrequency = CLng(txtFrequency.Text)
APIBeep frequency, 500
End Sub
- Prisoner
解决方案 »
- 【数学】不差的「来看看」,求一个简单的『+-*/』算法。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
- 用CreateWindowEx创建RichEdit遇到的问题
- vb学习7天后遇到的问题
- 请指教会员软件的功能
- 一个SQL查询的问题!在线等,立即给分!
- 服务器中多个winsock 同时发送信息时出现的问题
- 急!如何在运行时加载用户控件?请高手赐教
- 调用SHFileOperation问题进行文件COPY的取消问题
- 如何统计ActiveX Dll实例的数目?
- 如何設定動態新增到form上的richtextbox 的scrollbars屬性
- 再次请教高手,我下面是一段自己的代码,可以调出现在有作图程序的菜单,但如何用,请指教
- 多色位图转变为只有指定数量颜色的位图
我要的不是 不同频率
而是 不同音色!
频率=音调
波形=音色
振幅=响度
这是 基本的物理知识
beep 只有一种音色
但是我已经能 用它读出notes来了
我要的是 不同的音色 比如violin guitar piano最上面的 这个 你已经贴过一次了吧