JSPM

@thi.ng/ramp

0.1.39
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 215
  • Score
    100M100P100Q101263F
  • License Apache-2.0

Parametric interpolated 1D lookup tables for remapping values

Package Exports

  • @thi.ng/ramp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@thi.ng/ramp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ramp

npm version npm downloads Twitter Follow

This project is part of the @thi.ng/umbrella monorepo.

About

Parametric interpolated 1D lookup tables for remapping values.

Status

ALPHA - bleeding edge / work-in-progress

Search or submit any issues for this package

Installation

yarn add @thi.ng/ramp
// ES module
<script type="module" src="https://unpkg.com/@thi.ng/ramp?module" crossorigin></script>

// UMD
<script src="https://unpkg.com/@thi.ng/ramp/lib/index.umd.js" crossorigin></script>

Package sizes (gzipped, pre-treeshake): ESM: 971 bytes / CJS: 1.01 KB / UMD: 1.12 KB

Dependencies

Usage examples

Several demos in this repo's /examples directory are using this package.

A selection:

Screenshot Description Live demo Source
Unison wavetable synth with waveform editor Demo Source

API

Generated API docs

import { linear, hermite } from "@thi.ng/ramp";

const rampL = linear([[0.1, 0], [0.5, 1], [0.9, 0]]);
const rampH = hermite([[0.1, 0], [0.5, 1], [0.9, 0]]);

for(let i = 0; i <= 10; i++) {
    console.log(
        i / 10,
        rampL.at(i / 10).toFixed(2),
        rampH.at(i / 10).toFixed(2)
    );
}

// 0   0.00 0.00
// 0.1 0.00 0.00
// 0.2 0.25 0.16
// 0.3 0.50 0.50
// 0.4 0.75 0.84
// 0.5 1.00 1.00
// 0.6 0.75 0.84
// 0.7 0.50 0.50
// 0.8 0.25 0.16
// 0.9 0.00 0.00
// 1   0.00 0.00

Authors

Karsten Schmidt

If this project contributes to an academic publication, please cite it as:

@misc{thing-ramp,
  title = "@thi.ng/ramp",
  author = "Karsten Schmidt",
  note = "https://thi.ng/ramp",
  year = 2019
}

License

© 2019 - 2020 Karsten Schmidt // Apache Software License 2.0