Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Superpowered audio engine for Unity. Free plugin

Discussion in 'Assets and Asset Store' started by 00christian00, Apr 7, 2016.

  1. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,032
    So I had to learn to code mobile plugin and Unity just happened to have a bug with onAudiofilterRead allocating memory continuously so I took the chance to look into porting this awesome audio engine to Unity.
    You can find the code here:

    EDIT: Sorry, in the process of a major overhaul to make it easier to use.
    Will post it back once it's ready!


    The code is less than alpha(mostly a mock up), but should be stable in a few days.
    Already allows playing files from disk and filling the audio buffer like onAudioFilterRead.
    In my test the same scenario running on iphone 4 was consuming 60-80% cpu on Unity audio engine, while with Superpowered only 50% and that was using the callback to fill the buffer manually. Playing audio files should have even greater impact, since the code(not mine, but superpowered) it's hand optimized with machine code. The engine should also have much lower latency than Unity.

    You can find the features here:
    http://superpowered.com/

    It has been around 10 years since I coded in c++, and I couldn't even remember how to copy a string...
    objective c, plus android ndk, java, mono interop, all new... quite a lot to take in, in the last 4 days.

    Special thanks to natbro for providing such a wornderful example of working with callbacks from native code.
    For anybody in need to do callback from plugin, look here:
    https://github.com/natbro/UnityPlugin

    Also special thanks for @JoshPeterson for being always so helpful!
     
    Last edited: Apr 11, 2016
    landon912 and HiddenMonk like this.
  2. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Cool. Could you add support for desktop platforms (Windows/Linux mainly, since OSX is already supported) and module files (xm, it, s3m, mod) playback (since Unity's built-in audio doesn't loop them correctly)
     
  3. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,032
    Something like this maybe ;) :
    http://screencast.com/t/8ekq7nxdzl4

    You are probably talking of my "Alive music engine" which is basically a DAW embedded in Unity and can play tracker modules, swap instruments at runtime(see in the video when the guitar become a flute), volume/pitch automation, dynamic sample loading, 16-8 bit sample downscaling, audio note events( the particles in the video are fired by the notes, and the position is matched by the note semitone), custom events in tracker songs, store instruments and sample as json to load from network.

    Sorry I can't share that :(
    It's a big part of my super secret game, which will have many other unique features.

    Regarding platform support, Superpowered SDK itself only support Android and iOS(and the low level code is closed source)
     
    Last edited: Apr 8, 2016
    theANMATOR2b likes this.
  4. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Well, I don't need that visual fluff, like note events, instrument swap or custom effects. All I really need is something that plays modules correctly, looping where any sane mod player or tracker (like OpenMPT) would loop (Bxx effect). Anything more than that isn't needed for me.
     
  5. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,032
    Polished the code, should be in beta now.
    I also added a desktop wrapper(no it doesn't use Superpowered at all) so you can test in the editor.

    I need to rewrite the audio callback handling since due to the static method constraint of iOS now the buffers need to be static too, so I need to allocate some static pool pointing to these buffers.

    Soon I'll also add compressor, reverb and the other fx.
     
  6. raglet

    raglet

    Joined:
    Nov 22, 2015
    Posts:
    30
    Hey 00christian00,

    This is awesome news! I've been looking for a way to get really low latency in unity and couldn't find anything for a long time. I'm really hoping your Superpowered unity plugin helps solve this issue. Honestly, I'll be more that happy to pay for this asset. So what is the status on this?
     
  7. NeilW

    NeilW

    Joined:
    May 29, 2014
    Posts:
    40
    Hey - this also sounds like it could be the answer I've been looking for to use on a couple of music/game projects. I started looking at G-Audio which looked hopeful but it has broken with the latest unity versions and doesnt seem to be supported any more unfortunately. Will be very interested to take a look when you have something to share

    Cheers!
     
  8. rekerukuru89

    rekerukuru89

    Joined:
    Aug 31, 2016
    Posts:
    9
    I'm interested too !
    Seems to be a needed feature to replace the unity audio !
     
  9. HeyItsLollie

    HeyItsLollie

    Joined:
    May 16, 2015
    Posts:
    68
    I found this thread looking for a way to play xm/it/s3m/mod files in Unity properly, and what you have here looks great. I'm in a similar boat as Darkhog, I don't need DAW-level access to sample parameters or audio note/custom events, just a player that enables better support for tracker modules in Unity.

    What I'd love to see from a module player is:
    • Support for general tracker effects. (anything that uses a "0xy"-command, like loop triggers)
    • Pattern seeking. Tell a module to begin at a specific pattern, or a call to skip to another pattern immediately/at end of current pattern.
    • Per-channel access through Unity's audio mixer, for volume control and effects via Unity itself.
    I know this thread is for an asset supporting a different audio engine, but I do hope that you consider releasing your module player as its own asset. Beyond the odd answered question here and there, there's nothing else that's readily available.
     
  10. notsteve

    notsteve

    Joined:
    Dec 13, 2013
    Posts:
    18
    Is this a real thing?

    "The code is less than alpha(mostly a mock up), but should be stable in a few days."

    …doesn't seem to agree with the website:

    "Superpowered powers hundreds of millions of app installs on iOS & Android"
     
  11. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,554
    Is it really working? Because after digging into the GitHub project I discovered that :

    1. SuperpoweredInternal.cpp is missing. The counterpart SuperpoweredInternal.h is there, and it is the point that interfaces with Unity so in the end I could not compile a library without .cpp.
    2. There are 2 part of Android plugins, the c++ and Java. The C++ is as I said is missing SuperpoweredInternal.cpp, and the Java part I could not find any information about making the com.superpowered.SuperpoweredAndroid. This part is supposed to register the sound file and returns the soundId so that the next time I can call directly into c++ code with this ID.
     
  12. zacharyaghaizu

    zacharyaghaizu

    Joined:
    Aug 14, 2020
    Posts:
    65
    hi did you manage to use superpowered?
     
  13. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,554
    Wow what a necro.. no I didn't. But the gist of it is that superpowered require manual hack (add a better media server) on the Android firmware to achieve the gain in their "10 ms solved" video, then the library will take advantage of it. Of course we cannot expect that to our players. It is for manufacturer of custom Android based device to push the limit. (think a touch screen table with Android underneath, and you want the sound to come out faster before you sell the table)

    Without that, SuperPowered still provide some DSP methods to play with, could be great for DJ apps still. But latency wise it cannot win against the fastest and dumbest way to play with OpenSL ES/AAudio/Oboe on native Android. That is the theoretical limit. (Which, is what my Native Audio plugin is doing but from comfort of Unity.)
     
    zacharyaghaizu likes this.
  14. zacharyaghaizu

    zacharyaghaizu

    Joined:
    Aug 14, 2020
    Posts:
    65
    Okay thanks. Did you see my email regarding loading mp3's and recording mp3's at runtime in an android app?