Skip to content

johnryan/FDWaveformView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FDWaveformView

![CI Status](http://img.shields.io/travis/William Entriken/FDWaveformView.svg?style=flat) Version License Platform

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.

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.

NSBundle *thisBundle = [NSBundle bundleForClass:[self class]]; NSString *filePath = [thisBundle pathForResource:@"Submarine" ofType:@"aiff"]; NSURL *url = [NSURL fileURLWithPath:filePath]; 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 rerender 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 = YES;
self.waveform.doesAllowStretch = YES;
self.waveform.doesAllowScroll = YES;

Supports animation for changing properties:

[UIView animateWithDuration:0.3 animations:^{ NSInteger 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 ARC and iOS7+.

Includes unit tests which run successfully using Travis CI.

Installation

  1. Add pod 'FDWaveformView' to your Podfile
  2. The the API documentation under "Class Reference" at http://cocoadocs.org/docsets/FDWaveformView/
  3. Please add your project to "I USE THIS" at https://www.cocoacontrols.com/controls/fdwaveformview

About

Reads an audio file and displays the waveform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 90.3%
  • C 4.4%
  • Shell 4.0%
  • Ruby 1.1%
  • C++ 0.2%