You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check SonogramView.swift or MacSonogramView.swift and copy it to your project, then take a look on example for iOS or macOS, it's pretty straightforward, and don't forget to make sure, that you have your audiofile added to project/downloaded.
Second
You whould init anywhere the SonogramView() as nib or fram - doesnt matter..
letsView:SonogramView=SonogramView()
Provide your fileURL like:
sView.addDurationOfFileWith(url: fileUrl!)
And just invoke the magic!
sView.convertToPoints()
Playground:
Try it in Playground! :)
import PlaygroundSupport
varfileUrl:URL?do{
fileUrl =PlaygroundSupport.playgroundSharedDataDirectory.appendingPathComponent("test.m4a")
// User/Documents/Shared Playground Data
}catch{print(error)}varwaveView:SonogramView=SonogramView()
waveView.addDurationOfFileWith(url: fileUrl!)
waveView.convertToPoints()
// And you are done!
// Customization of view
waveView.backgroundColor =.clear
letview=UIView(frame:CGRect(x:0, y:0, width:300, height:200))
view.backgroundColor =.white
view.addSubview(waveView)
waveView.frame.size.width = view.frame.width
waveView.frame.size.height = view.frame.height
waveView.center = view.center
PlaygroundPage.current.liveView = view // Showing in liveView with xCode Playground