Fix: Dependencies are evaluated only once instead of every function call.
Fix / BREAKING CHANGE: The toneRhythm
function is no longer the default export. This should make mocking/stubbing easier:
const { toneRhythm } = require('tone-rhythm');
Fix: Documentation for instantiation. Calling the function in the same line as the require
statement made requiring the module difficult in a no-dom testing environment.
// previously was const toneRhythm = require('tone-rhythm')(()=>{})
const { toneRhythm } = require('tone-rhythm');
// destructure only the functions needed:
const {
getBarsBeats,
addTimes,
getTransportTimes,
mergeMusicDataPart,
} = toneRhythm(Tone.Time)
Fix/Feature: Allow instantiation if tone-rhythm without throwing an error. Error will be thrown at run-time if Tone.Time is passed in incorrectly:
const toneRhythm = require('tone-rhythm')(()=>{}); // doesn't throw error
toneRhythm.mergeMusicDataPart({ /* data */}); // throws error
Feature: Add idx
property to return of mergeMusicDataPart
. idx
is exactly equal to the array index in the returned data:
const mergedData = mergeMusicDataPart({
rhythms: mariaDurations
});
// mergedData[0]:
// {
// duration: '8n',
// idx: 0,
// time: 0
// };
BREAKING CHANGE - Tone is now a true "peer dependency" and needs to be included in the toneRhythm factory function:
const ToneTime = require('tone/Tone/type/Time');
const toneRhythm = require('tone-rhythm')(ToneTime);
const {
getBarsBeats,
addTimes,
getTransportTimes,
mergeMusicDataPart
} = toneRhythm;
This is to prevent possible conflicts between versions of tone bundled in tone-rhythm pre-version 1.0.0.
(Legacy) Pre-bundled with Tone 0.12.8