Here is what I am trying to do:
The screenshot is taken from a 6s iPhone.
I have been working in AVAudioPlayer and I would like to draw a waveform which looks look like the first screenshot. I am using FDWAVEFORMVIEW Github pods to draw waves. but I m confused how to draw same waves.
Code:
@IBOutlet weak var soundWaveView: FDWaveformView!
func createSoundWave() {
soundWaveView.delegate = self
soundWaveView.alpha = 0.0
soundWaveView.audioURL = mainTrackURL
soundWaveView.zoomSamples = 0 ..< soundWaveView.totalSamples / 3
soundWaveView.doesAllowScrubbing = true
soundWaveView.doesAllowStretch = true
soundWaveView.doesAllowScroll = true
soundWaveView.wavesColor = .lightGray
soundWaveView.progressColor = UIColor.init(red: 46/255, green: 188/255, blue: 191/255, alpha: 1.0)
}
func waveformViewWillRender(_ waveformView: FDWaveformView) {
startRendering = Date()
}
func waveformViewDidRender(_ waveformView: FDWaveformView) {
endRendering = Date()
NSLog("FDWaveformView rendering done, took %0.3f seconds", endRendering.timeIntervalSince(startRendering))
profileResult.append(String(format: " render %0.3f ", endRendering.timeIntervalSince(startRendering)))
UIView.animate(withDuration: 0.25, animations: {() -> Void in
waveformView.alpha = 1.0
})
}
func waveformViewWillLoad(_ waveformView: FDWaveformView) {
startLoading = Date()
}
func waveformViewDidLoad(_ waveformView: FDWaveformView) {
endLoading = Date()
NSLog("FDWaveformView loading done, took %0.3f seconds", endLoading.timeIntervalSince(startLoading))
profileResult.append(String(format: " load %0.3f ", endLoading.timeIntervalSince(startLoading)))
}
Question: How to show the same waves as the original image(first screenshot)?
Can someone please explain to me how to draw same, I've tried to draw these waves but no results yet.
Any help would be greatly appreciated.
Thanks in advance.