Android Audio Input Output, Frequency Domain, Time Stretching
Superpowered Audio SDK Updates
It has been an exciting week over here at Superpowered HQ. Not only did our take on Android’s 10 Millisecond Problem: The Android Audio Path Latency Explainer bring down our server on the back of a Reddit onslaught -- we also been busy improving the Superpowered Audio SDK. And we're happy to announce many improvements and some new, (super)powerful features:
1) Improved Superpowered Time Stretching
- Even higher audio quality with 10% lower CPU usage. Better bass response in the 0.5-0.75 range.
- More, finer pitch shift options: 1 cent resolution from -2400 (two octaves down) to 2400 (two octaves up).
- Rate has been extended to the 0.01-4x range.
2) New feature: Superpowered Frequency Domain
Transforming audio from time-domain to frequency-domain and back is not trivial, because it involves:
- FFT (Fast Fourier Transform).
- Polar transformation to get the polar components of magnitude and phase from complex numbers.
- Window functions and overlapping.
- Buffering to connect the various buffer sizes of time domain audio to the fixed FFT size.
The SuperpoweredFrequencyDomain feature solves all with a very simple API call: time-domain audio goes in, magnitudes and phases come out. Or vice-versa. No need to dig deep into FFT if that’s not your bailiwick.
The Superpowered Frequency Domain is a singular audio DSP feature, and also the fastest solution with the highest performance on mobile devices. It is, at minimum, 2.5 times faster than an Apple vDSP implementation.
The Superpowered Audio SDK has a simple frequency domain example project for both iOS and Android. You can work with magnitudes and phases within minutes, and implement your own linear phase EQ for example!
Superpowered Frequency Domain has an interesting twist too: you can define the value of Pi.
You can leave it at 3.14xxx, but some algorithms that work with phases greatly benefit if Pi is translated to something else, such as 1.0 or 0.5.
3) New feature: Superpowered Android Audio IO
Android NDK audio input/output using OpenSL ES is quite complex. This class is an easy-to-use solution for your audio input, audio output or both.
Using Superpowered Android Audio IO, you no longer need to write looooooong spaghetti OpenSL ES code or even manage audio buffers at all! The class is implemented with a very efficient FIFO buffer with adjustable latency, and it is completely open source.
When used for both audio input and output, Superpowered Android Audio IO solves the synchronisation problem between the audio input thread and the audio output thread too. Your application’s processing callback will be called only once on the audio output thread, with the audio input available on the same buffer as you change to audio output.
In other words, it’s very-very similar to iOS design patterns and the Superpowered iOS Audio Output class. Check the Android example projects in the SDK on how to use.
4) Simplified Simple Audio Transformations
We’ve removed all simple static transformations from Superpowered Stereo Mixer, and organized them into a new file with more features. The SuperpoweredSimple.h has the following simple functions:
- SuperpoweredVolume and SuperpoweredChangeVolume: changes volume with smooth ramp.
- SuperpoweredVolumeAdd and SuperpoweredChangeVolumeAdd: similar to the functions above, but adds audio to existing audio data.
- SuperpoweredPeak: returns with the peak value
- SuperpoweredFloatToShortInt: 32-bit floating point to 16-bit signed integer conversion.
- SuperpoweredShortIntToFloat: 16-bit signed integer to 32-bit floating point conversion.
- SuperpoweredInterleave: interleaves audio from two mono buffers into a stereo one.
- SuperpoweredDeInterleave: de-interleaves audio from a stereo buffer into two mono buffers
- README.txt has now a quick tutorial for setting up Android Studio.
- SuperpoweredAudiofilePlayer removed in favor of SuperpoweredAdvancedAudioPlayer.
- Advanced Audio Player: beatIndex is more precise.
- Superpowered Decoder and Advanced Audio Player: support for ADTS .aac files.
- SuperpoweredPolarFFT: valueOfPI parameter.