Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

nikola9core/NCSoundHistogram

Repository files navigation

NCSoundHistogram

Version License Platform

Based on https://github.com/faviomob/FVSoundWaveDemo with improvements:

  • Added playing animation
  • More customizations such setting bar line width

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Example:

alt tag

Requirements

  • iOS 8 sdk

Installation

NCSoundHistogram is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "NCSoundHistogram"

Usage

Import header

#import "NCSoundHistogram.h"

Initialize NCSoundHistogram and add as a view

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NCSoundHistogram *soundHistogramView = [[NCSoundHistogram alloc] initWithFrame:CGRectMake(50, 50, 200, 100)];
    
    soundHistogramView.waveColor = [UIColor blueColor];
    soundHistogramView.animationColor = [UIColor cyanColor];
    soundHistogramView.drawSpaces = YES;
    soundHistogramView.barLineWidth = 2.5;
    
    [self.view addSubview:soundHistogramView];
}

Set audio file on some button click or when view appears

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"audio.m4a" ofType:nil]];
    soundHistogramView.soundURL = url;
    
    [soundHistogramView animatePlayingWithDuration:4];
}

License

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

About

iOS pod that generates discrete histogram view from audio file

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published