Can you please tell me how to use the SoundTouch framework in a Swift iOS project to detect BPM? I tried all things with Bridging Headers & whatever but I cant get it work... Thanks!
3 Answers
If you still need it to use SoundTouch in your iOS project, I have shared a GitHub repository with that libraries compiled for armv7
, armv7s
, arm64
, i386
and x86_64
https://github.com/enrimr/soundtouch-ios-library
To implement that compiled library in your project, you have to add SoundTouch directory (which includes libSoundTouch.a and the directory with headers) in your Xcode project.
In SWIFT you can't import a .h so you will need to create a .h file named <Your-Project-Name>-Bridging-Header-File.h
Then reference it in your projects build settings (under "Swift Compiler" look for "Objective C Bridging Header") with:
$(SRCROOT)/<Your-Project-Name>-Bridging-Header.h
And now you must be able to use SoundTouch class.

- 3,924
- 5
- 39
- 59
-
I've did exactly that and I'm getting `Unknown type name 'namespace'`. – Uko Nov 11 '15 at 16:29
-
same problem, " Unknown type name 'namespace' " – Jono Tho'ra Mar 10 '16 at 11:27
-
Yes, not able to compile with swift – Ketan Parmar Aug 17 '20 at 07:33
The soundtouch library is originally written in C++ which Swift won't compile.
Even with an updated soundtouch library, the lib won't compile in a Swift project without Objective-C wrappers to allow Swift to access the methodology.
Using a bridging header will indeed include the soundtouch library, but the project just won't compile there after.

- 1,476
- 3
- 18
- 28
If you want to use Swift in your project, so I can suggest to use this lib:
https://github.com/Luccifer/BPM-Analyser
guard let filePath = Bundle.main.path(forResource: "TestMusic", ofType: "m4a"),
let url = URL(string: filePath) else {return "error occured, check fileURL"}
BPMAnalyzer.core.getBpmFrom(url, completion: nil)

- 43
- 8