Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android sound synthesis

I am trying to play a synthesized sound (basically 2 sine waves and some noise) using the AudioTrack class. It doesn't seem to be any different than the SourceDataLine in javax.sound.sampled, BUT the synthesis is REALLY SLOW. Even for ARM standards, it's unrealistic to think that 32768 samples (16 bit, stereo, for a total of 65536) take over 1 second to render on a Nexus 4 (measured with System.nanotime(), write to AudioTrack excluded). The synthesis part is almost identical to this http://audioprograming.wordpress.com/2012/10/18/a-simple-synth-in-android-step-by-step-guide-using-the-java-sdk/, the only difference is that I play stereo sound (I can't reduce it to mono because it's a binaural tone).

Any ideas? what can I do?

Thanks in advance

like image 524
dosse91214 Avatar asked Apr 29 '13 11:04

dosse91214


People also ask

What is synthesis sound?

Sound synthesis is the technique of generating sound, using electronic hardware or software, from scratch. The most common use of synthesis is musical, where electronic instruments called synthesizers are used in the performance and recording of music.

Is there a synth app?

AudioKit Synth One Synthesizer is a synth app that's been around for a while. Some of its sounds were designed by producers for artists like Kanye West, Rihanna, and M83. Because of this, AudioKit Synth One Synthesizer has the best sounds available on mobile devices.

Can any sound be synthesized?

Most synthesisers are limited to a certain range of sounds. You can't make a minimoog sound like a DX7, or like a real grand piano, or like Michael Jackson singing, or like a complex sound effect in Transformers.


1 Answers

Marko's answer seems very good. But if you're still in the experimental/investigational phase of your project, you might want to consider using Pure Data, which already is implemented as a combination Android library/NDK library and which would allow you to synthesize many sounds and interact with them in a relatively simple manner.

The libpd distribution is the Android implementation of Pure Data. Some good starting references can be found at the SoundOnSound site and also at this site.

Addendum: I found a basic but functional implementation of an Android Midi Driver through this discussion link. The relevant code can be found here (github, project by billthefarmer, named mididriver).

You can view how I use it in my Android app (imSynt link leads you to Google Play), or on YouTube.

like image 104
DigCamara Avatar answered Oct 21 '22 04:10

DigCamara