Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.52k stars 983 forks source link

PhaseShiftAllpass is Missing in components/index.ts #926

Closed MichaelrMentele closed 3 years ago

MichaelrMentele commented 3 years ago

Describe the bug

PhaseShiftAllpass is Missing in components/index.ts

To Reproduce

try to import PhaseShiftAllpass from Tone.js

Expected behavior should import

MichaelrMentele commented 3 years ago

Tried to open a PR but can't seem to build locally, getting a bunch of ts errors ala:

michaelmentele:~/Dev/Tone.js$ npm run build

> tone@14.8.0 build /Users/michaelmentele/Dev/Tone.js
> rm -rf build && npm run ts:build && npm run webpack:build

> tone@14.8.0 ts:build /Users/michaelmentele/Dev/Tone.js
> tsc --project ./scripts/tsconfig.build.json

Tone/component/channel/Recorder.ts:118:5 - error TS2794: Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'?

118     done();
        ~~~~~~

  node_modules/typescript/lib/lib.es2015.promise.d.ts:33:34
    33     new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~
    An argument for 'value' was not provided.

Tone/core/context/BaseContext.ts:107:11 - error TS1243: 'async' modifier cannot be used with 'abstract' modifier.

107  abstract async addAudioWorkletModule(
              ~~~~~

Tone/instrument/DuoSynth.ts:143:10 - error TS2352: Conversion of type 'MonophonicOptions & { vibratoAmount: number; vibratoRate: number; harmonicity: number; voice0: Omit<MonoSynthOptions, number | keyof string[]> & { ...; }; voice1: Omit<...> & { ...; }; }' to type 'DuoSynthOptions' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Types of property 'voice0' are incompatible.
    Property 'filter' is missing in type 'Omit<MonoSynthOptions, number | keyof string[]> & { filterEnvelope: { attack: number; decay: number; sustain: number; release: number; }; envelope: { attack: number; decay: number; sustain: number; release: number; }; }' but required in type 'Omit<MonoSynthOptions, keyof MonophonicOptions>'.

143   return deepMerge(Monophonic.getDefaults(), {
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144    vibratoAmount: 0.5,
    ~~~~~~~~~~~~~~~~~~~~~~
...
179     }),
    ~~~~~~~
180   }) as DuoSynthOptions;
    ~~~~~~~~~~~~~~~~~~~~~~~

  Tone/instrument/MonoSynth.ts:19:2
    19  filter: Omit<FilterOptions, keyof ToneAudioNodeOptions>;
        ~~~~~~
    'filter' is declared here.

Found 3 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! tone@14.8.0 ts:build: `tsc --project ./scripts/tsconfig.build.json`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the tone@14.8.0 ts:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/michaelmentele/.npm/_logs/2021-08-08T17_46_16_295Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! tone@14.8.0 build: `rm -rf build && npm run ts:build && npm run webpack:build`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the tone@14.8.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/michaelmentele/.npm/_logs/2021-08-08T17_46_16_341Z-debug.log
tambien commented 3 years ago

I would recommend just using the built version which is exported in build/esm so you wouldn't need to mess with the build yourself. This module should be accessible by deep importing it like import {PhaseShiftAllPass} from "tone/build/esm/component/filter/PhaseShiftAllpass".

Unless there's a good use for this module outside of the FrequencyShifter class which we'd want to export it. In general i lean towards exporting fewer internal modules since it keeps the API neater.