GithubHelp home page GithubHelp logo

michaelsabo / displayers-audio-visualizers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agilie/displayers-audio-visualizers

0.0 2.0 0.0 5.52 MB

DisPlayer is a customizable audio visualization component that works with recording and playing back audio files

Home Page: https://agilie.com

License: MIT License

Ruby 1.53% Objective-C 98.47%

displayers-audio-visualizers's Introduction

DisPlayers-Audio-Visualizers

Made by Agilie CI Status Version License Platform

DisPlayers-Audio-Visualizers

DisPlayer is a customizable audio visualization component that works with recording and playing back audio files

Histogram Demo Rolling Demo Wave Dem WaveStroke Dem

The audio visualizer can be easily embedded into an app that features:

  • audio comments to text or multimedia posts
  • recording and sending audio files in a chat
  • playing back audio files posted in a chat using a dedicated UI component

DisPlayer features 5 default visualization presets that can be customized by the background color (single tone or gradient), the wave color, the number of the wave’s bins/bars, and the wave amplitude.

Installation

The control can be easily embedded into an app:

CocoaPods (recommended)

# For latest release in cocoapods
pod 'DisPlayers-Audio-Visualizers', '~> 0.1.1'

Getting started

Getting started guide for DisPlayers-Audio-Visualizers

  1. You should added next classes into your project:
#import "EZAudio.h" 
#import "DPMainEqualizerView.h"
#import "DPEqualizerSettings.h"
  1. This library contains four types of equalizer visualisation: (Histogram, Rolling, Wave and Circle Wave). And you should chose want kind of equalizer visualization you want and import that class into your project.

Histogram initialization example:

    DPEqualizerSettings *settings = [DPEqualizerSettings createByType: DPHistogram];
    self.equalizerView = [[DPHistogramEqualizerView alloc] initWithFrame: self.view.bounds 
                                                             andSettings: settings];
    [self.view addSubview: self.equalizerView];
     NSString *audioPath = [[NSBundle mainBundle] pathForResource: @"YOUR_AUDIO_FILE_PATH" 
                                                           ofType: @"AUDIO_FILE_TYPE"];
     EZAudioFile *audioFile = [[EZAudioFile alloc] initWithURL: [[NSURL alloc] initWithString: audioPath]];
     self.player = [[EZAudioPlayer alloc] initWithAudioFile: audioFile];
     self.player.delegate = self;
     [self.player play];

EZAudioPlayerDelegate

- (void)  audioPlayer:(EZAudioPlayer *)audioPlayer
          playedAudio:(float **)buffer
       withBufferSize:(UInt32)bufferSize
 withNumberOfChannels:(UInt32)numberOfChannels
          inAudioFile:(EZAudioFile *)audioFile {
          
    dispatch_async(dispatch_get_main_queue(), ^{
        if (self.player.isPlaying) {
            [self.equalizerView updateBuffer: buffer[0] withBufferSize:bufferSize];
        }
    
    });
}
  1. You can also customize equalizer visualisation. You can change default settings for all equalizer visualisation types:
/// The highest bound of the frequency. Default: 7000Hz
@property (nonatomic) float maxFrequency;

/// The lowest bound of the frequency. Default: 400Hz
@property (nonatomic) float minFrequency;

/// The number of bins in the audio plot. Default: 40
@property (nonatomic) NSUInteger numOfBins;

/// The padding of each bin in percent width. Default: 0.2
@property (nonatomic) CGFloat padding;

/// The gain applied to the height of each bin. Default: 10
@property (nonatomic) CGFloat gain;

/// A float that specifies the vertical gravitational acceleration applied to each bin.
/// Default: 10 pixel/sec^2
@property (nonatomic) float gravity;

/// The number of max bin height. Default: Screen height.
@property (assign, nonatomic) CGFloat maxBinHeight;

/// The type of plot that can be displayed in the view using the data. Default: DPPlotTypeBuffer.
@property (assign, nonatomic) DPPlotType plotType;

/// The type of equalizer that can be displayed in the view using the data. Default: DPHistogram.
@property (assign, nonatomic) DPEqualizerType equalizerType;

/// The colors of equalizer background that can be displayed in the view.
@property (nonatomic, strong) NSMutableArray *equalizerBackgroundColors;

/// The colors of low frequency that can be displayed in the view.
@property (nonatomic, strong) NSMutableArray *lowFrequencyColors;

/// The colors of hight frequency that can be displayed in the view.
@property (nonatomic, strong) NSMutableArray *hightFrequencyColors;

/// The colors of bins that can be displayed in the view.
@property (nonatomic, strong) NSMutableArray *equalizerBinColors;

@property (nonatomic, assign) BOOL fillGraph;

Some presets display audio frequencies as a separate waves, which provides more possibilities for cool sound visualization for your project.

Usage

CocoaPods is the recommended way to add DisPlayer to your project:

  1. Add a pod entry for DisPlayer to your Podfile pod 'DisPlayer'
  2. Install the pod(s) by running pod installation.
  3. Include DisPlayer wherever you need it with #import «Equalizers.h».

Requirements

DisPlayer works on iOS 8.0+ and is compatible with ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates: CoreGraphics.framework QuartzCore.framework CoreAudio.framework You will need LLVM 3.0 or later in order to build “DisPlayer”

Author

This library is open-sourced by Agilie Team [email protected]

Contributors

Michael Liptuga - [email protected]

Contact us

[email protected]

License

The MIT License (MIT) Copyright © 2017 Agilie Team

displayers-audio-visualizers's People

Contributors

kalamaznik avatar liptuga-michael avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.