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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ola-ts

v1.0.8

Published

Audio time stretching implementation of a modified Overlap and Add (OLA) algorithm

Downloads

12

Readme

OLA-TS.js

OLA-TS.js is an audio time stretching implementation of a modified Overlap and Add (OLA) algorithm.

This fork

This fork is an outside attempt to clean up and update the abandoned OLA-TS.js.

Quick start


import { OLATSPlayer } from "ola-ts"

// Set up your audioContext after a user interaction, retrieve & decode audio data, pass it in

var player = new OLATSPlayer(audioContext, decodedAudioData, 4096, 4096);
player.connect(gain);
var gain = audioContext.createGain();
gain.connect(audioContext.destination);
player.speed = 2; // Speeds are reversed from playbackRate. Big num = slow play
player.play();

Constructor

OLATS(Number frameSize): frameSize must be an integer. The default window type is the Lanczos.

API

process(Array inputFrame, CBuffer outputFrame): given a (mono) frame, performs a time stretching iteration and pushes H s samples in the output CBuffer.

clear_buffers(): clears all internal buffers, like the overlapping buffer. This can be useful for audio players that need to create a noticeable stop in the transition to the next file in a playlist, in order to avoid using the phase of the previous song to adjust the phase of the next song.

set_alpha(Number alpha, Number overlap, Number beta): given the new stretching factor, it computes the new values for Hs , Ha (both integers) and invokes the function pointed by overlap_fn.

set_window_type(String windowType): changes the type of the window used within OLA. Available types are Lanczos, Triangular, Bartlett, BartlettHann, Blackman, Cosine, Gauss, Hamming, Hann, Rectangular, SinBeta.

beta_fn(Number alpha): public field pointing to a function that, given a stretching factor α, will return a new window exponent.

overlap_fn(Number alpha): public field pointing to a function that, given a stretching factor α, will return a new overlapping factor.

get_alpha(): returns the last specified stretching factor.

get_ha(): returns the current analysis hop size. This function calculates the increment to the “read head” of the input signal, when playing an audio file.

get_hs(): returns the current synthesis hop size. This function calculates the increment to the output signal position which an be used to guide the cursor in the UI of an audio player using OLA-TS.js as time stretcher.

get_overlap_factor(): returns the current overlapping factor.

get_beta(): returns the current window exponent.

Helpers

BufferedTS: it manages the intermediary frame buffering for two OLATS instances. This class offers two public writable fields, alpha and position to manipulate the stretching factor and the 'read head' of the input audio buffer, as well as two public methods:

  • process(AudioBuffer outputAudioBuffer): writes the next output frame in the provided output audio buffer.
  • set_audio_buffer(AudioBuffer newBuffer): defines the input audio buffer.

WAAPlayer: integrates a BufferedTS instance in a ScriptProcessor node, providing the usual functions connect(AudioNode) and disconnect(AudioNode), two extra public methods, play and stop, as well as four public writable fields: position, speed, audioContext and audioBuffer.

Notes

  • Audio quality, in OLA-TS.js, is strongly dependent on (1) frame size and (2) the overlapping factor. For small frame sizes (=< 2048) and songs with harmonic structures like voices, there will be modulation in the output, which can be minimized with careful management of the overlapping factor (overlap_fn) and window exponent (beta_fn). For large frame sizes (>= 4096), the modulation becomes less perceivable.

  • This time stretcher is recommended for applications that need a cheap solution for time stretching while maintaining good quality for harmonic structures and do not require very fast manipulation of the time stretch factor.