0.8.0 • Published 10 months ago

@strudel.cycles/tone v0.8.0

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
10 months ago

@strudel.cycles/tone

This package adds Tone.js functions to strudel Patterns.

Deprecation Note

This package will not be developed further. Consider using @strudel.cycles/webaudio as a replacement.

Install

npm i @strudel.cycles/tone --save

Example

The following example will create a pattern and play it back with tone.js:

import { sequence, stack, State, TimeSpan } from '@strudel.cycles/core';
import { Tone, polysynth, osc, out } from '@strudel.cycles/tone';

const pattern = sequence('c3', ['eb3', stack('g3', 'bb3')]).tone(polysynth().set(osc('sawtooth4')).chain(out()));

document.getElementById('play').addEventListener('click', async () => {
  await Tone.start();
  Tone.getTransport().stop();
  const events = pattern.query(new State(new TimeSpan(0, 4))).filter((e) => e.whole.begin.equals(e.part.begin));
  events.forEach((event) =>
    Tone.getTransport().schedule((time) => event.context.onTrigger(time, event), event.whole.begin.valueOf()),
  );
  Tone.getTransport().start('+0.1');
});
0.8.0

10 months ago

0.7.1

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.3.0

2 years ago

0.4.1

1 year ago

0.3.2

2 years ago

0.4.0

1 year ago

0.3.1

2 years ago

0.3.3

2 years ago

0.1.2

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.0

2 years ago

0.1.1

2 years ago

0.0.4

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago