Using the SoundTouch environment in Swift

Could you please tell me how to use the SoundTouch environment in a Swift iOS project to detect BPM? I've tried everything with Bridging Headers and everything but I can't seem to get it to work ... Thanks!

+3


source to share


3 answers


If you still need to use SoundTouch in your iOS project, I shared repository GitHub libraries, compiled for armv7

, armv7s

, arm64

, i386

andx86_64

https://github.com/enrimr/soundtouch-ios-library

To implement this compiled library in your project, you must add the SoundTouch directory (which includes libSoundTouch.a and the headers directory) in your Xcode project.



In SWIFT you cannot import .h, so you will need to create a .h file named <Your-Project-Name>-Bridging-Header-File.h

Then specify it in the project build settings (in the "Swift Compiler" section find "Objective C Bridging Header") with

$(SRCROOT)/<Your-Project-Name>-Bridging-Header.h

      

And you should now be able to use the SoundTouch class.

+1


source


The soundtouch library is originally written in C ++, which Swift will not compile.

Even with an updated library the soundtouch lib will not compile in a Swift project without Objective-C wrappers to allow Swift to access the methodology.



Using the heading title will indeed include the soundtouch library, but the project simply won't compile there after.

+1


source


If you want to use Swift in your project, I can suggest using 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)

      

0


source







All Articles