tone 14.8.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +313 -0
- package/LICENSE.md +21 -0
- package/README.md +255 -0
- package/Tone/classes.ts +7 -0
- package/Tone/component/analysis/Analyser.test.ts +78 -0
- package/Tone/component/analysis/Analyser.ts +168 -0
- package/Tone/component/analysis/DCMeter.test.ts +34 -0
- package/Tone/component/analysis/DCMeter.ts +38 -0
- package/Tone/component/analysis/FFT.test.ts +83 -0
- package/Tone/component/analysis/FFT.ts +92 -0
- package/Tone/component/analysis/Follower.test.ts +111 -0
- package/Tone/component/analysis/Follower.ts +85 -0
- package/Tone/component/analysis/Meter.test.ts +91 -0
- package/Tone/component/analysis/Meter.ts +123 -0
- package/Tone/component/analysis/MeterBase.ts +45 -0
- package/Tone/component/analysis/Waveform.test.ts +49 -0
- package/Tone/component/analysis/Waveform.ts +57 -0
- package/Tone/component/channel/Channel.test.ts +77 -0
- package/Tone/component/channel/Channel.ts +178 -0
- package/Tone/component/channel/CrossFade.test.ts +57 -0
- package/Tone/component/channel/CrossFade.ts +143 -0
- package/Tone/component/channel/Merge.test.ts +59 -0
- package/Tone/component/channel/Merge.ts +62 -0
- package/Tone/component/channel/MidSideMerge.test.ts +28 -0
- package/Tone/component/channel/MidSideMerge.ts +105 -0
- package/Tone/component/channel/MidSideSplit.test.ts +79 -0
- package/Tone/component/channel/MidSideSplit.ts +90 -0
- package/Tone/component/channel/Mono.test.ts +43 -0
- package/Tone/component/channel/Mono.ts +55 -0
- package/Tone/component/channel/MultibandSplit.test.ts +66 -0
- package/Tone/component/channel/MultibandSplit.ts +166 -0
- package/Tone/component/channel/PanVol.test.ts +58 -0
- package/Tone/component/channel/PanVol.ts +110 -0
- package/Tone/component/channel/Panner.test.ts +86 -0
- package/Tone/component/channel/Panner.ts +89 -0
- package/Tone/component/channel/Panner3D.test.ts +77 -0
- package/Tone/component/channel/Panner3D.ts +234 -0
- package/Tone/component/channel/Recorder.test.ts +119 -0
- package/Tone/component/channel/Recorder.ts +162 -0
- package/Tone/component/channel/Solo.test.ts +138 -0
- package/Tone/component/channel/Solo.ts +148 -0
- package/Tone/component/channel/Split.test.ts +62 -0
- package/Tone/component/channel/Split.ts +51 -0
- package/Tone/component/channel/Volume.test.ts +129 -0
- package/Tone/component/channel/Volume.ts +109 -0
- package/Tone/component/dynamics/Compressor.test.ts +85 -0
- package/Tone/component/dynamics/Compressor.ts +163 -0
- package/Tone/component/dynamics/Gate.test.ts +72 -0
- package/Tone/component/dynamics/Gate.ts +110 -0
- package/Tone/component/dynamics/Limiter.test.ts +43 -0
- package/Tone/component/dynamics/Limiter.ts +78 -0
- package/Tone/component/dynamics/MidSideCompressor.test.ts +59 -0
- package/Tone/component/dynamics/MidSideCompressor.ts +87 -0
- package/Tone/component/dynamics/MultibandCompressor.test.ts +54 -0
- package/Tone/component/dynamics/MultibandCompressor.ts +130 -0
- package/Tone/component/envelope/AmplitudeEnvelope.test.ts +92 -0
- package/Tone/component/envelope/AmplitudeEnvelope.ts +65 -0
- package/Tone/component/envelope/Envelope.test.ts +834 -0
- package/Tone/component/envelope/Envelope.ts +623 -0
- package/Tone/component/envelope/FrequencyEnvelope.test.ts +92 -0
- package/Tone/component/envelope/FrequencyEnvelope.ts +134 -0
- package/Tone/component/filter/BiquadFilter.test.ts +94 -0
- package/Tone/component/filter/BiquadFilter.ts +158 -0
- package/Tone/component/filter/Convolver.test.ts +106 -0
- package/Tone/component/filter/Convolver.ts +134 -0
- package/Tone/component/filter/EQ3.test.ts +60 -0
- package/Tone/component/filter/EQ3.ts +163 -0
- package/Tone/component/filter/FeedbackCombFilter.test.ts +80 -0
- package/Tone/component/filter/FeedbackCombFilter.ts +105 -0
- package/Tone/component/filter/FeedbackCombFilter.worklet.ts +39 -0
- package/Tone/component/filter/Filter.test.ts +114 -0
- package/Tone/component/filter/Filter.ts +202 -0
- package/Tone/component/filter/LowpassCombFilter.test.ts +75 -0
- package/Tone/component/filter/LowpassCombFilter.ts +100 -0
- package/Tone/component/filter/OnePoleFilter.test.ts +90 -0
- package/Tone/component/filter/OnePoleFilter.ts +146 -0
- package/Tone/component/filter/PhaseShiftAllpass.test.ts +71 -0
- package/Tone/component/filter/PhaseShiftAllpass.ts +81 -0
- package/Tone/component/index.ts +39 -0
- package/Tone/core/Global.ts +73 -0
- package/Tone/core/Tone.ts +107 -0
- package/Tone/core/clock/Clock.test.ts +663 -0
- package/Tone/core/clock/Clock.ts +317 -0
- package/Tone/core/clock/TickParam.test.ts +15 -0
- package/Tone/core/clock/TickParam.ts +271 -0
- package/Tone/core/clock/TickSignal.test.ts +455 -0
- package/Tone/core/clock/TickSignal.ts +94 -0
- package/Tone/core/clock/TickSource.test.ts +655 -0
- package/Tone/core/clock/TickSource.ts +338 -0
- package/Tone/core/clock/Ticker.test.ts +86 -0
- package/Tone/core/clock/Ticker.ts +149 -0
- package/Tone/core/clock/Transport.test.ts +972 -0
- package/Tone/core/clock/Transport.ts +731 -0
- package/Tone/core/clock/TransportEvent.test.ts +45 -0
- package/Tone/core/clock/TransportEvent.ts +105 -0
- package/Tone/core/clock/TransportRepeatEvent.test.ts +43 -0
- package/Tone/core/clock/TransportRepeatEvent.ts +150 -0
- package/Tone/core/context/AbstractParam.ts +260 -0
- package/Tone/core/context/AudioContext.ts +60 -0
- package/Tone/core/context/BaseContext.ts +162 -0
- package/Tone/core/context/Context.test.ts +358 -0
- package/Tone/core/context/Context.ts +628 -0
- package/Tone/core/context/ContextInitialization.ts +42 -0
- package/Tone/core/context/Delay.test.ts +105 -0
- package/Tone/core/context/Delay.ts +103 -0
- package/Tone/core/context/Destination.test.ts +76 -0
- package/Tone/core/context/Destination.ts +128 -0
- package/Tone/core/context/DummyContext.test.ts +47 -0
- package/Tone/core/context/DummyContext.ts +201 -0
- package/Tone/core/context/Gain.test.ts +75 -0
- package/Tone/core/context/Gain.ts +90 -0
- package/Tone/core/context/Listener.test.ts +22 -0
- package/Tone/core/context/Listener.ts +117 -0
- package/Tone/core/context/Offline.test.ts +79 -0
- package/Tone/core/context/Offline.ts +65 -0
- package/Tone/core/context/OfflineContext.test.ts +64 -0
- package/Tone/core/context/OfflineContext.ts +118 -0
- package/Tone/core/context/Param.test.ts +607 -0
- package/Tone/core/context/Param.ts +541 -0
- package/Tone/core/context/ToneAudioBuffer.test.ts +360 -0
- package/Tone/core/context/ToneAudioBuffer.ts +412 -0
- package/Tone/core/context/ToneAudioBuffers.test.ts +159 -0
- package/Tone/core/context/ToneAudioBuffers.ts +167 -0
- package/Tone/core/context/ToneAudioNode.test.ts +345 -0
- package/Tone/core/context/ToneAudioNode.ts +396 -0
- package/Tone/core/context/ToneWithContext.ts +205 -0
- package/Tone/core/index.ts +38 -0
- package/Tone/core/type/Conversions.test.ts +34 -0
- package/Tone/core/type/Conversions.ts +78 -0
- package/Tone/core/type/Frequency.test.ts +220 -0
- package/Tone/core/type/Frequency.ts +249 -0
- package/Tone/core/type/Midi.test.ts +137 -0
- package/Tone/core/type/Midi.ts +82 -0
- package/Tone/core/type/NoteUnits.ts +36 -0
- package/Tone/core/type/Ticks.test.ts +190 -0
- package/Tone/core/type/Ticks.ts +69 -0
- package/Tone/core/type/Time.test.ts +181 -0
- package/Tone/core/type/Time.ts +156 -0
- package/Tone/core/type/TimeBase.ts +324 -0
- package/Tone/core/type/TransportTime.test.ts +184 -0
- package/Tone/core/type/TransportTime.ts +34 -0
- package/Tone/core/type/Units.ts +204 -0
- package/Tone/core/util/AdvancedTypeCheck.ts +40 -0
- package/Tone/core/util/Debug.test.ts +74 -0
- package/Tone/core/util/Debug.ts +63 -0
- package/Tone/core/util/Decorator.ts +51 -0
- package/Tone/core/util/Defaults.ts +123 -0
- package/Tone/core/util/Draw.test.ts +72 -0
- package/Tone/core/util/Draw.ts +125 -0
- package/Tone/core/util/Emitter.test.ts +109 -0
- package/Tone/core/util/Emitter.ts +125 -0
- package/Tone/core/util/Interface.ts +45 -0
- package/Tone/core/util/IntervalTimeline.test.ts +465 -0
- package/Tone/core/util/IntervalTimeline.ts +569 -0
- package/Tone/core/util/Math.ts +40 -0
- package/Tone/core/util/StateTimeline.test.ts +103 -0
- package/Tone/core/util/StateTimeline.ts +96 -0
- package/Tone/core/util/Timeline.test.ts +606 -0
- package/Tone/core/util/Timeline.ts +399 -0
- package/Tone/core/util/TimelineValue.test.ts +29 -0
- package/Tone/core/util/TimelineValue.ts +56 -0
- package/Tone/core/util/TypeCheck.ts +65 -0
- package/Tone/core/util/global.d.ts +7 -0
- package/Tone/core/worklet/DelayLine.worklet.ts +49 -0
- package/Tone/core/worklet/SingleIOProcessor.worklet.ts +73 -0
- package/Tone/core/worklet/ToneAudioWorklet.ts +76 -0
- package/Tone/core/worklet/ToneAudioWorkletProcessor.worklet.ts +35 -0
- package/Tone/core/worklet/WorkletGlobalScope.ts +26 -0
- package/Tone/effect/AutoFilter.test.ts +113 -0
- package/Tone/effect/AutoFilter.ts +102 -0
- package/Tone/effect/AutoPanner.test.ts +90 -0
- package/Tone/effect/AutoPanner.ts +63 -0
- package/Tone/effect/AutoWah.test.ts +61 -0
- package/Tone/effect/AutoWah.ts +208 -0
- package/Tone/effect/BitCrusher.test.ts +42 -0
- package/Tone/effect/BitCrusher.ts +129 -0
- package/Tone/effect/BitCrusher.worklet.ts +27 -0
- package/Tone/effect/Chebyshev.test.ts +49 -0
- package/Tone/effect/Chebyshev.ts +123 -0
- package/Tone/effect/Chorus.test.ts +87 -0
- package/Tone/effect/Chorus.ts +225 -0
- package/Tone/effect/Distortion.test.ts +41 -0
- package/Tone/effect/Distortion.ts +98 -0
- package/Tone/effect/Effect.ts +88 -0
- package/Tone/effect/FeedbackDelay.test.ts +75 -0
- package/Tone/effect/FeedbackDelay.ts +73 -0
- package/Tone/effect/FeedbackEffect.ts +68 -0
- package/Tone/effect/Freeverb.test.ts +45 -0
- package/Tone/effect/Freeverb.ts +137 -0
- package/Tone/effect/FrequencyShifter.test.ts +55 -0
- package/Tone/effect/FrequencyShifter.ts +155 -0
- package/Tone/effect/JCReverb.test.ts +41 -0
- package/Tone/effect/JCReverb.ts +130 -0
- package/Tone/effect/LFOEffect.ts +115 -0
- package/Tone/effect/MidSideEffect.ts +93 -0
- package/Tone/effect/Phaser.test.ts +44 -0
- package/Tone/effect/Phaser.ts +187 -0
- package/Tone/effect/PingPongDelay.test.ts +41 -0
- package/Tone/effect/PingPongDelay.ts +105 -0
- package/Tone/effect/PitchShift.test.ts +66 -0
- package/Tone/effect/PitchShift.ts +218 -0
- package/Tone/effect/Reverb.test.ts +75 -0
- package/Tone/effect/Reverb.ts +145 -0
- package/Tone/effect/StereoEffect.ts +99 -0
- package/Tone/effect/StereoFeedbackEffect.ts +91 -0
- package/Tone/effect/StereoWidener.test.ts +41 -0
- package/Tone/effect/StereoWidener.ts +112 -0
- package/Tone/effect/StereoXFeedbackEffect.ts +37 -0
- package/Tone/effect/Tremolo.test.ts +88 -0
- package/Tone/effect/Tremolo.ts +191 -0
- package/Tone/effect/Vibrato.test.ts +52 -0
- package/Tone/effect/Vibrato.ts +104 -0
- package/Tone/effect/index.ts +18 -0
- package/Tone/event/Loop.test.ts +334 -0
- package/Tone/event/Loop.ts +210 -0
- package/Tone/event/Part.test.ts +848 -0
- package/Tone/event/Part.ts +473 -0
- package/Tone/event/Pattern.test.ts +137 -0
- package/Tone/event/Pattern.ts +121 -0
- package/Tone/event/PatternGenerator.test.ts +95 -0
- package/Tone/event/PatternGenerator.ts +176 -0
- package/Tone/event/Sequence.test.ts +453 -0
- package/Tone/event/Sequence.ts +300 -0
- package/Tone/event/ToneEvent.test.ts +485 -0
- package/Tone/event/ToneEvent.ts +392 -0
- package/Tone/event/index.ts +5 -0
- package/Tone/fromContext.test.ts +29 -0
- package/Tone/fromContext.ts +77 -0
- package/Tone/index.test.ts +54 -0
- package/Tone/index.ts +116 -0
- package/Tone/instrument/AMSynth.test.ts +79 -0
- package/Tone/instrument/AMSynth.ts +51 -0
- package/Tone/instrument/DuoSynth.test.ts +95 -0
- package/Tone/instrument/DuoSynth.ts +216 -0
- package/Tone/instrument/FMSynth.test.ts +72 -0
- package/Tone/instrument/FMSynth.ts +65 -0
- package/Tone/instrument/Instrument.ts +180 -0
- package/Tone/instrument/MembraneSynth.test.ts +74 -0
- package/Tone/instrument/MembraneSynth.ts +96 -0
- package/Tone/instrument/MetalSynth.test.ts +66 -0
- package/Tone/instrument/MetalSynth.ts +272 -0
- package/Tone/instrument/ModulationSynth.ts +217 -0
- package/Tone/instrument/MonoSynth.test.ts +88 -0
- package/Tone/instrument/MonoSynth.ts +177 -0
- package/Tone/instrument/Monophonic.ts +135 -0
- package/Tone/instrument/NoiseSynth.test.ts +82 -0
- package/Tone/instrument/NoiseSynth.ts +127 -0
- package/Tone/instrument/PluckSynth.test.ts +62 -0
- package/Tone/instrument/PluckSynth.ts +127 -0
- package/Tone/instrument/PolySynth.test.ts +298 -0
- package/Tone/instrument/PolySynth.ts +393 -0
- package/Tone/instrument/Sampler.test.ts +275 -0
- package/Tone/instrument/Sampler.ts +329 -0
- package/Tone/instrument/Synth.test.ts +132 -0
- package/Tone/instrument/Synth.ts +141 -0
- package/Tone/instrument/index.ts +11 -0
- package/Tone/signal/Abs.test.ts +42 -0
- package/Tone/signal/Abs.ts +53 -0
- package/Tone/signal/Add.test.ts +60 -0
- package/Tone/signal/Add.ts +63 -0
- package/Tone/signal/AudioToGain.test.ts +53 -0
- package/Tone/signal/AudioToGain.ts +40 -0
- package/Tone/signal/GainToAudio.test.ts +41 -0
- package/Tone/signal/GainToAudio.ts +40 -0
- package/Tone/signal/GreaterThan.test.ts +81 -0
- package/Tone/signal/GreaterThan.ts +88 -0
- package/Tone/signal/GreaterThanZero.test.ts +49 -0
- package/Tone/signal/GreaterThanZero.ts +67 -0
- package/Tone/signal/Multiply.test.ts +46 -0
- package/Tone/signal/Multiply.ts +85 -0
- package/Tone/signal/Negate.test.ts +30 -0
- package/Tone/signal/Negate.ts +41 -0
- package/Tone/signal/Pow.test.ts +40 -0
- package/Tone/signal/Pow.ts +84 -0
- package/Tone/signal/Scale.test.ts +58 -0
- package/Tone/signal/Scale.ts +119 -0
- package/Tone/signal/ScaleExp.test.ts +49 -0
- package/Tone/signal/ScaleExp.ts +69 -0
- package/Tone/signal/Signal.test.ts +519 -0
- package/Tone/signal/Signal.ts +226 -0
- package/Tone/signal/SignalOperator.ts +21 -0
- package/Tone/signal/Subtract.test.ts +60 -0
- package/Tone/signal/Subtract.ts +74 -0
- package/Tone/signal/SyncedSignal.test.ts +245 -0
- package/Tone/signal/SyncedSignal.ts +172 -0
- package/Tone/signal/ToneConstantSource.test.ts +202 -0
- package/Tone/signal/ToneConstantSource.ts +90 -0
- package/Tone/signal/WaveShaper.test.ts +95 -0
- package/Tone/signal/WaveShaper.ts +136 -0
- package/Tone/signal/Zero.test.ts +25 -0
- package/Tone/signal/Zero.ts +45 -0
- package/Tone/signal/index.ts +16 -0
- package/Tone/source/Noise.test.ts +121 -0
- package/Tone/source/Noise.ts +287 -0
- package/Tone/source/OneShotSource.ts +260 -0
- package/Tone/source/Source.test.ts +408 -0
- package/Tone/source/Source.ts +339 -0
- package/Tone/source/UserMedia.test.ts +177 -0
- package/Tone/source/UserMedia.ts +260 -0
- package/Tone/source/buffer/GrainPlayer.test.ts +235 -0
- package/Tone/source/buffer/GrainPlayer.ts +322 -0
- package/Tone/source/buffer/Player.test.ts +651 -0
- package/Tone/source/buffer/Player.ts +440 -0
- package/Tone/source/buffer/Players.test.ts +288 -0
- package/Tone/source/buffer/Players.ts +235 -0
- package/Tone/source/buffer/ToneBufferSource.test.ts +578 -0
- package/Tone/source/buffer/ToneBufferSource.ts +253 -0
- package/Tone/source/index.ts +15 -0
- package/Tone/source/oscillator/AMOscillator.test.ts +69 -0
- package/Tone/source/oscillator/AMOscillator.ts +222 -0
- package/Tone/source/oscillator/FMOscillator.test.ts +85 -0
- package/Tone/source/oscillator/FMOscillator.ts +236 -0
- package/Tone/source/oscillator/FatOscillator.test.ts +91 -0
- package/Tone/source/oscillator/FatOscillator.ts +255 -0
- package/Tone/source/oscillator/LFO.test.ts +234 -0
- package/Tone/source/oscillator/LFO.ts +332 -0
- package/Tone/source/oscillator/OmniOscillator.test.ts +303 -0
- package/Tone/source/oscillator/OmniOscillator.ts +428 -0
- package/Tone/source/oscillator/Oscillator.test.ts +278 -0
- package/Tone/source/oscillator/Oscillator.ts +448 -0
- package/Tone/source/oscillator/OscillatorInterface.ts +462 -0
- package/Tone/source/oscillator/PWMOscillator.test.ts +49 -0
- package/Tone/source/oscillator/PWMOscillator.ts +190 -0
- package/Tone/source/oscillator/PulseOscillator.test.ts +126 -0
- package/Tone/source/oscillator/PulseOscillator.ts +225 -0
- package/Tone/source/oscillator/ToneOscillatorNode.test.ts +241 -0
- package/Tone/source/oscillator/ToneOscillatorNode.ts +131 -0
- package/Tone/version.ts +1 -0
- package/build/Tone.js +22 -0
- package/build/Tone.js.map +1 -0
- package/build/esm/classes.d.ts +7 -0
- package/build/esm/classes.js +8 -0
- package/build/esm/classes.js.map +1 -0
- package/build/esm/component/analysis/Analyser.d.ts +77 -0
- package/build/esm/component/analysis/Analyser.js +121 -0
- package/build/esm/component/analysis/Analyser.js.map +1 -0
- package/build/esm/component/analysis/DCMeter.d.ts +23 -0
- package/build/esm/component/analysis/DCMeter.js +31 -0
- package/build/esm/component/analysis/DCMeter.js.map +1 -0
- package/build/esm/component/analysis/FFT.d.ts +50 -0
- package/build/esm/component/analysis/FFT.js +65 -0
- package/build/esm/component/analysis/FFT.js.map +1 -0
- package/build/esm/component/analysis/Follower.d.ts +44 -0
- package/build/esm/component/analysis/Follower.js +51 -0
- package/build/esm/component/analysis/Follower.js.map +1 -0
- package/build/esm/component/analysis/Meter.d.ts +62 -0
- package/build/esm/component/analysis/Meter.js +90 -0
- package/build/esm/component/analysis/Meter.js.map +1 -0
- package/build/esm/component/analysis/MeterBase.d.ts +23 -0
- package/build/esm/component/analysis/MeterBase.js +23 -0
- package/build/esm/component/analysis/MeterBase.js.map +1 -0
- package/build/esm/component/analysis/Waveform.d.ts +32 -0
- package/build/esm/component/analysis/Waveform.js +38 -0
- package/build/esm/component/analysis/Waveform.js.map +1 -0
- package/build/esm/component/channel/Channel.d.ts +91 -0
- package/build/esm/component/channel/Channel.js +124 -0
- package/build/esm/component/channel/Channel.js.map +1 -0
- package/build/esm/component/channel/CrossFade.d.ts +80 -0
- package/build/esm/component/channel/CrossFade.js +106 -0
- package/build/esm/component/channel/CrossFade.js.map +1 -0
- package/build/esm/component/channel/Merge.d.ts +39 -0
- package/build/esm/component/channel/Merge.js +32 -0
- package/build/esm/component/channel/Merge.js.map +1 -0
- package/build/esm/component/channel/MidSideMerge.d.ts +52 -0
- package/build/esm/component/channel/MidSideMerge.js +53 -0
- package/build/esm/component/channel/MidSideMerge.js.map +1 -0
- package/build/esm/component/channel/MidSideSplit.d.ts +42 -0
- package/build/esm/component/channel/MidSideSplit.js +51 -0
- package/build/esm/component/channel/MidSideSplit.js.map +1 -0
- package/build/esm/component/channel/Mono.d.ts +26 -0
- package/build/esm/component/channel/Mono.js +30 -0
- package/build/esm/component/channel/Mono.js.map +1 -0
- package/build/esm/component/channel/MultibandSplit.d.ts +80 -0
- package/build/esm/component/channel/MultibandSplit.js +121 -0
- package/build/esm/component/channel/MultibandSplit.js.map +1 -0
- package/build/esm/component/channel/PanVol.d.ts +53 -0
- package/build/esm/component/channel/PanVol.js +61 -0
- package/build/esm/component/channel/PanVol.js.map +1 -0
- package/build/esm/component/channel/Panner.d.ts +49 -0
- package/build/esm/component/channel/Panner.js +55 -0
- package/build/esm/component/channel/Panner.js.map +1 -0
- package/build/esm/component/channel/Panner3D.d.ts +98 -0
- package/build/esm/component/channel/Panner3D.js +177 -0
- package/build/esm/component/channel/Panner3D.js.map +1 -0
- package/build/esm/component/channel/Recorder.d.ts +77 -0
- package/build/esm/component/channel/Recorder.js +131 -0
- package/build/esm/component/channel/Recorder.js.map +1 -0
- package/build/esm/component/channel/Solo.d.ts +68 -0
- package/build/esm/component/channel/Solo.js +121 -0
- package/build/esm/component/channel/Solo.js.map +1 -0
- package/build/esm/component/channel/Split.d.ts +29 -0
- package/build/esm/component/channel/Split.js +30 -0
- package/build/esm/component/channel/Split.js.map +1 -0
- package/build/esm/component/channel/Volume.d.ts +60 -0
- package/build/esm/component/channel/Volume.js +66 -0
- package/build/esm/component/channel/Volume.js.map +1 -0
- package/build/esm/component/dynamics/Compressor.d.ts +73 -0
- package/build/esm/component/dynamics/Compressor.js +99 -0
- package/build/esm/component/dynamics/Compressor.js.map +1 -0
- package/build/esm/component/dynamics/Gate.d.ts +53 -0
- package/build/esm/component/dynamics/Gate.js +72 -0
- package/build/esm/component/dynamics/Gate.js.map +1 -0
- package/build/esm/component/dynamics/Limiter.d.ts +39 -0
- package/build/esm/component/dynamics/Limiter.js +51 -0
- package/build/esm/component/dynamics/Limiter.js.map +1 -0
- package/build/esm/component/dynamics/MidSideCompressor.d.ts +36 -0
- package/build/esm/component/dynamics/MidSideCompressor.js +52 -0
- package/build/esm/component/dynamics/MidSideCompressor.js.map +1 -0
- package/build/esm/component/dynamics/MultibandCompressor.d.ts +57 -0
- package/build/esm/component/dynamics/MultibandCompressor.js +79 -0
- package/build/esm/component/dynamics/MultibandCompressor.js.map +1 -0
- package/build/esm/component/envelope/AmplitudeEnvelope.d.ts +46 -0
- package/build/esm/component/envelope/AmplitudeEnvelope.js +49 -0
- package/build/esm/component/envelope/AmplitudeEnvelope.js.map +1 -0
- package/build/esm/component/envelope/Envelope.d.ts +302 -0
- package/build/esm/component/envelope/Envelope.js +470 -0
- package/build/esm/component/envelope/Envelope.js.map +1 -0
- package/build/esm/component/envelope/FrequencyEnvelope.d.ts +71 -0
- package/build/esm/component/envelope/FrequencyEnvelope.js +91 -0
- package/build/esm/component/envelope/FrequencyEnvelope.js.map +1 -0
- package/build/esm/component/filter/BiquadFilter.d.ts +64 -0
- package/build/esm/component/filter/BiquadFilter.js +101 -0
- package/build/esm/component/filter/BiquadFilter.js.map +1 -0
- package/build/esm/component/filter/Convolver.d.ts +59 -0
- package/build/esm/component/filter/Convolver.js +104 -0
- package/build/esm/component/filter/Convolver.js.map +1 -0
- package/build/esm/component/filter/EQ3.d.ts +77 -0
- package/build/esm/component/filter/EQ3.js +81 -0
- package/build/esm/component/filter/EQ3.js.map +1 -0
- package/build/esm/component/filter/FeedbackCombFilter.d.ts +45 -0
- package/build/esm/component/filter/FeedbackCombFilter.js +72 -0
- package/build/esm/component/filter/FeedbackCombFilter.js.map +1 -0
- package/build/esm/component/filter/FeedbackCombFilter.worklet.d.ts +3 -0
- package/build/esm/component/filter/FeedbackCombFilter.worklet.js +37 -0
- package/build/esm/component/filter/FeedbackCombFilter.worklet.js.map +1 -0
- package/build/esm/component/filter/Filter.d.ts +79 -0
- package/build/esm/component/filter/Filter.js +150 -0
- package/build/esm/component/filter/Filter.js.map +1 -0
- package/build/esm/component/filter/LowpassCombFilter.d.ts +50 -0
- package/build/esm/component/filter/LowpassCombFilter.js +53 -0
- package/build/esm/component/filter/LowpassCombFilter.js.map +1 -0
- package/build/esm/component/filter/OnePoleFilter.d.ts +64 -0
- package/build/esm/component/filter/OnePoleFilter.js +104 -0
- package/build/esm/component/filter/OnePoleFilter.js.map +1 -0
- package/build/esm/component/filter/PhaseShiftAllpass.d.ts +40 -0
- package/build/esm/component/filter/PhaseShiftAllpass.js +54 -0
- package/build/esm/component/filter/PhaseShiftAllpass.js.map +1 -0
- package/build/esm/component/index.d.ts +35 -0
- package/build/esm/component/index.js +36 -0
- package/build/esm/component/index.js.map +1 -0
- package/build/esm/core/Global.d.ts +26 -0
- package/build/esm/core/Global.js +69 -0
- package/build/esm/core/Global.js.map +1 -0
- package/build/esm/core/Tone.d.ts +60 -0
- package/build/esm/core/Tone.js +87 -0
- package/build/esm/core/Tone.js.map +1 -0
- package/build/esm/core/clock/Clock.d.ts +156 -0
- package/build/esm/core/clock/Clock.js +251 -0
- package/build/esm/core/clock/Clock.js.map +1 -0
- package/build/esm/core/clock/TickParam.d.ts +97 -0
- package/build/esm/core/clock/TickParam.js +237 -0
- package/build/esm/core/clock/TickParam.js.map +1 -0
- package/build/esm/core/clock/TickSignal.d.ts +43 -0
- package/build/esm/core/clock/TickSignal.js +64 -0
- package/build/esm/core/clock/TickSignal.js.map +1 -0
- package/build/esm/core/clock/TickSource.d.ts +115 -0
- package/build/esm/core/clock/TickSource.js +284 -0
- package/build/esm/core/clock/TickSource.js.map +1 -0
- package/build/esm/core/clock/Ticker.d.ts +59 -0
- package/build/esm/core/clock/Ticker.js +110 -0
- package/build/esm/core/clock/Ticker.js.map +1 -0
- package/build/esm/core/clock/Transport.d.ts +331 -0
- package/build/esm/core/clock/Transport.js +591 -0
- package/build/esm/core/clock/Transport.js.map +1 -0
- package/build/esm/core/clock/TransportEvent.d.ts +62 -0
- package/build/esm/core/clock/TransportEvent.js +66 -0
- package/build/esm/core/clock/TransportEvent.js.map +1 -0
- package/build/esm/core/clock/TransportRepeatEvent.d.ts +70 -0
- package/build/esm/core/clock/TransportRepeatEvent.js +110 -0
- package/build/esm/core/clock/TransportRepeatEvent.js.map +1 -0
- package/build/esm/core/context/AbstractParam.d.ts +239 -0
- package/build/esm/core/context/AbstractParam.js +6 -0
- package/build/esm/core/context/AbstractParam.js.map +1 -0
- package/build/esm/core/context/AudioContext.d.ts +36 -0
- package/build/esm/core/context/AudioContext.js +38 -0
- package/build/esm/core/context/AudioContext.js.map +1 -0
- package/build/esm/core/context/BaseContext.d.ts +56 -0
- package/build/esm/core/context/BaseContext.js +16 -0
- package/build/esm/core/context/BaseContext.js.map +1 -0
- package/build/esm/core/context/Context.d.ts +255 -0
- package/build/esm/core/context/Context.js +474 -0
- package/build/esm/core/context/Context.js.map +1 -0
- package/build/esm/core/context/ContextInitialization.d.ts +15 -0
- package/build/esm/core/context/ContextInitialization.js +35 -0
- package/build/esm/core/context/ContextInitialization.js.map +1 -0
- package/build/esm/core/context/Delay.d.ts +58 -0
- package/build/esm/core/context/Delay.js +58 -0
- package/build/esm/core/context/Delay.js.map +1 -0
- package/build/esm/core/context/Destination.d.ts +73 -0
- package/build/esm/core/context/Destination.js +105 -0
- package/build/esm/core/context/Destination.js.map +1 -0
- package/build/esm/core/context/DummyContext.d.ts +54 -0
- package/build/esm/core/context/DummyContext.js +138 -0
- package/build/esm/core/context/DummyContext.js.map +1 -0
- package/build/esm/core/context/Gain.d.ts +53 -0
- package/build/esm/core/context/Gain.js +58 -0
- package/build/esm/core/context/Gain.js.map +1 -0
- package/build/esm/core/context/Listener.d.ts +38 -0
- package/build/esm/core/context/Listener.js +87 -0
- package/build/esm/core/context/Listener.js.map +1 -0
- package/build/esm/core/context/Offline.d.ts +37 -0
- package/build/esm/core/context/Offline.js +56 -0
- package/build/esm/core/context/Offline.js.map +1 -0
- package/build/esm/core/context/OfflineContext.d.ts +58 -0
- package/build/esm/core/context/OfflineContext.js +87 -0
- package/build/esm/core/context/OfflineContext.js.map +1 -0
- package/build/esm/core/context/Param.d.ts +132 -0
- package/build/esm/core/context/Param.js +446 -0
- package/build/esm/core/context/Param.js.map +1 -0
- package/build/esm/core/context/ToneAudioBuffer.d.ts +162 -0
- package/build/esm/core/context/ToneAudioBuffer.js +364 -0
- package/build/esm/core/context/ToneAudioBuffer.js.map +1 -0
- package/build/esm/core/context/ToneAudioBuffers.d.ts +89 -0
- package/build/esm/core/context/ToneAudioBuffers.js +119 -0
- package/build/esm/core/context/ToneAudioBuffers.js.map +1 -0
- package/build/esm/core/context/ToneAudioNode.d.ts +173 -0
- package/build/esm/core/context/ToneAudioNode.js +342 -0
- package/build/esm/core/context/ToneAudioNode.js.map +1 -0
- package/build/esm/core/context/ToneWithContext.d.ts +108 -0
- package/build/esm/core/context/ToneWithContext.js +170 -0
- package/build/esm/core/context/ToneWithContext.js.map +1 -0
- package/build/esm/core/index.d.ts +28 -0
- package/build/esm/core/index.js +33 -0
- package/build/esm/core/index.js.map +1 -0
- package/build/esm/core/type/Conversions.d.ts +44 -0
- package/build/esm/core/type/Conversions.js +68 -0
- package/build/esm/core/type/Conversions.js.map +1 -0
- package/build/esm/core/type/Frequency.d.ts +101 -0
- package/build/esm/core/type/Frequency.js +225 -0
- package/build/esm/core/type/Frequency.js.map +1 -0
- package/build/esm/core/type/Midi.d.ts +53 -0
- package/build/esm/core/type/Midi.js +73 -0
- package/build/esm/core/type/Midi.js.map +1 -0
- package/build/esm/core/type/NoteUnits.d.ts +12 -0
- package/build/esm/core/type/NoteUnits.js +3 -0
- package/build/esm/core/type/NoteUnits.js.map +1 -0
- package/build/esm/core/type/Ticks.d.ts +44 -0
- package/build/esm/core/type/Ticks.js +61 -0
- package/build/esm/core/type/Ticks.js.map +1 -0
- package/build/esm/core/type/Time.d.ts +69 -0
- package/build/esm/core/type/Time.js +147 -0
- package/build/esm/core/type/Time.js.map +1 -0
- package/build/esm/core/type/TimeBase.d.ts +120 -0
- package/build/esm/core/type/TimeBase.js +251 -0
- package/build/esm/core/type/TimeBase.js.map +1 -0
- package/build/esm/core/type/TransportTime.d.ts +25 -0
- package/build/esm/core/type/TransportTime.js +32 -0
- package/build/esm/core/type/TransportTime.js.map +1 -0
- package/build/esm/core/type/Units.d.ts +176 -0
- package/build/esm/core/type/Units.js +2 -0
- package/build/esm/core/type/Units.js.map +1 -0
- package/build/esm/core/util/AdvancedTypeCheck.d.ts +21 -0
- package/build/esm/core/util/AdvancedTypeCheck.js +32 -0
- package/build/esm/core/util/AdvancedTypeCheck.js.map +1 -0
- package/build/esm/core/util/Debug.d.ts +34 -0
- package/build/esm/core/util/Debug.js +50 -0
- package/build/esm/core/util/Debug.js.map +1 -0
- package/build/esm/core/util/Decorator.d.ts +9 -0
- package/build/esm/core/util/Decorator.js +41 -0
- package/build/esm/core/util/Decorator.js.map +1 -0
- package/build/esm/core/util/Defaults.d.ts +32 -0
- package/build/esm/core/util/Defaults.js +99 -0
- package/build/esm/core/util/Defaults.js.map +1 -0
- package/build/esm/core/util/Draw.d.ts +67 -0
- package/build/esm/core/util/Draw.js +110 -0
- package/build/esm/core/util/Draw.js.map +1 -0
- package/build/esm/core/util/Emitter.d.ts +52 -0
- package/build/esm/core/util/Emitter.js +113 -0
- package/build/esm/core/util/Emitter.js.map +1 -0
- package/build/esm/core/util/Interface.d.ts +16 -0
- package/build/esm/core/util/Interface.js +32 -0
- package/build/esm/core/util/Interface.js.map +1 -0
- package/build/esm/core/util/IntervalTimeline.d.ts +106 -0
- package/build/esm/core/util/IntervalTimeline.js +539 -0
- package/build/esm/core/util/IntervalTimeline.js.map +1 -0
- package/build/esm/core/util/Math.d.ts +20 -0
- package/build/esm/core/util/Math.js +36 -0
- package/build/esm/core/util/Math.js.map +1 -0
- package/build/esm/core/util/StateTimeline.d.ts +47 -0
- package/build/esm/core/util/StateTimeline.js +78 -0
- package/build/esm/core/util/StateTimeline.js.map +1 -0
- package/build/esm/core/util/Timeline.d.ts +156 -0
- package/build/esm/core/util/Timeline.js +351 -0
- package/build/esm/core/util/Timeline.js.map +1 -0
- package/build/esm/core/util/TimelineValue.d.ts +28 -0
- package/build/esm/core/util/TimelineValue.js +41 -0
- package/build/esm/core/util/TimelineValue.js.map +1 -0
- package/build/esm/core/util/TypeCheck.d.ts +38 -0
- package/build/esm/core/util/TypeCheck.js +56 -0
- package/build/esm/core/util/TypeCheck.js.map +1 -0
- package/build/esm/core/worklet/DelayLine.worklet.d.ts +1 -0
- package/build/esm/core/worklet/DelayLine.worklet.js +48 -0
- package/build/esm/core/worklet/DelayLine.worklet.js.map +1 -0
- package/build/esm/core/worklet/SingleIOProcessor.worklet.d.ts +2 -0
- package/build/esm/core/worklet/SingleIOProcessor.worklet.js +72 -0
- package/build/esm/core/worklet/SingleIOProcessor.worklet.js.map +1 -0
- package/build/esm/core/worklet/ToneAudioWorklet.d.ts +35 -0
- package/build/esm/core/worklet/ToneAudioWorklet.js +40 -0
- package/build/esm/core/worklet/ToneAudioWorklet.js.map +1 -0
- package/build/esm/core/worklet/ToneAudioWorkletProcessor.worklet.d.ts +1 -0
- package/build/esm/core/worklet/ToneAudioWorkletProcessor.worklet.js +34 -0
- package/build/esm/core/worklet/ToneAudioWorkletProcessor.worklet.js.map +1 -0
- package/build/esm/core/worklet/WorkletGlobalScope.d.ts +12 -0
- package/build/esm/core/worklet/WorkletGlobalScope.js +24 -0
- package/build/esm/core/worklet/WorkletGlobalScope.js.map +1 -0
- package/build/esm/effect/AutoFilter.d.ts +51 -0
- package/build/esm/effect/AutoFilter.js +68 -0
- package/build/esm/effect/AutoFilter.js.map +1 -0
- package/build/esm/effect/AutoPanner.d.ts +31 -0
- package/build/esm/effect/AutoPanner.js +41 -0
- package/build/esm/effect/AutoPanner.js.map +1 -0
- package/build/esm/effect/AutoWah.d.ts +99 -0
- package/build/esm/effect/AutoWah.js +131 -0
- package/build/esm/effect/AutoWah.js.map +1 -0
- package/build/esm/effect/BitCrusher.d.ts +40 -0
- package/build/esm/effect/BitCrusher.js +85 -0
- package/build/esm/effect/BitCrusher.js.map +1 -0
- package/build/esm/effect/BitCrusher.worklet.d.ts +3 -0
- package/build/esm/effect/BitCrusher.worklet.js +25 -0
- package/build/esm/effect/BitCrusher.worklet.js.map +1 -0
- package/build/esm/effect/Chebyshev.d.ts +62 -0
- package/build/esm/effect/Chebyshev.js +95 -0
- package/build/esm/effect/Chebyshev.js.map +1 -0
- package/build/esm/effect/Chorus.d.ts +104 -0
- package/build/esm/effect/Chorus.js +157 -0
- package/build/esm/effect/Chorus.js.map +1 -0
- package/build/esm/effect/Distortion.d.ts +43 -0
- package/build/esm/effect/Distortion.js +69 -0
- package/build/esm/effect/Distortion.js.map +1 -0
- package/build/esm/effect/Effect.d.ts +49 -0
- package/build/esm/effect/Effect.js +70 -0
- package/build/esm/effect/Effect.js.map +1 -0
- package/build/esm/effect/FeedbackDelay.d.ts +37 -0
- package/build/esm/effect/FeedbackDelay.js +47 -0
- package/build/esm/effect/FeedbackDelay.js.map +1 -0
- package/build/esm/effect/FeedbackEffect.d.ts +34 -0
- package/build/esm/effect/FeedbackEffect.js +34 -0
- package/build/esm/effect/FeedbackEffect.js.map +1 -0
- package/build/esm/effect/Freeverb.d.ts +51 -0
- package/build/esm/effect/Freeverb.js +104 -0
- package/build/esm/effect/Freeverb.js.map +1 -0
- package/build/esm/effect/FrequencyShifter.d.ts +68 -0
- package/build/esm/effect/FrequencyShifter.js +88 -0
- package/build/esm/effect/FrequencyShifter.js.map +1 -0
- package/build/esm/effect/JCReverb.d.ts +46 -0
- package/build/esm/effect/JCReverb.js +97 -0
- package/build/esm/effect/JCReverb.js.map +1 -0
- package/build/esm/effect/LFOEffect.d.ts +58 -0
- package/build/esm/effect/LFOEffect.js +77 -0
- package/build/esm/effect/LFOEffect.js.map +1 -0
- package/build/esm/effect/MidSideEffect.d.ts +50 -0
- package/build/esm/effect/MidSideEffect.js +51 -0
- package/build/esm/effect/MidSideEffect.js.map +1 -0
- package/build/esm/effect/Phaser.d.ts +80 -0
- package/build/esm/effect/Phaser.js +119 -0
- package/build/esm/effect/Phaser.js.map +1 -0
- package/build/esm/effect/PingPongDelay.d.ts +48 -0
- package/build/esm/effect/PingPongDelay.js +66 -0
- package/build/esm/effect/PingPongDelay.js.map +1 -0
- package/build/esm/effect/PitchShift.d.ts +89 -0
- package/build/esm/effect/PitchShift.js +140 -0
- package/build/esm/effect/PitchShift.js.map +1 -0
- package/build/esm/effect/Reverb.d.ts +62 -0
- package/build/esm/effect/Reverb.js +111 -0
- package/build/esm/effect/Reverb.js.map +1 -0
- package/build/esm/effect/StereoEffect.d.ts +44 -0
- package/build/esm/effect/StereoEffect.js +61 -0
- package/build/esm/effect/StereoEffect.js.map +1 -0
- package/build/esm/effect/StereoFeedbackEffect.d.ts +39 -0
- package/build/esm/effect/StereoFeedbackEffect.js +49 -0
- package/build/esm/effect/StereoFeedbackEffect.js.map +1 -0
- package/build/esm/effect/StereoWidener.d.ts +50 -0
- package/build/esm/effect/StereoWidener.js +65 -0
- package/build/esm/effect/StereoWidener.js.map +1 -0
- package/build/esm/effect/StereoXFeedbackEffect.d.ts +21 -0
- package/build/esm/effect/StereoXFeedbackEffect.js +28 -0
- package/build/esm/effect/StereoXFeedbackEffect.js.map +1 -0
- package/build/esm/effect/Tremolo.d.ts +86 -0
- package/build/esm/effect/Tremolo.js +131 -0
- package/build/esm/effect/Tremolo.js.map +1 -0
- package/build/esm/effect/Vibrato.d.ts +48 -0
- package/build/esm/effect/Vibrato.js +61 -0
- package/build/esm/effect/Vibrato.js.map +1 -0
- package/build/esm/effect/index.d.ts +18 -0
- package/build/esm/effect/index.js +19 -0
- package/build/esm/effect/index.js.map +1 -0
- package/build/esm/event/Loop.d.ts +107 -0
- package/build/esm/event/Loop.js +164 -0
- package/build/esm/event/Loop.js.map +1 -0
- package/build/esm/event/Part.d.ts +193 -0
- package/build/esm/event/Part.js +401 -0
- package/build/esm/event/Part.js.map +1 -0
- package/build/esm/event/Pattern.d.ts +67 -0
- package/build/esm/event/Pattern.js +67 -0
- package/build/esm/event/Pattern.js.map +1 -0
- package/build/esm/event/PatternGenerator.d.ts +12 -0
- package/build/esm/event/PatternGenerator.js +165 -0
- package/build/esm/event/PatternGenerator.js.map +1 -0
- package/build/esm/event/Sequence.d.ts +127 -0
- package/build/esm/event/Sequence.js +247 -0
- package/build/esm/event/Sequence.js.map +1 -0
- package/build/esm/event/ToneEvent.d.ts +188 -0
- package/build/esm/event/ToneEvent.js +299 -0
- package/build/esm/event/ToneEvent.js.map +1 -0
- package/build/esm/event/index.d.ts +5 -0
- package/build/esm/event/index.js +6 -0
- package/build/esm/event/index.js.map +1 -0
- package/build/esm/fromContext.d.ts +26 -0
- package/build/esm/fromContext.js +41 -0
- package/build/esm/fromContext.js.map +1 -0
- package/build/esm/index.d.ts +86 -0
- package/build/esm/index.js +102 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/instrument/AMSynth.d.ts +25 -0
- package/build/esm/instrument/AMSynth.js +37 -0
- package/build/esm/instrument/AMSynth.js.map +1 -0
- package/build/esm/instrument/DuoSynth.d.ts +72 -0
- package/build/esm/instrument/DuoSynth.js +140 -0
- package/build/esm/instrument/DuoSynth.js.map +1 -0
- package/build/esm/instrument/FMSynth.d.ts +31 -0
- package/build/esm/instrument/FMSynth.js +45 -0
- package/build/esm/instrument/FMSynth.js.map +1 -0
- package/build/esm/instrument/Instrument.d.ts +100 -0
- package/build/esm/instrument/Instrument.js +127 -0
- package/build/esm/instrument/Instrument.js.map +1 -0
- package/build/esm/instrument/MembraneSynth.d.ts +47 -0
- package/build/esm/instrument/MembraneSynth.js +69 -0
- package/build/esm/instrument/MembraneSynth.js.map +1 -0
- package/build/esm/instrument/MetalSynth.d.ts +109 -0
- package/build/esm/instrument/MetalSynth.js +198 -0
- package/build/esm/instrument/MetalSynth.js.map +1 -0
- package/build/esm/instrument/ModulationSynth.d.ts +81 -0
- package/build/esm/instrument/ModulationSynth.js +122 -0
- package/build/esm/instrument/ModulationSynth.js.map +1 -0
- package/build/esm/instrument/MonoSynth.d.ts +76 -0
- package/build/esm/instrument/MonoSynth.js +113 -0
- package/build/esm/instrument/MonoSynth.js.map +1 -0
- package/build/esm/instrument/Monophonic.d.ts +82 -0
- package/build/esm/instrument/Monophonic.js +83 -0
- package/build/esm/instrument/Monophonic.js.map +1 -0
- package/build/esm/instrument/NoiseSynth.d.ts +51 -0
- package/build/esm/instrument/NoiseSynth.js +93 -0
- package/build/esm/instrument/NoiseSynth.js.map +1 -0
- package/build/esm/instrument/PluckSynth.d.ts +57 -0
- package/build/esm/instrument/PluckSynth.js +80 -0
- package/build/esm/instrument/PluckSynth.js.map +1 -0
- package/build/esm/instrument/PolySynth.d.ts +176 -0
- package/build/esm/instrument/PolySynth.js +302 -0
- package/build/esm/instrument/PolySynth.js.map +1 -0
- package/build/esm/instrument/Sampler.d.ts +126 -0
- package/build/esm/instrument/Sampler.js +259 -0
- package/build/esm/instrument/Sampler.js.map +1 -0
- package/build/esm/instrument/Synth.d.ts +65 -0
- package/build/esm/instrument/Synth.js +91 -0
- package/build/esm/instrument/Synth.js.map +1 -0
- package/build/esm/instrument/index.d.ts +11 -0
- package/build/esm/instrument/index.js +12 -0
- package/build/esm/instrument/index.js.map +1 -0
- package/build/esm/signal/Abs.d.ts +34 -0
- package/build/esm/signal/Abs.js +51 -0
- package/build/esm/signal/Abs.js.map +1 -0
- package/build/esm/signal/Add.d.ts +40 -0
- package/build/esm/signal/Add.js +49 -0
- package/build/esm/signal/Add.js.map +1 -0
- package/build/esm/signal/AudioToGain.d.ts +27 -0
- package/build/esm/signal/AudioToGain.js +37 -0
- package/build/esm/signal/AudioToGain.js.map +1 -0
- package/build/esm/signal/GainToAudio.d.ts +27 -0
- package/build/esm/signal/GainToAudio.js +37 -0
- package/build/esm/signal/GainToAudio.js.map +1 -0
- package/build/esm/signal/GreaterThan.d.ts +47 -0
- package/build/esm/signal/GreaterThan.js +46 -0
- package/build/esm/signal/GreaterThan.js.map +1 -0
- package/build/esm/signal/GreaterThanZero.d.ts +29 -0
- package/build/esm/signal/GreaterThanZero.js +45 -0
- package/build/esm/signal/GreaterThanZero.js.map +1 -0
- package/build/esm/signal/Multiply.d.ts +52 -0
- package/build/esm/signal/Multiply.js +51 -0
- package/build/esm/signal/Multiply.js.map +1 -0
- package/build/esm/signal/Negate.d.ts +29 -0
- package/build/esm/signal/Negate.js +39 -0
- package/build/esm/signal/Negate.js.map +1 -0
- package/build/esm/signal/Pow.d.ts +42 -0
- package/build/esm/signal/Pow.js +58 -0
- package/build/esm/signal/Pow.js.map +1 -0
- package/build/esm/signal/Scale.d.ts +62 -0
- package/build/esm/signal/Scale.js +73 -0
- package/build/esm/signal/Scale.js.map +1 -0
- package/build/esm/signal/ScaleExp.d.ts +37 -0
- package/build/esm/signal/ScaleExp.js +46 -0
- package/build/esm/signal/ScaleExp.js.map +1 -0
- package/build/esm/signal/Signal.d.ts +92 -0
- package/build/esm/signal/Signal.js +183 -0
- package/build/esm/signal/Signal.js.map +1 -0
- package/build/esm/signal/SignalOperator.d.ts +9 -0
- package/build/esm/signal/SignalOperator.js +16 -0
- package/build/esm/signal/SignalOperator.js.map +1 -0
- package/build/esm/signal/Subtract.d.ts +48 -0
- package/build/esm/signal/Subtract.js +58 -0
- package/build/esm/signal/Subtract.js.map +1 -0
- package/build/esm/signal/SyncedSignal.d.ts +53 -0
- package/build/esm/signal/SyncedSignal.js +124 -0
- package/build/esm/signal/SyncedSignal.js.map +1 -0
- package/build/esm/signal/ToneConstantSource.d.ts +39 -0
- package/build/esm/signal/ToneConstantSource.js +61 -0
- package/build/esm/signal/ToneConstantSource.js.map +1 -0
- package/build/esm/signal/WaveShaper.d.ts +81 -0
- package/build/esm/signal/WaveShaper.js +99 -0
- package/build/esm/signal/WaveShaper.js.map +1 -0
- package/build/esm/signal/Zero.d.ts +29 -0
- package/build/esm/signal/Zero.js +38 -0
- package/build/esm/signal/Zero.js.map +1 -0
- package/build/esm/signal/index.d.ts +16 -0
- package/build/esm/signal/index.js +17 -0
- package/build/esm/signal/index.js.map +1 -0
- package/build/esm/source/Noise.d.ts +96 -0
- package/build/esm/source/Noise.js +225 -0
- package/build/esm/source/Noise.js.map +1 -0
- package/build/esm/source/OneShotSource.d.ts +102 -0
- package/build/esm/source/OneShotSource.js +183 -0
- package/build/esm/source/OneShotSource.js.map +1 -0
- package/build/esm/source/Source.d.ts +155 -0
- package/build/esm/source/Source.js +281 -0
- package/build/esm/source/Source.js.map +1 -0
- package/build/esm/source/UserMedia.d.ts +123 -0
- package/build/esm/source/UserMedia.js +214 -0
- package/build/esm/source/UserMedia.js.map +1 -0
- package/build/esm/source/buffer/GrainPlayer.d.ts +135 -0
- package/build/esm/source/buffer/GrainPlayer.js +235 -0
- package/build/esm/source/buffer/GrainPlayer.js.map +1 -0
- package/build/esm/source/buffer/Player.d.ts +190 -0
- package/build/esm/source/buffer/Player.js +352 -0
- package/build/esm/source/buffer/Player.js.map +1 -0
- package/build/esm/source/buffer/Players.d.ts +121 -0
- package/build/esm/source/buffer/Players.js +162 -0
- package/build/esm/source/buffer/Players.js.map +1 -0
- package/build/esm/source/buffer/ToneBufferSource.d.ts +97 -0
- package/build/esm/source/buffer/ToneBufferSource.js +196 -0
- package/build/esm/source/buffer/ToneBufferSource.js.map +1 -0
- package/build/esm/source/index.d.ts +15 -0
- package/build/esm/source/index.js +16 -0
- package/build/esm/source/index.js.map +1 -0
- package/build/esm/source/oscillator/AMOscillator.d.ts +101 -0
- package/build/esm/source/oscillator/AMOscillator.js +157 -0
- package/build/esm/source/oscillator/AMOscillator.js.map +1 -0
- package/build/esm/source/oscillator/FMOscillator.d.ts +101 -0
- package/build/esm/source/oscillator/FMOscillator.js +172 -0
- package/build/esm/source/oscillator/FMOscillator.js.map +1 -0
- package/build/esm/source/oscillator/FatOscillator.d.ts +99 -0
- package/build/esm/source/oscillator/FatOscillator.js +195 -0
- package/build/esm/source/oscillator/FatOscillator.js.map +1 -0
- package/build/esm/source/oscillator/LFO.d.ts +167 -0
- package/build/esm/source/oscillator/LFO.js +233 -0
- package/build/esm/source/oscillator/LFO.js.map +1 -0
- package/build/esm/source/oscillator/OmniOscillator.d.ts +162 -0
- package/build/esm/source/oscillator/OmniOscillator.js +348 -0
- package/build/esm/source/oscillator/OmniOscillator.js.map +1 -0
- package/build/esm/source/oscillator/Oscillator.d.ts +125 -0
- package/build/esm/source/oscillator/Oscillator.js +379 -0
- package/build/esm/source/oscillator/Oscillator.js.map +1 -0
- package/build/esm/source/oscillator/OscillatorInterface.d.ts +298 -0
- package/build/esm/source/oscillator/OscillatorInterface.js +22 -0
- package/build/esm/source/oscillator/OscillatorInterface.js.map +1 -0
- package/build/esm/source/oscillator/PWMOscillator.d.ts +94 -0
- package/build/esm/source/oscillator/PWMOscillator.js +136 -0
- package/build/esm/source/oscillator/PWMOscillator.js.map +1 -0
- package/build/esm/source/oscillator/PulseOscillator.d.ts +119 -0
- package/build/esm/source/oscillator/PulseOscillator.js +175 -0
- package/build/esm/source/oscillator/PulseOscillator.js.map +1 -0
- package/build/esm/source/oscillator/ToneOscillatorNode.d.ts +57 -0
- package/build/esm/source/oscillator/ToneOscillatorNode.js +90 -0
- package/build/esm/source/oscillator/ToneOscillatorNode.js.map +1 -0
- package/build/esm/version.d.ts +1 -0
- package/build/esm/version.js +2 -0
- package/build/esm/version.js.map +1 -0
- package/docs/tone.json +1 -0
- package/package.json +116 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { ToneWithContext } from "../context/ToneWithContext";
|
|
2
|
+
import { optionsFromArguments } from "../util/Defaults";
|
|
3
|
+
import { Emitter } from "../util/Emitter";
|
|
4
|
+
import { noOp, readOnly } from "../util/Interface";
|
|
5
|
+
import { StateTimeline } from "../util/StateTimeline";
|
|
6
|
+
import { TickSource } from "./TickSource";
|
|
7
|
+
import { assertContextRunning } from "../util/Debug";
|
|
8
|
+
/**
|
|
9
|
+
* A sample accurate clock which provides a callback at the given rate.
|
|
10
|
+
* While the callback is not sample-accurate (it is still susceptible to
|
|
11
|
+
* loose JS timing), the time passed in as the argument to the callback
|
|
12
|
+
* is precise. For most applications, it is better to use Tone.Transport
|
|
13
|
+
* instead of the Clock by itself since you can synchronize multiple callbacks.
|
|
14
|
+
* @example
|
|
15
|
+
* // the callback will be invoked approximately once a second
|
|
16
|
+
* // and will print the time exactly once a second apart.
|
|
17
|
+
* const clock = new Tone.Clock(time => {
|
|
18
|
+
* console.log(time);
|
|
19
|
+
* }, 1);
|
|
20
|
+
* clock.start();
|
|
21
|
+
* @category Core
|
|
22
|
+
*/
|
|
23
|
+
export class Clock extends ToneWithContext {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(optionsFromArguments(Clock.getDefaults(), arguments, ["callback", "frequency"]));
|
|
26
|
+
this.name = "Clock";
|
|
27
|
+
/**
|
|
28
|
+
* The callback function to invoke at the scheduled tick.
|
|
29
|
+
*/
|
|
30
|
+
this.callback = noOp;
|
|
31
|
+
/**
|
|
32
|
+
* The last time the loop callback was invoked
|
|
33
|
+
*/
|
|
34
|
+
this._lastUpdate = 0;
|
|
35
|
+
/**
|
|
36
|
+
* Keep track of the playback state
|
|
37
|
+
*/
|
|
38
|
+
this._state = new StateTimeline("stopped");
|
|
39
|
+
/**
|
|
40
|
+
* Context bound reference to the _loop method
|
|
41
|
+
* This is necessary to remove the event in the end.
|
|
42
|
+
*/
|
|
43
|
+
this._boundLoop = this._loop.bind(this);
|
|
44
|
+
const options = optionsFromArguments(Clock.getDefaults(), arguments, ["callback", "frequency"]);
|
|
45
|
+
this.callback = options.callback;
|
|
46
|
+
this._tickSource = new TickSource({
|
|
47
|
+
context: this.context,
|
|
48
|
+
frequency: options.frequency,
|
|
49
|
+
units: options.units,
|
|
50
|
+
});
|
|
51
|
+
this._lastUpdate = 0;
|
|
52
|
+
this.frequency = this._tickSource.frequency;
|
|
53
|
+
readOnly(this, "frequency");
|
|
54
|
+
// add an initial state
|
|
55
|
+
this._state.setStateAtTime("stopped", 0);
|
|
56
|
+
// bind a callback to the worker thread
|
|
57
|
+
this.context.on("tick", this._boundLoop);
|
|
58
|
+
}
|
|
59
|
+
static getDefaults() {
|
|
60
|
+
return Object.assign(ToneWithContext.getDefaults(), {
|
|
61
|
+
callback: noOp,
|
|
62
|
+
frequency: 1,
|
|
63
|
+
units: "hertz",
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Returns the playback state of the source, either "started", "stopped" or "paused".
|
|
68
|
+
*/
|
|
69
|
+
get state() {
|
|
70
|
+
return this._state.getValueAtTime(this.now());
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Start the clock at the given time. Optionally pass in an offset
|
|
74
|
+
* of where to start the tick counter from.
|
|
75
|
+
* @param time The time the clock should start
|
|
76
|
+
* @param offset Where the tick counter starts counting from.
|
|
77
|
+
*/
|
|
78
|
+
start(time, offset) {
|
|
79
|
+
// make sure the context is running
|
|
80
|
+
assertContextRunning(this.context);
|
|
81
|
+
// start the loop
|
|
82
|
+
const computedTime = this.toSeconds(time);
|
|
83
|
+
this.log("start", computedTime);
|
|
84
|
+
if (this._state.getValueAtTime(computedTime) !== "started") {
|
|
85
|
+
this._state.setStateAtTime("started", computedTime);
|
|
86
|
+
this._tickSource.start(computedTime, offset);
|
|
87
|
+
if (computedTime < this._lastUpdate) {
|
|
88
|
+
this.emit("start", computedTime, offset);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Stop the clock. Stopping the clock resets the tick counter to 0.
|
|
95
|
+
* @param time The time when the clock should stop.
|
|
96
|
+
* @example
|
|
97
|
+
* const clock = new Tone.Clock(time => {
|
|
98
|
+
* console.log(time);
|
|
99
|
+
* }, 1);
|
|
100
|
+
* clock.start();
|
|
101
|
+
* // stop the clock after 10 seconds
|
|
102
|
+
* clock.stop("+10");
|
|
103
|
+
*/
|
|
104
|
+
stop(time) {
|
|
105
|
+
const computedTime = this.toSeconds(time);
|
|
106
|
+
this.log("stop", computedTime);
|
|
107
|
+
this._state.cancel(computedTime);
|
|
108
|
+
this._state.setStateAtTime("stopped", computedTime);
|
|
109
|
+
this._tickSource.stop(computedTime);
|
|
110
|
+
if (computedTime < this._lastUpdate) {
|
|
111
|
+
this.emit("stop", computedTime);
|
|
112
|
+
}
|
|
113
|
+
return this;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Pause the clock. Pausing does not reset the tick counter.
|
|
117
|
+
* @param time The time when the clock should stop.
|
|
118
|
+
*/
|
|
119
|
+
pause(time) {
|
|
120
|
+
const computedTime = this.toSeconds(time);
|
|
121
|
+
if (this._state.getValueAtTime(computedTime) === "started") {
|
|
122
|
+
this._state.setStateAtTime("paused", computedTime);
|
|
123
|
+
this._tickSource.pause(computedTime);
|
|
124
|
+
if (computedTime < this._lastUpdate) {
|
|
125
|
+
this.emit("pause", computedTime);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The number of times the callback was invoked. Starts counting at 0
|
|
132
|
+
* and increments after the callback was invoked.
|
|
133
|
+
*/
|
|
134
|
+
get ticks() {
|
|
135
|
+
return Math.ceil(this.getTicksAtTime(this.now()));
|
|
136
|
+
}
|
|
137
|
+
set ticks(t) {
|
|
138
|
+
this._tickSource.ticks = t;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The time since ticks=0 that the Clock has been running. Accounts for tempo curves
|
|
142
|
+
*/
|
|
143
|
+
get seconds() {
|
|
144
|
+
return this._tickSource.seconds;
|
|
145
|
+
}
|
|
146
|
+
set seconds(s) {
|
|
147
|
+
this._tickSource.seconds = s;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Return the elapsed seconds at the given time.
|
|
151
|
+
* @param time When to get the elapsed seconds
|
|
152
|
+
* @return The number of elapsed seconds
|
|
153
|
+
*/
|
|
154
|
+
getSecondsAtTime(time) {
|
|
155
|
+
return this._tickSource.getSecondsAtTime(time);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Set the clock's ticks at the given time.
|
|
159
|
+
* @param ticks The tick value to set
|
|
160
|
+
* @param time When to set the tick value
|
|
161
|
+
*/
|
|
162
|
+
setTicksAtTime(ticks, time) {
|
|
163
|
+
this._tickSource.setTicksAtTime(ticks, time);
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Get the time of the given tick. The second argument
|
|
168
|
+
* is when to test before. Since ticks can be set (with setTicksAtTime)
|
|
169
|
+
* there may be multiple times for a given tick value.
|
|
170
|
+
* @param tick The tick number.
|
|
171
|
+
* @param before When to measure the tick value from.
|
|
172
|
+
* @return The time of the tick
|
|
173
|
+
*/
|
|
174
|
+
getTimeOfTick(tick, before = this.now()) {
|
|
175
|
+
return this._tickSource.getTimeOfTick(tick, before);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get the clock's ticks at the given time.
|
|
179
|
+
* @param time When to get the tick value
|
|
180
|
+
* @return The tick value at the given time.
|
|
181
|
+
*/
|
|
182
|
+
getTicksAtTime(time) {
|
|
183
|
+
return this._tickSource.getTicksAtTime(time);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Get the time of the next tick
|
|
187
|
+
* @param offset The tick number.
|
|
188
|
+
*/
|
|
189
|
+
nextTickTime(offset, when) {
|
|
190
|
+
const computedTime = this.toSeconds(when);
|
|
191
|
+
const currentTick = this.getTicksAtTime(computedTime);
|
|
192
|
+
return this._tickSource.getTimeOfTick(currentTick + offset, computedTime);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The scheduling loop.
|
|
196
|
+
*/
|
|
197
|
+
_loop() {
|
|
198
|
+
const startTime = this._lastUpdate;
|
|
199
|
+
const endTime = this.now();
|
|
200
|
+
this._lastUpdate = endTime;
|
|
201
|
+
this.log("loop", startTime, endTime);
|
|
202
|
+
if (startTime !== endTime) {
|
|
203
|
+
// the state change events
|
|
204
|
+
this._state.forEachBetween(startTime, endTime, e => {
|
|
205
|
+
switch (e.state) {
|
|
206
|
+
case "started":
|
|
207
|
+
const offset = this._tickSource.getTicksAtTime(e.time);
|
|
208
|
+
this.emit("start", e.time, offset);
|
|
209
|
+
break;
|
|
210
|
+
case "stopped":
|
|
211
|
+
if (e.time !== 0) {
|
|
212
|
+
this.emit("stop", e.time);
|
|
213
|
+
}
|
|
214
|
+
break;
|
|
215
|
+
case "paused":
|
|
216
|
+
this.emit("pause", e.time);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
// the tick callbacks
|
|
221
|
+
this._tickSource.forEachTickBetween(startTime, endTime, (time, ticks) => {
|
|
222
|
+
this.callback(time, ticks);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Returns the scheduled state at the given time.
|
|
228
|
+
* @param time The time to query.
|
|
229
|
+
* @return The name of the state input in setStateAtTime.
|
|
230
|
+
* @example
|
|
231
|
+
* const clock = new Tone.Clock();
|
|
232
|
+
* clock.start("+0.1");
|
|
233
|
+
* clock.getStateAtTime("+0.1"); // returns "started"
|
|
234
|
+
*/
|
|
235
|
+
getStateAtTime(time) {
|
|
236
|
+
const computedTime = this.toSeconds(time);
|
|
237
|
+
return this._state.getValueAtTime(computedTime);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Clean up
|
|
241
|
+
*/
|
|
242
|
+
dispose() {
|
|
243
|
+
super.dispose();
|
|
244
|
+
this.context.off("tick", this._boundLoop);
|
|
245
|
+
this._tickSource.dispose();
|
|
246
|
+
this._state.dispose();
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
Emitter.mixin(Clock);
|
|
251
|
+
//# sourceMappingURL=Clock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clock.js","sourceRoot":"","sources":["../../../../Tone/core/clock/Clock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA0B,MAAM,4BAA4B,CAAC;AAErF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAiB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAYrD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,KACZ,SAAQ,eAA6B;IAyCrC;QAEC,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;QAzC/E,SAAI,GAAW,OAAO,CAAC;QAEhC;;WAEG;QACH,aAAQ,GAAkB,IAAI,CAAC;QAO/B;;WAEG;QACK,gBAAW,GAAG,CAAC,CAAC;Q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AAI,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;wBAC3B,MAAM;iBACP;YACF,CAAC,CAAC,CAAC;YACH,qBAAqB;YACrB,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBACvE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IAED;;;;;;;;OAQG;IACH,cAAc,CAAC,IAAU;QACxB,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,OAAO;QACN,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;CAUD;AAED,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { AutomationEvent, Param, ParamOptions } from "../context/Param";
|
|
2
|
+
import { Seconds, Ticks, Time, UnitMap, UnitName } from "../type/Units";
|
|
3
|
+
import { Timeline } from "../util/Timeline";
|
|
4
|
+
declare type TickAutomationEvent = AutomationEvent & {
|
|
5
|
+
ticks: number;
|
|
6
|
+
};
|
|
7
|
+
interface TickParamOptions<TypeName extends UnitName> extends ParamOptions<TypeName> {
|
|
8
|
+
multiplier: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A Param class just for computing ticks. Similar to the [[Param]] class,
|
|
12
|
+
* but offers conversion to BPM values as well as ability to compute tick
|
|
13
|
+
* duration and elapsed ticks
|
|
14
|
+
*/
|
|
15
|
+
export declare class TickParam<TypeName extends "hertz" | "bpm"> extends Param<TypeName> {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/**
|
|
18
|
+
* The timeline which tracks all of the automations.
|
|
19
|
+
*/
|
|
20
|
+
protected _events: Timeline<TickAutomationEvent>;
|
|
21
|
+
/**
|
|
22
|
+
* The internal holder for the multiplier value
|
|
23
|
+
*/
|
|
24
|
+
private _multiplier;
|
|
25
|
+
/**
|
|
26
|
+
* @param param The AudioParam to wrap
|
|
27
|
+
* @param units The unit name
|
|
28
|
+
* @param convert Whether or not to convert the value to the target units
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @param value The initial value of the signal
|
|
32
|
+
*/
|
|
33
|
+
constructor(value?: number);
|
|
34
|
+
constructor(options: Partial<TickParamOptions<TypeName>>);
|
|
35
|
+
static getDefaults(): TickParamOptions<any>;
|
|
36
|
+
setTargetAtTime(value: UnitMap[TypeName], time: Time, constant: number): this;
|
|
37
|
+
setValueAtTime(value: UnitMap[TypeName], time: Time): this;
|
|
38
|
+
linearRampToValueAtTime(value: UnitMap[TypeName], time: Time): this;
|
|
39
|
+
exponentialRampToValueAtTime(value: UnitMap[TypeName], time: Time): this;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the tick value at the time. Takes into account
|
|
42
|
+
* any automation curves scheduled on the signal.
|
|
43
|
+
* @param event The time to get the tick count at
|
|
44
|
+
* @return The number of ticks which have elapsed at the time given any automations.
|
|
45
|
+
*/
|
|
46
|
+
private _getTicksUntilEvent;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the tick value at the time. Takes into account
|
|
49
|
+
* any automation curves scheduled on the signal.
|
|
50
|
+
* @param time The time to get the tick count at
|
|
51
|
+
* @return The number of ticks which have elapsed at the time given any automations.
|
|
52
|
+
*/
|
|
53
|
+
getTicksAtTime(time: Time): Ticks;
|
|
54
|
+
/**
|
|
55
|
+
* Return the elapsed time of the number of ticks from the given time
|
|
56
|
+
* @param ticks The number of ticks to calculate
|
|
57
|
+
* @param time The time to get the next tick from
|
|
58
|
+
* @return The duration of the number of ticks from the given time in seconds
|
|
59
|
+
*/
|
|
60
|
+
getDurationOfTicks(ticks: Ticks, time: Time): Seconds;
|
|
61
|
+
/**
|
|
62
|
+
* Given a tick, returns the time that tick occurs at.
|
|
63
|
+
* @return The time that the tick occurs.
|
|
64
|
+
*/
|
|
65
|
+
getTimeOfTick(tick: Ticks): Seconds;
|
|
66
|
+
/**
|
|
67
|
+
* Convert some number of ticks their the duration in seconds accounting
|
|
68
|
+
* for any automation curves starting at the given time.
|
|
69
|
+
* @param ticks The number of ticks to convert to seconds.
|
|
70
|
+
* @param when When along the automation timeline to convert the ticks.
|
|
71
|
+
* @return The duration in seconds of the ticks.
|
|
72
|
+
*/
|
|
73
|
+
ticksToTime(ticks: Ticks, when: Time): Seconds;
|
|
74
|
+
/**
|
|
75
|
+
* The inverse of [[ticksToTime]]. Convert a duration in
|
|
76
|
+
* seconds to the corresponding number of ticks accounting for any
|
|
77
|
+
* automation curves starting at the given time.
|
|
78
|
+
* @param duration The time interval to convert to ticks.
|
|
79
|
+
* @param when When along the automation timeline to convert the ticks.
|
|
80
|
+
* @return The duration in ticks.
|
|
81
|
+
*/
|
|
82
|
+
timeToTicks(duration: Time, when: Time): Ticks;
|
|
83
|
+
/**
|
|
84
|
+
* Convert from the type when the unit value is BPM
|
|
85
|
+
*/
|
|
86
|
+
protected _fromType(val: UnitMap[TypeName]): number;
|
|
87
|
+
/**
|
|
88
|
+
* Special case of type conversion where the units === "bpm"
|
|
89
|
+
*/
|
|
90
|
+
protected _toType(val: number): UnitMap[TypeName];
|
|
91
|
+
/**
|
|
92
|
+
* A multiplier on the bpm value. Useful for setting a PPQ relative to the base frequency value.
|
|
93
|
+
*/
|
|
94
|
+
get multiplier(): number;
|
|
95
|
+
set multiplier(m: number);
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { Param } from "../context/Param";
|
|
2
|
+
import { optionsFromArguments } from "../util/Defaults";
|
|
3
|
+
import { Timeline } from "../util/Timeline";
|
|
4
|
+
import { isUndef } from "../util/TypeCheck";
|
|
5
|
+
/**
|
|
6
|
+
* A Param class just for computing ticks. Similar to the [[Param]] class,
|
|
7
|
+
* but offers conversion to BPM values as well as ability to compute tick
|
|
8
|
+
* duration and elapsed ticks
|
|
9
|
+
*/
|
|
10
|
+
export class TickParam extends Param {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(optionsFromArguments(TickParam.getDefaults(), arguments, ["value"]));
|
|
13
|
+
this.name = "TickParam";
|
|
14
|
+
/**
|
|
15
|
+
* The timeline which tracks all of the automations.
|
|
16
|
+
*/
|
|
17
|
+
this._events = new Timeline(Infinity);
|
|
18
|
+
/**
|
|
19
|
+
* The internal holder for the multiplier value
|
|
20
|
+
*/
|
|
21
|
+
this._multiplier = 1;
|
|
22
|
+
const options = optionsFromArguments(TickParam.getDefaults(), arguments, ["value"]);
|
|
23
|
+
// set the multiplier
|
|
24
|
+
this._multiplier = options.multiplier;
|
|
25
|
+
// clear the ticks from the beginning
|
|
26
|
+
this._events.cancel(0);
|
|
27
|
+
// set an initial event
|
|
28
|
+
this._events.add({
|
|
29
|
+
ticks: 0,
|
|
30
|
+
time: 0,
|
|
31
|
+
type: "setValueAtTime",
|
|
32
|
+
value: this._fromType(options.value),
|
|
33
|
+
});
|
|
34
|
+
this.setValueAtTime(options.value, 0);
|
|
35
|
+
}
|
|
36
|
+
static getDefaults() {
|
|
37
|
+
return Object.assign(Param.getDefaults(), {
|
|
38
|
+
multiplier: 1,
|
|
39
|
+
units: "hertz",
|
|
40
|
+
value: 1,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
setTargetAtTime(value, time, constant) {
|
|
44
|
+
// approximate it with multiple linear ramps
|
|
45
|
+
time = this.toSeconds(time);
|
|
46
|
+
this.setRampPoint(time);
|
|
47
|
+
const computedValue = this._fromType(value);
|
|
48
|
+
// start from previously scheduled value
|
|
49
|
+
const prevEvent = this._events.get(time);
|
|
50
|
+
const segments = Math.round(Math.max(1 / constant, 1));
|
|
51
|
+
for (let i = 0; i <= segments; i++) {
|
|
52
|
+
const segTime = constant * i + time;
|
|
53
|
+
const rampVal = this._exponentialApproach(prevEvent.time, prevEvent.value, computedValue, constant, segTime);
|
|
54
|
+
this.linearRampToValueAtTime(this._toType(rampVal), segTime);
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
setValueAtTime(value, time) {
|
|
59
|
+
const computedTime = this.toSeconds(time);
|
|
60
|
+
super.setValueAtTime(value, time);
|
|
61
|
+
const event = this._events.get(computedTime);
|
|
62
|
+
const previousEvent = this._events.previousEvent(event);
|
|
63
|
+
const ticksUntilTime = this._getTicksUntilEvent(previousEvent, computedTime);
|
|
64
|
+
event.ticks = Math.max(ticksUntilTime, 0);
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
linearRampToValueAtTime(value, time) {
|
|
68
|
+
const computedTime = this.toSeconds(time);
|
|
69
|
+
super.linearRampToValueAtTime(value, time);
|
|
70
|
+
const event = this._events.get(computedTime);
|
|
71
|
+
const previousEvent = this._events.previousEvent(event);
|
|
72
|
+
const ticksUntilTime = this._getTicksUntilEvent(previousEvent, computedTime);
|
|
73
|
+
event.ticks = Math.max(ticksUntilTime, 0);
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
exponentialRampToValueAtTime(value, time) {
|
|
77
|
+
// aproximate it with multiple linear ramps
|
|
78
|
+
time = this.toSeconds(time);
|
|
79
|
+
const computedVal = this._fromType(value);
|
|
80
|
+
// start from previously scheduled value
|
|
81
|
+
const prevEvent = this._events.get(time);
|
|
82
|
+
// approx 10 segments per second
|
|
83
|
+
const segments = Math.round(Math.max((time - prevEvent.time) * 10, 1));
|
|
84
|
+
const segmentDur = ((time - prevEvent.time) / segments);
|
|
85
|
+
for (let i = 0; i <= segments; i++) {
|
|
86
|
+
const segTime = segmentDur * i + prevEvent.time;
|
|
87
|
+
const rampVal = this._exponentialInterpolate(prevEvent.time, prevEvent.value, time, computedVal, segTime);
|
|
88
|
+
this.linearRampToValueAtTime(this._toType(rampVal), segTime);
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Returns the tick value at the time. Takes into account
|
|
94
|
+
* any automation curves scheduled on the signal.
|
|
95
|
+
* @param event The time to get the tick count at
|
|
96
|
+
* @return The number of ticks which have elapsed at the time given any automations.
|
|
97
|
+
*/
|
|
98
|
+
_getTicksUntilEvent(event, time) {
|
|
99
|
+
if (event === null) {
|
|
100
|
+
event = {
|
|
101
|
+
ticks: 0,
|
|
102
|
+
time: 0,
|
|
103
|
+
type: "setValueAtTime",
|
|
104
|
+
value: 0,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else if (isUndef(event.ticks)) {
|
|
108
|
+
const previousEvent = this._events.previousEvent(event);
|
|
109
|
+
event.ticks = this._getTicksUntilEvent(previousEvent, event.time);
|
|
110
|
+
}
|
|
111
|
+
const val0 = this._fromType(this.getValueAtTime(event.time));
|
|
112
|
+
let val1 = this._fromType(this.getValueAtTime(time));
|
|
113
|
+
// if it's right on the line, take the previous value
|
|
114
|
+
const onTheLineEvent = this._events.get(time);
|
|
115
|
+
if (onTheLineEvent && onTheLineEvent.time === time && onTheLineEvent.type === "setValueAtTime") {
|
|
116
|
+
val1 = this._fromType(this.getValueAtTime(time - this.sampleTime));
|
|
117
|
+
}
|
|
118
|
+
return 0.5 * (time - event.time) * (val0 + val1) + event.ticks;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Returns the tick value at the time. Takes into account
|
|
122
|
+
* any automation curves scheduled on the signal.
|
|
123
|
+
* @param time The time to get the tick count at
|
|
124
|
+
* @return The number of ticks which have elapsed at the time given any automations.
|
|
125
|
+
*/
|
|
126
|
+
getTicksAtTime(time) {
|
|
127
|
+
const computedTime = this.toSeconds(time);
|
|
128
|
+
const event = this._events.get(computedTime);
|
|
129
|
+
return Math.max(this._getTicksUntilEvent(event, computedTime), 0);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Return the elapsed time of the number of ticks from the given time
|
|
133
|
+
* @param ticks The number of ticks to calculate
|
|
134
|
+
* @param time The time to get the next tick from
|
|
135
|
+
* @return The duration of the number of ticks from the given time in seconds
|
|
136
|
+
*/
|
|
137
|
+
getDurationOfTicks(ticks, time) {
|
|
138
|
+
const computedTime = this.toSeconds(time);
|
|
139
|
+
const currentTick = this.getTicksAtTime(time);
|
|
140
|
+
return this.getTimeOfTick(currentTick + ticks) - computedTime;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Given a tick, returns the time that tick occurs at.
|
|
144
|
+
* @return The time that the tick occurs.
|
|
145
|
+
*/
|
|
146
|
+
getTimeOfTick(tick) {
|
|
147
|
+
const before = this._events.get(tick, "ticks");
|
|
148
|
+
const after = this._events.getAfter(tick, "ticks");
|
|
149
|
+
if (before && before.ticks === tick) {
|
|
150
|
+
return before.time;
|
|
151
|
+
}
|
|
152
|
+
else if (before && after &&
|
|
153
|
+
after.type === "linearRampToValueAtTime" &&
|
|
154
|
+
before.value !== after.value) {
|
|
155
|
+
const val0 = this._fromType(this.getValueAtTime(before.time));
|
|
156
|
+
const val1 = this._fromType(this.getValueAtTime(after.time));
|
|
157
|
+
const delta = (val1 - val0) / (after.time - before.time);
|
|
158
|
+
const k = Math.sqrt(Math.pow(val0, 2) - 2 * delta * (before.ticks - tick));
|
|
159
|
+
const sol1 = (-val0 + k) / delta;
|
|
160
|
+
const sol2 = (-val0 - k) / delta;
|
|
161
|
+
return (sol1 > 0 ? sol1 : sol2) + before.time;
|
|
162
|
+
}
|
|
163
|
+
else if (before) {
|
|
164
|
+
if (before.value === 0) {
|
|
165
|
+
return Infinity;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
return before.time + (tick - before.ticks) / before.value;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
return tick / this._initialValue;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Convert some number of ticks their the duration in seconds accounting
|
|
177
|
+
* for any automation curves starting at the given time.
|
|
178
|
+
* @param ticks The number of ticks to convert to seconds.
|
|
179
|
+
* @param when When along the automation timeline to convert the ticks.
|
|
180
|
+
* @return The duration in seconds of the ticks.
|
|
181
|
+
*/
|
|
182
|
+
ticksToTime(ticks, when) {
|
|
183
|
+
return this.getDurationOfTicks(ticks, when);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* The inverse of [[ticksToTime]]. Convert a duration in
|
|
187
|
+
* seconds to the corresponding number of ticks accounting for any
|
|
188
|
+
* automation curves starting at the given time.
|
|
189
|
+
* @param duration The time interval to convert to ticks.
|
|
190
|
+
* @param when When along the automation timeline to convert the ticks.
|
|
191
|
+
* @return The duration in ticks.
|
|
192
|
+
*/
|
|
193
|
+
timeToTicks(duration, when) {
|
|
194
|
+
const computedTime = this.toSeconds(when);
|
|
195
|
+
const computedDuration = this.toSeconds(duration);
|
|
196
|
+
const startTicks = this.getTicksAtTime(computedTime);
|
|
197
|
+
const endTicks = this.getTicksAtTime(computedTime + computedDuration);
|
|
198
|
+
return endTicks - startTicks;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Convert from the type when the unit value is BPM
|
|
202
|
+
*/
|
|
203
|
+
_fromType(val) {
|
|
204
|
+
if (this.units === "bpm" && this.multiplier) {
|
|
205
|
+
return 1 / (60 / val / this.multiplier);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return super._fromType(val);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Special case of type conversion where the units === "bpm"
|
|
213
|
+
*/
|
|
214
|
+
_toType(val) {
|
|
215
|
+
if (this.units === "bpm" && this.multiplier) {
|
|
216
|
+
return (val / this.multiplier) * 60;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return super._toType(val);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A multiplier on the bpm value. Useful for setting a PPQ relative to the base frequency value.
|
|
224
|
+
*/
|
|
225
|
+
get multiplier() {
|
|
226
|
+
return this._multiplier;
|
|
227
|
+
}
|
|
228
|
+
set multiplier(m) {
|
|
229
|
+
// get and reset the current value with the new multiplier
|
|
230
|
+
// might be necessary to clear all the previous values
|
|
231
|
+
const currentVal = this.value;
|
|
232
|
+
this._multiplier = m;
|
|
233
|
+
this.cancelScheduledValues(0);
|
|
234
|
+
this.setValueAtTime(currentVal, 0);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
//# sourceMappingURL=TickParam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TickParam.js","sourceRoot":"","sources":["../../../../Tone/core/clock/TickParam.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAgB,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAU5C;;;;GAIG;AACH,MAAM,OAAO,SAA4C,SAAQ,KAAe;IAwB/E;QAEC,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAxBnE,SAAI,GAAW,WAAW,CAAC;QAEpC;;WAEG;QACO,YAAO,GAAkC,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAE1E;;WAEG;QACK,gBAAW,GAAG,CAAC,CAAC;QAevB,MAAM,OAAO,GAAG,oBAAo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CAAC;IAC9B,CAAC;IAED;;OAEG;IACO,SAAS,CAAC,GAAsB;QACzC,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE;YAC5C,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;SACxC;aAAM;YACN,OAAO,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SAC5B;IACF,CAAC;IAED;;OAEG;IACO,OAAO,CAAC,GAAW;QAC5B,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE;YAC5C,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,EAAuB,CAAC;SACzD;aAAM;YACN,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC1B;IACF,CAAC;IACD;;OAEG;IACH,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IACD,IAAI,UAAU,CAAC,CAAS;QACvB,0DAA0D;QAC1D,sDAAsD;QACtD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;CACD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Signal, SignalOptions } from "../../signal/Signal";
|
|
2
|
+
import { InputNode } from "../context/ToneAudioNode";
|
|
3
|
+
import { Seconds, Ticks, Time, UnitMap, UnitName } from "../type/Units";
|
|
4
|
+
import { TickParam } from "./TickParam";
|
|
5
|
+
interface TickSignalOptions<TypeName extends UnitName> extends SignalOptions<TypeName> {
|
|
6
|
+
value: UnitMap[TypeName];
|
|
7
|
+
multiplier: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* TickSignal extends Tone.Signal, but adds the capability
|
|
11
|
+
* to calculate the number of elapsed ticks. exponential and target curves
|
|
12
|
+
* are approximated with multiple linear ramps.
|
|
13
|
+
*
|
|
14
|
+
* Thank you Bruno Dias, H. Sofia Pinto, and David M. Matos,
|
|
15
|
+
* for your [WAC paper](https://smartech.gatech.edu/bitstream/handle/1853/54588/WAC2016-49.pdf)
|
|
16
|
+
* describing integrating timing functions for tempo calculations.
|
|
17
|
+
*/
|
|
18
|
+
export declare class TickSignal<TypeName extends "hertz" | "bpm"> extends Signal<TypeName> {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
/**
|
|
21
|
+
* The param which controls the output signal value
|
|
22
|
+
*/
|
|
23
|
+
protected _param: TickParam<TypeName>;
|
|
24
|
+
readonly input: InputNode;
|
|
25
|
+
/**
|
|
26
|
+
* @param value The initial value of the signal
|
|
27
|
+
*/
|
|
28
|
+
constructor(value?: UnitMap[TypeName]);
|
|
29
|
+
constructor(options: Partial<TickSignalOptions<TypeName>>);
|
|
30
|
+
static getDefaults(): TickSignalOptions<any>;
|
|
31
|
+
ticksToTime(ticks: Ticks, when: Time): Seconds;
|
|
32
|
+
timeToTicks(duration: Time, when: Time): Ticks;
|
|
33
|
+
getTimeOfTick(tick: Ticks): Seconds;
|
|
34
|
+
getDurationOfTicks(ticks: Ticks, time: Time): Seconds;
|
|
35
|
+
getTicksAtTime(time: Time): Ticks;
|
|
36
|
+
/**
|
|
37
|
+
* A multiplier on the bpm value. Useful for setting a PPQ relative to the base frequency value.
|
|
38
|
+
*/
|
|
39
|
+
get multiplier(): number;
|
|
40
|
+
set multiplier(m: number);
|
|
41
|
+
dispose(): this;
|
|
42
|
+
}
|
|
43
|
+
export {};
|