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

@descript/kali

v0.0.7

Published

Kali is used for realtime time-stretching and pitch shifting in Javascript. It can change Tempo and Pitch independently.

Downloads

14,077

Readme

Kali

Kali is used for realtime time-stretching and pitch shifting in Javascript. It can change Tempo and Pitch independently.

From Wikipedia:

Time stretching is the process of changing the speed or duration of an audio signal without affecting its pitch. Pitch scaling or pitch shifting is the opposite: the process of changing the pitch without affecting the speed. Similar methods can change speed, pitch, or both at once, in a time-varying way.

Kali uses a WSOLA-like algorithm to do high-quality time stretching in the browser

Demo

Try a demo here.

Getting Started

Get Kali from the releases page.

Kali will be published to npm soon.

Basic Usage

Create a new instance

var kali = new Kali(numChannels);

Set parameters for time stretching. Setting useQuickSearch to true will speed up processing at the expense of some quality. By default, it is set to false. The difference is not noticeable in many cases so try setting it to true if you need more performance.

kali.setup(sampleRate, stretchFactor, useQuickSearch);

Feed Kali some data and tell it to process. dataToInput should be a Float32Array of interlaced samples.

kali.input(dataToInput);
kali.process();

Read data out into a target array. targetArray should be a Float32Array.

var samplesRead = kali.output(targetArray);

Once you're done feeding data, tell Kali to flush its buffers and continue reading data.

kali.flush();

That's it! See Test.ts in the examples folder for a complete example of usage.

If you want to change tempo during stretching, you can call setTempo (with a new stretch factor) while feeding data. This will let you smoothly change between tempos. See Test.ts for an example.

Documentation

For complete documentation, see https://kali.readme.io/docs

Efficiency

By using TypedArrays and views on TypedArrays, Kali operates very efficiently. That said, this is an early release and performance hasn't been optimized as much as possible. Pull requests are welcome!

Running Examples

  • Clone or download this repository
  • Put an mp3 file named test.mp3 in the build/examples directory
  • Start a server in that directory
    • python -m SimpleHTTPServer
  • Open your browser and navigate to the test page
    • e.g. http://localhost:8000/test.html

The developer console will show the progress of the file being stretched. Once the stretch is complete, the slowed-down version will begin playing. This example slows down a song by 4% (so a 125 bpm song will be slowed down to 120 bpm).

To change this (or anything else about the example), edit Test.ts in the examples directory and build as shown below.

Building

npm install

// build examples
webpack --config webpack.config.test.js

// build Kali
webpack

// build minified Kali
webpack -p

License

LGPL

Kali is based on ideas and code from SoundTouch and libsox, both of which are LGPL. Therefore, Kali is also LGPL