Skip to content

duongsonthong/waveFormLibrary

Repository files navigation

waveFormLibrary

untitled

What's feature?

  • draw waveform of mp3 file on screen
  • draw current play position
  • zoom-in and zoom-out waveform while playing
  • use swift 3 version

How to use?

  • Install library : add pod 'waveFormLibrary', '~> 1.0' similar to the following to your Podfile:
target 'MyApp' do
  pod 'waveFormLibrary', '~> 1.0'
end

Then run a pod install inside your terminal, or from CocoaPods.app.

  • Use storyboard

-The first : add a UIView(which you want to hold waveform view) to your view, in identity inspector change custom class to ControllerWaveForm class.

untitled

-Now you can change waveform line color and current play position line color in attribute inspector

untitled

-Connect your waveForm view to viewController

 @IBOutlet weak var controller: ControllerWaveForm!

set mp3 url which you need draw waveform

controller.setMp3Url(mp3Url: url)

-In this example I create mp3 url by copy file 02.mp3 to my project and then add below code

let mp3file = Bundle.main.path(forResource: "02", ofType: "mp3")
let url = URL(fileURLWithPath: mp3file!)

About

draw waveform from mp3 file in swift

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages