java 使用java声音实时操作音频和绘制波形
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/523419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
manipulating audio and drawing waveform using java sound in real-time
提问by Dave Carpeneto
I am currently developing an application that helps the user to tune his guitar and generate guitar effects. This is in real-time. I've been looking through java applications that could give an idea to generate guitar effects such as overdrive and delay but I couldn't find any. Also a source on creating a waveform in real time is needed. Your comments would be so much help, thanks in advance.
我目前正在开发一个应用程序,帮助用户调整他的吉他并生成吉他效果。这是实时的。我一直在浏览 Java 应用程序,这些应用程序可以提供生成过载和延迟等吉他效果的想法,但我找不到任何。还需要实时创建波形的源。您的意见会很有帮助,提前致谢。
回答by Dave Carpeneto
Johnsays:
约翰说:
First, forget Java ... Secondly, you will be interfacing with the hardware ... Java does not support this kind of thing.
首先,忘记Java……其次,您将与硬件接口……Java 不支持这种东西。
Jeez, that's kinda harsh - you should have told Sun that this wasn't possible before they published the API for this: http://java.sun.com/products/java-media/sound/. There's lots done with sound in Java, and I've never had an issue with latency or buffers, even on somewhat decrepit hardware.
天哪,这有点苛刻 - 在他们为此发布 API 之前,您应该告诉 Sun 这是不可能的:http: //java.sun.com/products/java-media/sound/。Java 中有很多关于声音的工作,我从来没有遇到过延迟或缓冲区的问题,即使是在有些陈旧的硬件上。
Good examples @ http://www.jsresources.org/examples/index.html
很好的例子@ http://www.jsresources.org/examples/index.html
Good help @ http://java.sun.com/products/java-media/sound/list.html
很好的帮助@ http://java.sun.com/products/java-media/sound/list.html
... having said that, John's comments on learning DSP & waveform analysis are on the $$$.
...话虽如此,约翰关于学习 DSP 和波形分析的评论是在 $$$ 上。
Have fun - Dave
玩得开心 - 戴夫
回答by c'quet
This open source project maybe a good reference for you. There's a function that construct the waveform http://code.google.com/p/musicg/
这个开源项目也许对你来说是一个很好的参考。有一个函数可以构建波形 http://code.google.com/p/musicg/
回答by claj
Regarding the feasabilityof low latency sound processing: Have a look at this article about Harmonicon, a java soft-synth. It's a sample playing synth implemented entirely in java, using the Metronome GC, which has upper latency guaranties in < 2 ms running on a realtime OS.
关于低延迟声音处理的可行性:看看这篇关于Harmonicon 的文章,一个 java 软合成器。这是一个完全用 Java 实现的示例播放合成器,使用Metronome GC,它在实时操作系统上运行时具有 < 2 毫秒的延迟上限。
Regarding wave form generation/dsp, check out the example in this question, Java generating sound, a very simple wave form generation example.
关于波形生成/dsp,请查看此问题中的示例,Java生成声音,一个非常简单的波形生成示例。
回答by John Leidegren
First, forget Java. Java is a managed run-time which does garbage collection. When this happens you will hear shuttering because you wanna keep your sound buffer small to minimize latency,
首先,忘记Java。Java 是进行垃圾收集的托管运行时。发生这种情况时,您会听到快门声,因为您想保持较小的声音缓冲以最大程度地减少延迟,
Secondly, you will be interfacing with the hardware i.e. sound card, Java does not support this kind of thing and so you'll either have to write some hardware abstraction in JNI or find an existing solution, but there's a problem with that to. It's unlikely that you'll get the real-time performance from the Java platform.
其次,您将与硬件接口,即声卡,Java 不支持这种东西,因此您要么必须在 JNI 中编写一些硬件抽象,要么找到现有的解决方案,但这有问题。您不太可能从 Java 平台获得实时性能。
What you wanna do is that you wanna go with C++for this, and you will wanna learn more about partial-differentiation, DSP, sound synthesis and waveform analysis. This is quite a lot to take on but it should give you a good sense of direction if you start reading up on relevant research...
你想要做的是你想要去C++学习这个,你会想要了解更多关于部分微分、DSP、声音合成和波形分析的知识。这是相当多的事情,但如果你开始阅读相关研究,它应该会给你一个很好的方向感......

