webaudio-peaks

WebJar for webaudio-peaks

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

webaudio-peaks
Last Version

Last Version

0.0.6
Release Date

Release Date

Type

Type

jar
Description

Description

webaudio-peaks
WebJar for webaudio-peaks
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/naomiaro/webaudio-peaks

Download webaudio-peaks

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/webaudio-peaks/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>webaudio-peaks</artifactId>
    <version>0.0.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/webaudio-peaks/
implementation 'org.webjars.npm:webaudio-peaks:0.0.6'
// https://jarcasting.com/artifacts/org.webjars.npm/webaudio-peaks/
implementation ("org.webjars.npm:webaudio-peaks:0.0.6")
'org.webjars.npm:webaudio-peaks:jar:0.0.6'
<dependency org="org.webjars.npm" name="webaudio-peaks" rev="0.0.6">
  <artifact name="webaudio-peaks" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='webaudio-peaks', version='0.0.6')
)
libraryDependencies += "org.webjars.npm" % "webaudio-peaks" % "0.0.6"
[org.webjars.npm/webaudio-peaks "0.0.6"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

webaudio-peaks

Small library to extract peaks from an array of audio samples or a webaudio AudioBuffer.

Build Status

Coverage Status

Installation

npm install webaudio-peaks

Basic Usage

var extractPeaks = require('webaudio-peaks');

var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
//decode an ArrayBuffer into an AudioBuffer
audioCtx.decodeAudioData(audioData, function(decodedData) {

  //calculate peaks from an AudioBuffer
  var peaks = extractPeaks(decodedData, 10000, true);
});

###extractPeaks(source, samplesPerPixel, isMono, cueIn, cueOut, bits) function to extract peaks from a TypedArray, or AudioBuffer

Params

  • source TypedArray|AudioBuffer - A source of audio samples.
  • samplesPerPixel number - Number of samples used to calculate a single peak.
  • isMono boolean - Combine all channels into one array of peaks or not.
  • cueIn number - Sample to begin at. The offset is inclusive.
  • cueOut number - Sample to end at. The offset is exclusive.
  • bits (8|16|32) - Resolution of calculated peaks.

Returns: object

{
    length: `number` //Number of calculated peaks,
    //Computed peak data, length ==  #channels or 1 if isMono == true
    //Each entry of type `Int{bits}Array`
    data: `Array`
    bits: `(8|16|32)` //Resolution of calculated peaks.
}

License

MIT License

Versions

Version
0.0.6
0.0.5