fulldecent/FDWaveformView
Fork: 178 Star: 1194 (更新于 1970-01-01 00:00:00)
license: MIT
Language: Swift .
Reads an audio file and displays the waveform
最后发布版本: 5.0.1 ( 2020-02-13 02:25:54)
FDWaveformView
FDWaveformView is an easy way to display an audio waveform in your app. It is a nice visualization to show a playing audio file or to select a position in a file.
:hatching_chick: Virtual tip jar: https://amazon.com/hz/wishlist/ls/EE78A23EEGQB
Usage
To use it, add an FDWaveformView
using Interface Builder or programmatically and then just load your audio as per this example. Note: if your audio file does not have file extension, see this SO question.
let thisBundle = Bundle(for: type(of: self))
let url = thisBundle.url(forResource: "Submarine", withExtension: "aiff")
self.waveform.audioURL = url
Features
Set play progress to highlight part of the waveform:
self.waveform.progressSamples = self.waveform.totalSamples / 2
Zoom in to show only part of the waveform, of course, zooming in will smoothly re-render to show progressively more detail:
self.waveform.zoomStartSamples = 0
self.waveform.zoomEndSamples = self.waveform.totalSamples / 4
Enable gestures for zooming in, panning around or scrubbing:
self.waveform.doesAllowScrubbing = true
self.waveform.doesAllowStretch = true
self.waveform.doesAllowScroll = true
Supports animation for changing properties:
UIView.animate(withDuration: 0.3) {
let randomNumber = arc4random() % self.waveform.totalSamples
self.waveform.progressSamples = randomNumber
}
Creates antialiased waveforms by drawing more pixels than are seen on screen. Also, if you resize me (autolayout) I will render more detail if necessary to avoid pixelation.
Supports iOS8+ and Swift 3.
Includes unit tests which run successfully using Travis CI.
Installation
Add this to your project using Swift Package Manager. In Xcode that is simply: File > Swift Packages > Add Package Dependency... and you're done. Alternative installations options are shown below for legacy projects.
Contributing
This project's layout is based on https://github.com/fulldecent/swift4-module-template If you would like to change the layout, please change that project FIRST. Also you may appreciate that project has "recipes" -- you don't just change code, you also explain why you are doing things. As a maintainer this makes my job MUCH simpler. In a similar respect, if you are introducing non-minor changes, it will be VERY helpful if you could please reference to another project (like AlamoFire) that has seen and discussed the types of design challenges you are touching.) Thanks again and we all really do appreciate your contributions.
最近版本更新:(数据更新于 1970-01-01 00:00:00)
2020-02-13 02:25:54 5.0.1
2019-12-03 03:01:43 5.0.0
2019-04-09 11:30:11 4.0.0
2018-02-07 09:14:52 3.0.1
2017-10-28 03:09:43 3.0.0
2017-06-01 01:40:56 2.2.1
2017-05-04 02:03:20 2.2.0
2017-04-15 03:51:44 2.1.0
2017-02-17 05:54:46 2.0.1
2016-09-28 07:41:24 2.0.0
主题(topics):
audio, cocoapod, ios, multimedia, swift, visualization, waveform
fulldecent/FDWaveformView同语言 Swift最近更新仓库
2024-11-19 05:05:44 whoeevee/EeveeSpotify
2024-11-08 09:08:36 Aidoku/Aidoku
2024-11-07 09:51:16 argmaxinc/WhisperKit
2024-11-01 03:30:19 wordpress-mobile/WordPress-iOS
2024-10-30 03:29:03 jordanbaird/Ice
2024-10-24 02:02:47 Artificial-Pancreas/iAPS