Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java for Audio Processing is it Practical?

Tags:

Is Java a suitable alternative to C / C++ for realtime audio processing?

I am considering an app with ~100 (at max) tracks of audio with delay lines (30s @ 48khz), filtering (512 point FIR?), and other DSP type operations occurring on each track simultaneously.

The operations would be converted and performed in floating point.

The system would probably be a quad core 3GHz with 4GB RAM, running Ubuntu.

I have seen articles about Java being much faster than it used to be, coming close to C / C++, and now having realtime extensions as well. Is this reality? Does it require hard core coding and tuning to achieve the %50-%100 performance of C some are spec'ing?

I am really looking for a sense if this is possible and a heads up for any gotchas.

like image 474
JeffV Avatar asked Jan 02 '09 18:01

JeffV


People also ask

What is the best programming language for audio processing?

Faust (Functional Audio Stream) is a functional programming language for sound synthesis and audio processing with a strong focus on the design of synthesizers, musical instruments, audio effects, etc.

What are the two types of audio processing?

Two approaches are used for computer generated speech: digital recording and vocal tract simulation. In digital recording, the voice of a human speaker is digitized and stored, usually in a compressed form. During playback, the stored data are uncompressed and converted back into an analog signal.


1 Answers

For an audio application you often have only very small parts of code where most of the time is spent.

In Java, you can always use the JNI (Java Native interface) and move your computational heavy code into a C-module (or assembly using SSE if you really need the power). So I'd say use Java and get your code working. If it turns out that you don't meet your performance goal use JNI.

90% of the code will most likely be glue code and application stuff anyway. But keep in mind that you loose some of the cross platform features that way. If you can live with that JNI will always leave you the door open for native code performance.

like image 134
Nils Pipenbrinck Avatar answered Sep 21 '22 15:09

Nils Pipenbrinck