Skip to content

Audio waveform view with playback functionality, like Soundcloud

License

Notifications You must be signed in to change notification settings

SoundcloudUnofficialApp/ASWaveformPlayerView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASWaveformPlayerView

Swift5 compatible SPM compatible

Example

Check example project inside

Requirements

Swift 5

Description

ASWaveformPlayerView

A UIView subclass that displays waveform of a provided local audio file.

This view has 2 gesture recognizers attached:

  1. UITapGestureRecognizer - Play - Pause associated with a view audio file.
  2. UIPanGestureRecognizer - Seek audio file to specified position.

There are 3 public properties:

  • normalColor - default color of waveform, fills section of waveform that is yet to be played.
  • progressColor - already played section of waveform has this color.
  • allowSpacing - inserts a little spacing between bars in waveform.

Usage

Example:

      let waveform = try ASWaveformPlayerView(audioURL: audioURL, // URL to local a audio file
                                              sampleCount: 1024, // higher numbers makes waveform more detailed
                                              amplificationFactor: 500) // constant that affects height of each 'bar' in waveform

      waveform.normalColor = .lightGray
      waveform.progressColor = .orange
      //with high sampleCount passed to init method to avoid artifacts set this to false
      waveform.allowSpacing = false

Author

Alexey Savchenko, [email protected]

License

ASWaveformPlayerView is available under the MIT license. See the LICENSE file for more info.

About

Audio waveform view with playback functionality, like Soundcloud

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%