Slow waveform generation with audio files larger than 5 seconds
YourOpponent opened this issue · comments
macOS Version(s) Used to Build
macOS 13 Ventura
Xcode Version(s)
Xcode 14
Description
So in the use case I am doing, I have an observed object called a Sample and this sample object gets updated with different sample data, AVAudioFile, SampleBuffer, etc depending on the file that is loaded. Then I pass the SampleBuffer data to the waveform .
Waveform(samples: sample.sampleBuffer)
When the audio file, that the sampleBuffer is created from, is over 3 seconds I start to notice performance issues. It takes a while for the waveform view to populate waveform view.
I work with larger sized audio files and was hoping the render would be faster with GPU acceleration.
Crash Logs, Screenshots or Other Attachments (if applicable)
Slow.Waveform.generation.mov
1m 15s audio file of piano used in video
Piano.mp3.zip
Are you running in release mode? I observed ~.1s time to process your mp3 in the demo app. We did it on the main thread though, and we should move that over to a background thread so the UI is never blocked.
Debug mode was indeed quite slow (9s). Swift is quite bad in debug mode sometimes if you aren't careful. We can work on that.
Thank you! Turning off debug definitely helped and is now extremely fast. Thank you for taking care of the blocking thread so quickly.