Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/notthetup/resampler
Re-sample Audio
https://github.com/notthetup/resampler
Last synced: about 2 months ago
JSON representation
Re-sample Audio
- Host: GitHub
- URL: https://github.com/notthetup/resampler
- Owner: notthetup
- Created: 2015-02-14T07:31:07.000Z (almost 10 years ago)
- Default Branch: gh-pages
- Last Pushed: 2020-06-23T17:33:47.000Z (over 4 years ago)
- Last Synced: 2024-10-17T17:06:04.663Z (about 2 months ago)
- Language: JavaScript
- Homepage: http://chinpen.net/resampler/
- Size: 203 KB
- Stars: 39
- Watchers: 6
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-webaudio - resampler - A utility for resampling audio. (Obsolete / Community)
README
# Audio-Resampler
[![npm version](https://badge.fury.io/js/audio-resampler.svg)](http://badge.fury.io/js/audio-resampler)
Simple WebAudio based resampling library.
#### Runs on all [modern browsers which support WebAudio](http://caniuse.com/#search=audio-api).
## 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)
`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, 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.