Skip to content

Convert duration values to ms #3

@tmhglnd

Description

@tmhglnd

An enhancement to the Translate library of a method that converts various duration values from different platforms to a corresponding millisecond value based on a set tempo.

example

const TL = require('total-serialism').Translate;

TL.setTempo(120);
//=> set tempo to 120 beats per minute

var rhythm = [8n, 4n, 16n];
TL.toTime(rhythm)
//=> [ 250, 500, 125 ]

But could also work with division notation

const TL = require('total-serialism').Translate;

TL.setTempo(120);
//=> set tempo to 120 beats per minute

var rhythm = ['1/8', '1/4', '1/16'];
TL.toTime(rhythm)
//=> [ 250, 500, 125 ]

Or with floating point ratio values

const TL = require('total-serialism').Translate;

TL.setTempo(120);
//=> set tempo to 120 beats per minute

var rhythm = [0.125, 0.25, 0.0625];
TL.toTime(rhythm)
//=> [ 250, 500, 125 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions