npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pitch-shift

v0.0.0

Published

Variable rate controllable audio pitch shifter

Downloads

142

Readme

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