Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
我的第一个建议是不要使用 Java 进行 DSP 实现。 我的第二个建议是自己用 Java 实现简单的 DSP。
为什么不使用 Java:
在过去 10 多年里,我在编写 DSP 代码方面拥有丰富的经验......而且几乎没有 DSP 代码是用 Java 编写的...所以当我犹豫是否要阅读有关某人想要用 Java 实现 DSP 的文章时请原谅我。
如果您要做重要的 DSP,那么您不应该使用 Java。 DSP 在 Java 中实现起来如此痛苦的原因是因为所有好的 DSP 实现都使用低级内存管理技巧、指针(疯狂数量的指针)、大型原始数据数组等。
为什么使用 Java:
如果您正在做简单的 DSP 工作,请推出您自己的 Java 实现。 像 PSD 和滤波这样的简单 DSP 东西都相对容易实现(实现简单,但速度不会很快),因为网上有太多的实现示例和详细记录的理论。
就我而言,我在 Java 中实现了一次 PSD 函数,因为我在 Java GUI 中绘制 PSD 图形,因此最简单的方法是在 Java 中降低性能并在 Java GUI 中计算 PSD,然后绘制它。
如何实现 PSD:
PSD 通常只是以 dB 为单位显示的 FFT 幅度。 有许多来自学术、商业和开源的示例展示了如何计算 FFT 的幅度(以 dB 为单位)。 例如 Apache 有一个 Java 实现,可以为您提供 FFT 输出然后你只需要转换成幅度和dB。 FFT 之后的任何内容都应根据您的需要/想要进行定制。
如何实现低通、带通滤波:
我认为最简单的实现(不是计算效率最高的)是使用 FIR 滤波器并进行时域卷积。
卷积非常容易实现,它是两个嵌套的 for 循环,并且网上有数百万个示例代码。
如果您对滤波器设计一无所知,FIR 滤波器将是棘手的部分。 最简单的方法是使用 Matlab 生成 FIR 滤波器,然后将系数复制到 java 中。 我建议使用 Matlab 中的 firpmord() 和 firpm()。 在阻带中实现 -30 至 -50 dB 衰减,在通带中实现 3 dB 纹波。
My first suggestion is to not do your DSP implementation in Java. My second suggestion would be to roll your own simple DSP implementations yourself in Java.
Why not to use Java:
I have lots of experience writing DSP code over the last 10+ years... and almost none of the DSP code is in Java... so forgive me when I am hesitant to read about someone who wants to implement DSP in Java.
If you are going to be doing non-trivial DSP then you shouldn't be using Java. The reason that DSP is so painful to implement in Java is because all the good DSP implementations use low level memory management tricks, pointers (crazy amounts of pointers), large raw data arrays, etc.
Why to use Java:
If you are doing simple DSP stuff roll your own Java implementation. Simple DSP things like PSD and filtering are both relatively easy to implement (easy implementation but they won't be fast) because there is soo many implementation examples and well documented theory online.
In my case I implemented a PSD function in Java once because I was graphing the PSD in a Java GUI so it was easiest to just take the performance hit in Java and have the PSD computed in the java GUI and then plot it.
How to implement a PSD:
The PSD is usually just the magnitude of the FFT displayed in dB. There are many examples from academic, commercial and open-source showing how to compute the magnitude of the FFT in dB. For example Apache has a Java implementation that gives you the FFT output and then you just need to convert to magnitude and dB. Anything after the FFT should be tailored to what you need/want.
How to implement lowpass, bandpass filtering:
The easiest implementation (not the most computationally efficient) would in my opinion be using an FIR filter and doing time domain convolution.
Convolution is very easy to implement it is two nested for loops and there are literally millions of example code on the net.
The FIR filter will be the tricky part if you don't know anything about filter design. The easiest method would be to use Matlab to generate your FIR filter and then copy the coefficents into java. I suggest using firpmord() and firpm() from Matlab. Shoot for -30 to -50 dB attenuation in the stopband and 3 dB ripple in the passband.
我找到了Java数字信号处理这本书及其示例源代码。 您可以查看代码以查看它是否符合您的需求。
您还可以查看 DSP 实验室。
正如 duffymo 和 basszero 在评论中提到的,自 Java DSP 发布以来,Java 发生了一些变化,可能会影响一些代码示例。 特别是,(相对)新的并发实用程序包可能会证明有用。
I found the book Java Digital Signal Processing and its example source code. You might look through the code to see if it fits your needs.
You can also check out DSP Laboratory.
As duffymo and basszero mentioned in the comments, there have been changes to Java since the publication of Java DSP that may impact some of the code examples. In particular, the (relatively) new Concurrency Utilties package might prove useful.
我编写了一些 Java DSP 类的集合,例如 IIR 滤波器:
Java DSP 集合
I have written a collection of some Java DSP classes, e.g. IIR filters:
Java DSP collection
看起来相当稀疏。 尝试 Signalgo 或 jein 或 英特尔信号处理库,尽管我认为最后一个只是一个 JNI 包装器。
我看到了很多你所说的小程序。 我认为您也许可以获得它们的 JAR 并使用其中的类 API。 不过,由于缺乏文档,可能必须使用 eclipse 和 jad 来反编译并弄清楚它们的作用。 例如,尝试此页面上的源代码。
It looks pretty sparse. Try Signalgo or jein or the Intel Signal Processing Library, although I think the last one is just a JNI wrapper.
I saw a lot of those applets you were talking about. I think you may be able to get the JARs for them and use the class APIs inside. May have to use eclipse and jad to decompile and figure out what they do, though, due to lack of documentation. Try the source on this page for example.
我找到了另一个资源,尽管它不是一个库: http://www.dickbaldwin.com/tocdsp.htm 。 这只是信号处理和傅里叶变换的基本讨论,并带有一些 Java 示例。 请参阅示例教程 1478、1482、1486。不确定代码上的许可证是什么。
I found another resource, although it's not a library: http://www.dickbaldwin.com/tocdsp.htm. It's just a basic discussion of signal processing and Fourier transform, with some Java examples. See for example tutorials 1478, 1482, 1486. Not sure what the license on the code is.