superpoweredSDK / Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.
https://superpowered.com
1.33k stars 285 forks source link

Can I integrated Superpowered's effects independently into iOS's CoreAudio? #784

Closed Lumisilk closed 1 week ago

Lumisilk commented 1 week ago

For business needs (some effects that Superpowered doesn't provide) and simplicity, I need to use Apple's CoreAudio framework as a base.

As an experiment, I wrapped Superpowered's 3BandEQ effect as an Objective-C++ class, used it to create a custom audio unit in Swift and use that unit in AVAudioEngine. As a result, it DOES actually affect my sample audio but it is also producing a buzzing noise.

I couldn't find any examples on the internet of using Superpowered's effects with CoreAudio. Is it necessary to use the whole Superpowered framework (e.g., SuperpoweredIOSAudioIO.mm) as my audio operating framework, or can I use Superpowered's effects independently?

Of course, I'm not 100% sure I did everything correctly in the Objective-C++ wrapping part or the Swift custom audio unit implementation part. I just want to know if it's possible to do it.

ivannador commented 1 week ago

Hello there,

Yes, it is a perfectly valid way to use the Superpowered effects. By implementing a CoreAudio custom effect you should get a processing callback where you could use the Superpowered classes just like as you would use it inside the AudioIO processing loop. Pay attention to using the correct sample rate and number of frames provided by the loop. Also make sure you are using interleaved buffers or interleave them using the Superpowered Interleave/Deinterleave methods. Superpowered expects interleaved buffers.

There is no need to use SuperpoweredIOSAudioIO.mm at all. That is just a convenience class if you want to handle audio IO from low level.

Hope this helps!

Ivan

Lumisilk commented 1 week ago

Didn't know Superpowered expects interleaved buffers. After using Superpowered's Interleave/Deinterleave, everything works fine!

Thank you for rapid replying and helpful info!