import tone always from @strudel/tone

This commit is contained in:
Felix Roos 2022-03-25 21:35:41 +01:00
parent edba815b0b
commit 65deb7df1d
9 changed files with 14 additions and 10 deletions

View File

@ -14,7 +14,7 @@ import * as drawHelpers from '@strudel/tone/draw.mjs';
import gist from '@strudel/core/gist.js';
import shapeshifter from './shapeshifter.mjs';
import { mini } from '../mini/mini.mjs';
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
import * as toneHelpers from '../tone/tone.mjs';
import * as voicingHelpers from '../tonal/voicings.mjs';

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
import { State, TimeSpan } from '@strudel/core';
/* export declare interface UseCycleProps {

View File

@ -1,7 +1,7 @@
import { isNote } from 'tone';
import _WebMidi from 'webmidi';
import { Pattern as _Pattern } from '@strudel/core/strudel.mjs';
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
// if you use WebMidi from outside of this package, make sure to import that instance:
export const WebMidi = _WebMidi;
@ -67,7 +67,7 @@ Pattern.prototype.midi = function (output, channel = 1) {
// console.log('midi', value, output);
const timingOffset = WebMidi.time - Tone.getContext().currentTime * 1000;
time = time * 1000 + timingOffset;
// const inMs = '+' + (time - Tone.context.currentTime) * 1000;
// const inMs = '+' + (time - Tone.getContext().currentTime) * 1000;
// await enableWebMidi()
device.playNote(note, channel, {
time,

View File

@ -4,4 +4,5 @@ TBD
## Dev Notes
`@tonejs/piano` has peer dependency on `webmidi@^2.5.1`! A newer version of webmidi will break.
- `@tonejs/piano` has peer dependency on `webmidi@^2.5.1`! A newer version of webmidi will break.
- If you use Tone in another package, make sure to `import { Tone } from '@strudel/tone`, to ensure you get the same AudioContext.

View File

@ -1,4 +1,4 @@
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
import { Pattern } from '@strudel/core';
export const getDrawContext = (id = 'test-canvas') => {

View File

@ -1,5 +1,8 @@
import { Pattern as _Pattern } from '@strudel/core';
import * as Tone from 'tone';
import * as _Tone from 'tone';
// import Tone from here, to make sure to get the same AudioContext
export const Tone = _Tone;
const {
AutoFilter,

View File

@ -1,4 +1,4 @@
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
export const hideHeader = () => {
document.getElementById('header').style = 'display:none';

View File

@ -1,4 +1,4 @@
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
import { State, TimeSpan } from '@strudel/core';
import { getPlayableNoteValue } from '@strudel/core/util.mjs';
import { evaluate } from '@strudel/eval';

View File

@ -1,5 +1,5 @@
import React, { useCallback, useMemo, useState } from 'react';
import * as Tone from 'tone';
import { Tone } from '@strudel/tone';
import useRepl from '@strudel/hooks/useRepl.mjs';
import CodeMirror, { markEvent } from '../CodeMirror';
import cx from '../cx';