Skip to content
A module that allows you to sonify timeseries data
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A module that allows you to sonify timeseries data. The Sonify class will scale your data to a given pitch range and song length, and then allow you play it in the browser using the Web Audio API.

The duration of a note is calculated by measuring the time between two data points. This is then scaled to the timeframe provided by songLength. You can optionally set staticRythm: true to disregard timestamps and give each data point an equal note length.


import Sonify from "sonify";

const data = [
  [1536969666906, 1],
  [1546969674206, 2],
  [1556966695555, 4.3],
  [1566959697655, 2.3],
  [1576669693906, 3]

// Instantiate a new Sonify instance with our data,
// with a song length of 10 seconds. Resulting pitches
// should span 3 octaves, starting from C06.
const Sonifier = new Sonify(data, 10, {
  octaves: 3,
  baseOctave: 6,
  glissando: true,
  staticRhythm: false

console.log(Sonifier.isPlaying); // true



Sonify class

{Array<Array>} data required - Two dimensional array of data points, e.g. [[1586969694206, 2.3], [1596969695555, 5.3]]

{number} songLength required - Length of the generated song in seconds

{Object} options

{Array} options.pitches default: ["C", "C#", "D", "D#", "E", "F", "Gb", "G", "A", "Ab", "Bb", "B" ] - Array of pitch names to use, e.g. ["A", "C#", "E"]. Default is all 12 chromatic notes.

{number} options.octaves default: 3 - Number of octaves that the song should span.

{number} options.baseOctave default: 6 - Base octave to start from. There are 9 octaves available, so whatever you set as the base octave must be less than 9 - octaves, or else you'll be out of range.

{number} options.glissando default: false - Glide from one pitch to another. With this option enabled you can clearly hear the shape of the data.

{number} options.staticRhythm default: false - Disregard timestamps and give each data point an equal note length by dividing the provided songLength by the number of data points.

returns {void}


returns {void}

You can’t perform that action at this time.