Giter Site home page Giter Site logo

resampler's Introduction

Audio-Resampler

npm version

Simple WebAudio based resampling library.

Installation

npm install audio-resampler

API

resampler = require('audio-resampler');
resampler(input, targetSampleRate, oncomplete);

input : Input audio file. This can either be a URL, a File object, or an AudioBuffer.

targetSampleRate : The target sample rate after the re-sampling process. This number is limted based on the browser implementation (usually >=3000, <=192000)

targetBitDepth : The target bit depth after the re-sampling process. This number is limted based on the browser implementation (usually >=16, <=32)

oncomplete: Callback when the resampling process is completed. The argument to this callback is an Object which supports the following methods:

getAudioBuffer : Returns the resampler AudioBuffer

getFile : Returns a ObjectURL of a WAV file created from the resampled Audio.

Example Usage

resampler = require('audio-resampler');
var URL = "https://dl.dropboxusercontent.com/u/957/audio/sine.wav"
resampler(URL, 192000, 24, function(event){
	event.getFile(function(fileEvent){
		var a = document.createElement("a");
		document.body.appendChild(a);
		a.download = "resampled.wav";
		a.style = "display: none";
		a.href = fileEvent;
		a.click();
		window.URL.revokeObjectURL(fileEvent);
		document.body.removeChild(a);
	});
});

Test

To test this repository, you can run a local server using the npm start command which serves a simple drag-and-drop interface based webpage to resampler audio files.

resampler's People

Contributors

notthetup avatar marcellodum 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.