Java 原始音频输出
只是想知道 Java 中是否有一个类似于 Python 中的模块 PyAudiere 的库,它只允许您创建音调并播放它们,就像这个示例 Python 代码一样:
device = audiere.open_device()
tone = device.create_tone(500) #create a 500hz tone
tone.play()
tone.stop()
这只是将一个变量分配给您的默认声音设备,然后为该设备发出声音并播放它,然后停止它。有没有像这样使用简单的库?
我感谢所有反馈,谢谢! :-D
Just wondering if there is a library in Java like the module PyAudiere in Python, that simply allows you to create tones and play them, like this sample Python code:
device = audiere.open_device()
tone = device.create_tone(500) #create a 500hz tone
tone.play()
tone.stop()
This simply assigns a variable to your default sound device, and then makes a tone for that device and plays it then stops it. Are there any libraries like this that are as simple to use?
I appreciate any and all feedback, thanks! :-D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在内存中生成声音非常简单。
EG
包含生成音调(并将其存储在
Clip
中)的重要部分在此代码中:Beeper.java
这是显示上面看到的 GUI 的自包含代码。它是一个混合体,可以作为自由浮动框架工作,也可以作为小程序嵌入。
It is pretty simple to generate a sound in memory.
E.G.
The important part of generating the tone (and storing it in a
Clip
) is encompassed in this code:Beeper.java
This is self contained code that shows the GUI seen above. It is a hybrid that will work either as a free floating frame, or embedded as an applet.
如果您同意安装像 Xuggler 这样的额外库,您可以使用这种更短的方式,但它会加载外部文件 - 当然,您也可以在运行时生成声音包。这是教程网站的一个片段。
http://www.xuggle.com/xuggler/downloads/3.1.final.jsp
If you ok with installing additional libs like Xuggler, you can use this shorter way, but it loads an external file - sure, you can also generate the soundpackets on the run. It's an fragment from the tutorials site.
http://www.xuggle.com/xuggler/downloads/3.1.final.jsp