-
Notifications
You must be signed in to change notification settings - Fork 536
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
[WIP] Add AVFoundation Loader and MonoLoader. #1153
base: master
Are you sure you want to change the base?
Conversation
Update: I fixed some memory management and whitespace issues. Anyone looking to copy this code should note that in the current release, |
Hi, your work looks great. Thanks for that. But, would you like to describe how can I use this in my iOS project for calculating MFCC values of a local audio file? |
Hi @rahul140490, this merge request merely adds a file loader that uses If you need reference code, I've got a project up that interfaces between Essentia and Objective-C here. The project file also automates the setup of Essentia, but in general, I'll refer to Essentia's own install docs for these things. Cheers |
Hi @Ivorforce, thank you for the PR, this is something that is definitely interesting to support in Essentia. So as I understand you did not use waf to build? It suppose is possible to have Objective-C++ files and use our current build system but I haven't looked at it. Our build script creates a list of algorithms to include to AlgorithmFactory here. One thing to think about is whether we should re-use the same algorithm names (that is For example, in the build script we have a flag to select the FFT type, which will then use a specific algorithm class for the FFT implementation and ignore other algorithms. We have |
@dbogdanov Correct, I did not use Waf to build the project. Basically, I wrote the files for my own project (where they run fine) and figured these could be a useful addition to Essentia itself. Coming from OOP, I would have suggested to have at least MonoLoader implemented as a template to some AudioLoader. I guess compiling against a specific kind of AudioLoader would be an alternative solution - while imo it would be a bit restrictive for a user to have to decide for one of the loaders at compile time, I don't feel too strongly on this. Switching in a running application is fortunately not a use-case for me. |
We'll keep this PR pending as we'll need to look at updating the waf build script accordingly. |
What
I copied and adapted the default AudioLoader and MonoLoader classes to load using AVFoundation rather than ffmpeg. These are separate loaders that can be run natively on apple products (macOS, iOS, ipadOS), and nowhere else.
This PR is a proof of concept. Let me know if there is any interest in pursuing this endeavour further.
Why
AVFoundation is powerful and fast. For mac users or apps, there is no need for an additional dependency to ffmpeg.
ToDos
I've very shoddily implemented and tested these loaders. As far as my tests go right now, they produce identical results to the ffmpeg loaders.
There's a bunch of things not right with the code, as one can easily see. Some I've annotated, but here's a quick list ordered by size / importance:
To be honest, I don't know how this project is set up exactly. I'm additionally not familiar with waf or the build setup, and while I did get it to compile and run on my end, the setup might be suboptimal. I'd be grateful for any assistance in this PR.
If Objective-C + AVFoundation compiling support is too far out, which it might as well be, this PR could also be modified to be a toolbox. If loaders were implemented as templates, and a sample implementation of the
AVFoundationAudioFile
class was provided somewhere, it would reduce overhead to any users simply adapting this interface in their existing objective-c++ projects greatly.