Giter Site home page Giter Site logo

opendawn / pitch-shift Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikolalysenko/pitch-shift

1.0 2.0 0.0 1.07 MB

Variable speed pitch shifter written in JavaScript

Home Page: http://mikolalysenko.github.io/pitch-shift/

License: MIT License

JavaScript 83.61% HTML 16.39%

pitch-shift's Introduction

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-shift

require("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.

  • options An object full of options to pass to the pitch shifter

    • frameSize size of frame to process (default 2048)
    • hopSize the distance between frames in samples. Must divide frame size. (default frameSize/4)
    • dataSize maximal allowable size of a data frame (default frame_size)
    • sampleRate Conversion factor from samples to seconds. (default 44100)
    • analysiWindow analysis window. must be a typed array with length equl to frame size (defaults to Hann window)
    • synthesisWindow synthesis window. must be a typed array with length equal to frame size (defaults to Hann window)
    • threshold peak detection threshold. Set to 1.0 to always take maximum, otherwise set lower to detect half tones. (default 0.9)
    • minPeriod Minimal resolvable period. (default sampleRate/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

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.