New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AK 4.7 excessive CPU usage and audio sputtering. #1763
Comments
Glad to help! :-) But, sorry to say I will be out of town and basically off the grid for the next two weeks and can't compute again until May 16. I trust your firepower will figure it out! |
@WholeCheese can you give us some insights on how you're generating those sine waves? |
Maybe Aurelius can help you with that? I sent him a test app last week to demonstrate an envelope problem I was having. That app, PlayChime, is a very simple example of what I am doing but can be easily scaled up to create a more complex mix. The CPU usage is only an issue when notes are playing. I'd send you the app but I'm in Fiji for two weeks with very limited wifi and just my phone.
… On May 3, 2019, at 3:47 AM, Matt Sieren ***@***.***> wrote:
@WholeCheese can you give us some insights on how you're generating those sine waves?
I'm thinking we should setup a small test-app where we can swap out AK versions to bisect where the problem originated.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Cool! That'd good to know. I'll ping @aure directly and will get it from him |
I'm looking at the PlayChime App right now and I get roughly 20% on an iPhone 8 with the most complex setting (and that's in Debug mode as well). On first look I couldnt find anything suspicious. Which device were you using and are your measurements in line with the sample app? |
The 20% increase in cpu usage that I saw was when I swapped AK4.6 to AK4.7 in my HarmonicChimes app. The increase was the same on pad and phone. My usage testing observation was with the HarmonicChimes app not the playchime app. The PlayChime app may need to be beefed up a bit to demonstrate a similar oscillator usage level. I can’t look at the code until May 17th so can’t tell you which line or source file. But look for where it connects oscillators and envelopes and add a bunch more. Hope that helps! One last thought: the HarmonicChimes app uses reverb in the final mix whereas the demo app does not.
… On May 12, 2019, at 12:39 AM, Matt Sieren ***@***.***> wrote:
I'm looking at the PlayChime App right now and I get roughly 20% on an iPhone 8 with the most complex setting (and that's in Debug mode as well).
On first look I couldnt find anything suspicious.
Which device were you using and are your measurements in line with the sample app?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@WholeCheese when you're back I'd love to do a screenshare with you to look at the two version of your code with 4.6 and 4.7 to see the change in cpu usage first hand. |
It'd be great if we could all get on a Slack call and do some screen sharing |
Back from vacation and looking at the CPU usage difference between AK 4.6.4 and AK 4.7 with the PlayChime demo app. Attached is the demo app and two screen shots showing the CPU usage: one for AK4.6 and one for AK4.7. There were no changes to the demo code other than linking with one AK or the other. The two blips at the beginning of the CPU graph are from selecting the "Alto" chime, or number 4 in the segmented controller UI. The long blip happens in the AURemoteIO thread after hitting "Play" This was run on a iPhone 5S and iOS 11.3. |
Oops, my tests were on the simulator. I'll test on a device now. |
Your results have me baffled! I ran my test on a real iPhone. AK4.6 was built with Swift 4.2 and AK4.7 with Swift 5.0. My code was 5.0 for both. I ran on a real iPhone 5s iOS 11. I will run again tomorrow on a 12.0 iPad.
… On May 17, 2019, at 9:12 PM, Aurelius Prochazka ***@***.***> wrote:
Oh I should ask are you running on a device? My tests were on the simulator. I'll test on a device now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
My feeling is that 28% on an iPhone X is probably about 67% on the iPhone 5s. So, that would say that I haven't been able to get the improved 20% on the iPhone 5s ie say 7% on an iPhone X. I would love to get that kind of performance boost. |
Oh, dear. This was my blunder. Many, many sincere apologies!! My AK4.6.4 project settings for Clang and Swift optimization (debug build) were set to -O3 and -O respectively. The AK4.7 Clang and Swift optimization settings (debug build) were -O0 and -Onone Changing AK4.7 to fastest to match 4.6.4 results in nearly identical CPU usage. I don't recall setting the optimization options but the finger appears to point in my direction? As to why my AK4.6.4 project was set to Swift 4.2, again, I don't recall changing that, and actually had the impression that the move to Swift 5.0 started with AK4.7. AK4.6.4 builds fine with 5.0 but that had little if any effect on the CPU usage. I am truly sorry about calling for this witch hunt. Please don't exile me from the club!! |
Haha oh no! I actually mentioned that as a possibility to @aure but figured that's the first place you might have looked hehe. Glad you got it solved! :) |
No worries. Its always good to look at the efficiency of AudioKit with very skeptical eyes and ears! I'm glad you got it sorted and you're definitely not exiled! |
I have been comparing CPU usage between Audiokit 4.7 and 4.6.4. I confess that my app may be pushing things to a limit but it has been working very well so far with AK 4.0 and just recently AK 4.6.4.
My app simulates wind chimes by additive sine wave synthesis. I am testing the CPU usage on two chimes:
A simple chime that plays 7 notes and a more complex chime set with 23 notes.
The simple 7 note chime uses a sound with 3 oscillators and envelopes for each note. In total, that's 8 mixers, 21 oscillators and 21 envelopes.
The complex chime uses 23 notes with 28 mixers, 75 oscillators, and 75 envelopes.
AK 4.0.4 and AK 4.6.4 are roughly equivalent but there is a huge difference between AK 4.6.4 and 4.7.
Simple Chime
Complex Chime
The excessive CPU usage is a problem since I expect my app to be played in the background and iOS will generally kill apps in the background that use too many resources.
The audio sputtering is the real problem.
Since AK 4.6.4 does not exhibit any more CPU usage than AK 4.0.4, I am assuming that something bad has creeped into the AK 4.7 code.
Suggestions??
The text was updated successfully, but these errors were encountered: