0.0.0 • Published 12 years ago
pitch-shift v0.0.0
pitch-shift
A variable speed pitch shifter written in JavaScript.
Here is a demo you can try in your browser!
Example
Here is a simplified psuedo-example:
//Create a pitch shifting object
var shifter = require("pitch-shift")(
function onData(frame) {
//Play / write out frame. Called whenver data is ready
},
function onTune(t, pitch) {
console.log("Got pitch ", pitch, " at time ", t)
//This is the amount to scale the sample by
return 1.0
})
//Feed some data to the shifter
shifter(new Float32Array([1, 1, 0, 1, 0, 0, 0 /* ... etc */ ]))For a more complete working example, check out test/test.js or example/index.js
Install
npm install pitch-shiftrequire("pitch-shift")(onData, onTune, options)
Creates a pitch shifting function
onData(frame)Called when a pitch shifted frame is ready.onTune(t, pitch)Called when a frame of audio needs to be processed.optionsAn object full of options to pass to the pitch shifterframeSizesize of frame to process (default2048)hopSizethe distance between frames in samples. Must divide frame size. (defaultframeSize/4)dataSizemaximal allowable size of a data frame (defaultframe_size)sampleRateConversion factor from samples to seconds. (default44100)analysiWindowanalysis window. must be a typed array with length equl to frame size (defaults to Hann window)synthesisWindowsynthesis window. must be a typed array with length equal to frame size (defaults to Hann window)thresholdpeak detection threshold. Set to 1.0 to always take maximum, otherwise set lower to detect half tones. (default0.9)minPeriodMinimal resolvable period. (defaultsampleRate/400)
Returns A function that you call with a frame of data.
Credits
(c) 2013 Mikola Lysenko. MIT License
Gettysburg adress reading by Britton Rea. Recording obtained from the Internet archive. http://archive.org/details/GettysburgAddress
0.0.0
12 years ago